diff --git a/scripts/quickstart_tooling_llc/dev_requirements.txt b/scripts/quickstart_tooling_dpg/dev_requirements.txt similarity index 100% rename from scripts/quickstart_tooling_llc/dev_requirements.txt rename to scripts/quickstart_tooling_dpg/dev_requirements.txt diff --git a/scripts/quickstart_tooling_llc/llc_initial.py b/scripts/quickstart_tooling_dpg/main.py similarity index 95% rename from scripts/quickstart_tooling_llc/llc_initial.py rename to scripts/quickstart_tooling_dpg/main.py index 4018c37aac81..97cc1d81f5d6 100644 --- a/scripts/quickstart_tooling_llc/llc_initial.py +++ b/scripts/quickstart_tooling_dpg/main.py @@ -77,8 +77,8 @@ def build_package(**kwargs) -> None: # generate code with autorest and swagger readme _LOGGER.info("generate SDK code with autorest") - check_call(f'autorest --version=3.7.2 --python --use=@autorest/python@5.12.0 --use=@autorest/modelerfour@4.19.2' - f' --python-mode=update {swagger_readme}', shell=True) + check_call(f'autorest --version=3.7.2 --use=@autorest/python@5.16.0 --use=@autorest/modelerfour@4.19.3' + f' {swagger_readme}', shell=True) # generate necessary file(setup.py, CHANGELOG.md, etc) work_path = Path(output_folder) @@ -130,8 +130,8 @@ def main(**kwargs): " or `D:\\azure-rest-api-specs\\specification\\webpubsub\\data-plane\\WebPubSub\\stable\\2021-10-01\\webpubsub.json`", ) parser.add_argument( - "--credential-scope", "-c", - dest="credential_scope", + "--security-scope", "-c", + dest="security_scope", required=True, help="Each service for data plan should have specific scopes", ) diff --git a/scripts/quickstart_tooling_llc/template/CHANGELOG.md b/scripts/quickstart_tooling_dpg/template/CHANGELOG.md similarity index 100% rename from scripts/quickstart_tooling_llc/template/CHANGELOG.md rename to scripts/quickstart_tooling_dpg/template/CHANGELOG.md diff --git a/scripts/quickstart_tooling_llc/template/LICENSE b/scripts/quickstart_tooling_dpg/template/LICENSE similarity index 100% rename from scripts/quickstart_tooling_llc/template/LICENSE rename to scripts/quickstart_tooling_dpg/template/LICENSE diff --git a/scripts/quickstart_tooling_llc/template/MANIFEST.in b/scripts/quickstart_tooling_dpg/template/MANIFEST.in similarity index 100% rename from scripts/quickstart_tooling_llc/template/MANIFEST.in rename to scripts/quickstart_tooling_dpg/template/MANIFEST.in diff --git a/scripts/quickstart_tooling_llc/template/README.md b/scripts/quickstart_tooling_dpg/template/README.md similarity index 100% rename from scripts/quickstart_tooling_llc/template/README.md rename to scripts/quickstart_tooling_dpg/template/README.md diff --git a/scripts/quickstart_tooling_llc/template/__init__.py b/scripts/quickstart_tooling_dpg/template/__init__.py similarity index 100% rename from scripts/quickstart_tooling_llc/template/__init__.py rename to scripts/quickstart_tooling_dpg/template/__init__.py diff --git a/scripts/quickstart_tooling_llc/template/dev_requirements.txt b/scripts/quickstart_tooling_dpg/template/dev_requirements.txt similarity index 86% rename from scripts/quickstart_tooling_llc/template/dev_requirements.txt rename to scripts/quickstart_tooling_dpg/template/dev_requirements.txt index 892121489c50..8d3c7d8e1144 100644 --- a/scripts/quickstart_tooling_llc/template/dev_requirements.txt +++ b/scripts/quickstart_tooling_dpg/template/dev_requirements.txt @@ -2,6 +2,6 @@ -e ../../../tools/azure-sdk-tools ../../core/azure-core ../../identity/azure-identity -aiohttp>=3.0; +aiohttp>=3.0 typing_extensions>=3.7.2 -asyncio; +asyncio diff --git a/scripts/quickstart_tooling_llc/template/sdk_packaging.toml b/scripts/quickstart_tooling_dpg/template/sdk_packaging.toml similarity index 100% rename from scripts/quickstart_tooling_llc/template/sdk_packaging.toml rename to scripts/quickstart_tooling_dpg/template/sdk_packaging.toml diff --git a/scripts/quickstart_tooling_llc/template/setup.py b/scripts/quickstart_tooling_dpg/template/setup.py similarity index 94% rename from scripts/quickstart_tooling_llc/template/setup.py rename to scripts/quickstart_tooling_dpg/template/setup.py index f783f701cbf3..f724061c6d8d 100644 --- a/scripts/quickstart_tooling_llc/template/setup.py +++ b/scripts/quickstart_tooling_dpg/template/setup.py @@ -5,14 +5,10 @@ # Licensed under the MIT License. See License.txt in the project root for # license information. # -------------------------------------------------------------------------- - - import os import re - from setuptools import setup, find_packages - # Change the PACKAGE_NAME only to change folder and different name PACKAGE_NAME = "{{ package_name }}" PACKAGE_PPRINT_NAME = "{{ package_pprint_name }}" @@ -20,7 +16,6 @@ # a-b-c => a/b/c package_folder_path = PACKAGE_NAME.replace("-", "/") - # Version extraction inspired from 'requests' with open(os.path.join(package_folder_path, "_version.py"), "r") as fd: version = re.search( @@ -56,14 +51,13 @@ packages=find_packages( exclude=[ # Exclude packages that will be covered by PEP420 or nspkg - "azure", - "azure.{{ folder_second }}", + "{{ folder_first }}", + "{{ folder_first }}.{{ folder_second }}", ] ), install_requires=[ - "azure-core<2.0.0,>=1.19.1", + "azure-core<2.0.0,>=1.23.0", "msrest>=0.6.21", - 'six>=1.11.0', ], python_requires=">=3.6", ) diff --git a/scripts/quickstart_tooling_llc/template/swagger_README.md b/scripts/quickstart_tooling_dpg/template/swagger_README.md similarity index 81% rename from scripts/quickstart_tooling_llc/template/swagger_README.md rename to scripts/quickstart_tooling_dpg/template/swagger_README.md index 0bb62589fe65..184ca45e76da 100644 --- a/scripts/quickstart_tooling_llc/template/swagger_README.md +++ b/scripts/quickstart_tooling_dpg/template/swagger_README.md @@ -8,10 +8,9 @@ package-name: {{ package_name }} license-header: MICROSOFT_MIT_NO_VERSION clear-output-folder: true no-namespace-folders: true -python: true title: {{ client_name }} version-tolerant: true package-version: 1.0.0b1 -add-credential: true -credential-scopes: {{ credential_scope }} +security: AADToken +security-scopes: {{ security_scope }} ``` diff --git a/scripts/quickstart_tooling_llc/template_samples/sample.py b/scripts/quickstart_tooling_dpg/template_samples/sample.py similarity index 100% rename from scripts/quickstart_tooling_llc/template_samples/sample.py rename to scripts/quickstart_tooling_dpg/template_samples/sample.py diff --git a/scripts/quickstart_tooling_llc/template_tests/test_smoke.py b/scripts/quickstart_tooling_dpg/template_tests/test_smoke.py similarity index 100% rename from scripts/quickstart_tooling_llc/template_tests/test_smoke.py rename to scripts/quickstart_tooling_dpg/template_tests/test_smoke.py diff --git a/scripts/quickstart_tooling_llc/template_tests/test_smoke_async.py b/scripts/quickstart_tooling_dpg/template_tests/test_smoke_async.py similarity index 100% rename from scripts/quickstart_tooling_llc/template_tests/test_smoke_async.py rename to scripts/quickstart_tooling_dpg/template_tests/test_smoke_async.py diff --git a/scripts/quickstart_tooling_llc/template_tests/testcase.py b/scripts/quickstart_tooling_dpg/template_tests/testcase.py similarity index 100% rename from scripts/quickstart_tooling_llc/template_tests/testcase.py rename to scripts/quickstart_tooling_dpg/template_tests/testcase.py diff --git a/scripts/quickstart_tooling_llc/template_tests/testcase_async.py b/scripts/quickstart_tooling_dpg/template_tests/testcase_async.py similarity index 100% rename from scripts/quickstart_tooling_llc/template_tests/testcase_async.py rename to scripts/quickstart_tooling_dpg/template_tests/testcase_async.py diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/CHANGELOG.md b/sdk/appcontainers/azure-mgmt-appcontainers/CHANGELOG.md new file mode 100644 index 000000000000..529f07881854 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0b1 (2022-05-06) + +* Initial Release diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/LICENSE b/sdk/appcontainers/azure-mgmt-appcontainers/LICENSE new file mode 100644 index 000000000000..b2f52a2bad4e --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/LICENSE @@ -0,0 +1,21 @@ +Copyright (c) Microsoft Corporation. + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/MANIFEST.in b/sdk/appcontainers/azure-mgmt-appcontainers/MANIFEST.in new file mode 100644 index 000000000000..2c31e8da0cb1 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/MANIFEST.in @@ -0,0 +1,6 @@ +include _meta.json +recursive-include tests *.py *.yaml +include *.md +include azure/__init__.py +include azure/mgmt/__init__.py +include LICENSE diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/README.md b/sdk/appcontainers/azure-mgmt-appcontainers/README.md new file mode 100644 index 000000000000..6ee0c9672870 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/README.md @@ -0,0 +1,30 @@ +# Microsoft Azure SDK for Python + +This is the Microsoft Azure Appcontainers Management Client Library. +This package has been tested with Python 3.6+. +For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all). + +## _Disclaimer_ + +_Azure SDK Python packages support for Python 2.7 has ended 01 January 2022. For more information and questions, please refer to https://github.com/Azure/azure-sdk-for-python/issues/20691_ + +# Usage + + +To learn how to use this package, see the [quickstart guide](https://aka.ms/azsdk/python/mgmt) + + + +For docs and references, see [Python SDK References](https://docs.microsoft.com/python/api/overview/azure/) +Code samples for this package can be found at [Appcontainers Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com. +Additional code samples for different Azure services are available at [Samples Repo](https://aka.ms/azsdk/python/mgmt/samples) + + +# Provide Feedback + +If you encounter any bugs or have suggestions, please file an issue in the +[Issues](https://github.com/Azure/azure-sdk-for-python/issues) +section of the project. + + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fazure-mgmt-appcontainers%2FREADME.png) diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/_meta.json b/sdk/appcontainers/azure-mgmt-appcontainers/_meta.json new file mode 100644 index 000000000000..207ca38f91e7 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/_meta.json @@ -0,0 +1,11 @@ +{ + "autorest": "3.7.2", + "use": [ + "@autorest/python@5.13.0", + "@autorest/modelerfour@4.19.3" + ], + "commit": "30c98b21ed04e3b6c80debf1e99918b15132e352", + "repository_url": "https://github.com/Azure/azure-rest-api-specs", + "autorest_command": "autorest specification/app/resource-manager/readme.md --multiapi --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --python3-only --use=@autorest/python@5.13.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2", + "readme": "specification/app/resource-manager/readme.md" +} \ No newline at end of file diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/__init__.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/__init__.py new file mode 100644 index 000000000000..8db66d3d0f0f --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/__init__.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/__init__.py new file mode 100644 index 000000000000..8db66d3d0f0f --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/__init__.py @@ -0,0 +1 @@ +__path__ = __import__("pkgutil").extend_path(__path__, __name__) diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/__init__.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/__init__.py new file mode 100644 index 000000000000..962b4a502e4f --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/__init__.py @@ -0,0 +1,18 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._container_apps_api_client import ContainerAppsAPIClient +from ._version import VERSION + +__version__ = VERSION +__all__ = ['ContainerAppsAPIClient'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_configuration.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_configuration.py new file mode 100644 index 000000000000..60eb6a5be7b0 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_configuration.py @@ -0,0 +1,73 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy + +from ._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential + + +class ContainerAppsAPIClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes + """Configuration for ContainerAppsAPIClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + :keyword api_version: Api Version. Default value is "2022-03-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str + """ + + def __init__( + self, + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(ContainerAppsAPIClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = api_version + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-appcontainers/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs # type: Any + ): + # type: (...) -> None + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_container_apps_api_client.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_container_apps_api_client.py new file mode 100644 index 000000000000..3dd561f1c96c --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_container_apps_api_client.py @@ -0,0 +1,133 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from copy import deepcopy +from typing import Any, TYPE_CHECKING + +from msrest import Deserializer, Serializer + +from azure.core.rest import HttpRequest, HttpResponse +from azure.mgmt.core import ARMPipelineClient + +from . import models +from ._configuration import ContainerAppsAPIClientConfiguration +from .operations import CertificatesOperations, ContainerAppsAuthConfigsOperations, ContainerAppsOperations, ContainerAppsRevisionReplicasOperations, ContainerAppsRevisionsOperations, ContainerAppsSourceControlsOperations, DaprComponentsOperations, ManagedEnvironmentsOperations, ManagedEnvironmentsStoragesOperations, NamespacesOperations, Operations + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential + +class ContainerAppsAPIClient: # pylint: disable=too-many-instance-attributes + """ContainerAppsAPIClient. + + :ivar container_apps_auth_configs: ContainerAppsAuthConfigsOperations operations + :vartype container_apps_auth_configs: + azure.mgmt.appcontainers.operations.ContainerAppsAuthConfigsOperations + :ivar container_apps: ContainerAppsOperations operations + :vartype container_apps: azure.mgmt.appcontainers.operations.ContainerAppsOperations + :ivar container_apps_revisions: ContainerAppsRevisionsOperations operations + :vartype container_apps_revisions: + azure.mgmt.appcontainers.operations.ContainerAppsRevisionsOperations + :ivar container_apps_revision_replicas: ContainerAppsRevisionReplicasOperations operations + :vartype container_apps_revision_replicas: + azure.mgmt.appcontainers.operations.ContainerAppsRevisionReplicasOperations + :ivar dapr_components: DaprComponentsOperations operations + :vartype dapr_components: azure.mgmt.appcontainers.operations.DaprComponentsOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.appcontainers.operations.Operations + :ivar managed_environments: ManagedEnvironmentsOperations operations + :vartype managed_environments: + azure.mgmt.appcontainers.operations.ManagedEnvironmentsOperations + :ivar certificates: CertificatesOperations operations + :vartype certificates: azure.mgmt.appcontainers.operations.CertificatesOperations + :ivar namespaces: NamespacesOperations operations + :vartype namespaces: azure.mgmt.appcontainers.operations.NamespacesOperations + :ivar managed_environments_storages: ManagedEnvironmentsStoragesOperations operations + :vartype managed_environments_storages: + azure.mgmt.appcontainers.operations.ManagedEnvironmentsStoragesOperations + :ivar container_apps_source_controls: ContainerAppsSourceControlsOperations operations + :vartype container_apps_source_controls: + azure.mgmt.appcontainers.operations.ContainerAppsSourceControlsOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + :param base_url: Service URL. Default value is "https://management.azure.com". + :type base_url: str + :keyword api_version: Api Version. Default value is "2022-03-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + """ + + def __init__( + self, + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = ContainerAppsAPIClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.container_apps_auth_configs = ContainerAppsAuthConfigsOperations(self._client, self._config, self._serialize, self._deserialize) + self.container_apps = ContainerAppsOperations(self._client, self._config, self._serialize, self._deserialize) + self.container_apps_revisions = ContainerAppsRevisionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.container_apps_revision_replicas = ContainerAppsRevisionReplicasOperations(self._client, self._config, self._serialize, self._deserialize) + self.dapr_components = DaprComponentsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.managed_environments = ManagedEnvironmentsOperations(self._client, self._config, self._serialize, self._deserialize) + self.certificates = CertificatesOperations(self._client, self._config, self._serialize, self._deserialize) + self.namespaces = NamespacesOperations(self._client, self._config, self._serialize, self._deserialize) + self.managed_environments_storages = ManagedEnvironmentsStoragesOperations(self._client, self._config, self._serialize, self._deserialize) + self.container_apps_source_controls = ContainerAppsSourceControlsOperations(self._client, self._config, self._serialize, self._deserialize) + + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> HttpResponse: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.HttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) + + def close(self): + # type: () -> None + self._client.close() + + def __enter__(self): + # type: () -> ContainerAppsAPIClient + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_metadata.json b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_metadata.json new file mode 100644 index 000000000000..ef96a7b75251 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_metadata.json @@ -0,0 +1,112 @@ +{ + "chosen_version": "2022-03-01", + "total_api_version_list": ["2022-03-01"], + "client": { + "name": "ContainerAppsAPIClient", + "filename": "_container_apps_api_client", + "description": "ContainerAppsAPIClient.", + "host_value": "\"https://management.azure.com\"", + "parameterized_host_template": null, + "azure_arm": true, + "has_lro_operations": true, + "client_side_validation": false, + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerAppsAPIClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ContainerAppsAPIClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + }, + "global_parameters": { + "sync": { + "credential": { + "signature": "credential, # type: \"TokenCredential\"", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials.TokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id, # type: str", + "description": "The ID of the target subscription.", + "docstring_type": "str", + "required": true + } + }, + "async": { + "credential": { + "signature": "credential: \"AsyncTokenCredential\",", + "description": "Credential needed for the client to connect to Azure.", + "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", + "required": true + }, + "subscription_id": { + "signature": "subscription_id: str,", + "description": "The ID of the target subscription.", + "docstring_type": "str", + "required": true + } + }, + "constant": { + }, + "call": "credential, subscription_id", + "service_client_specific": { + "sync": { + "api_version": { + "signature": "api_version=None, # type: Optional[str]", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url=\"https://management.azure.com\", # type: str", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile=KnownProfiles.default, # type: KnownProfiles", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + }, + "async": { + "api_version": { + "signature": "api_version: Optional[str] = None,", + "description": "API version to use if no profile is provided, or if missing in profile.", + "docstring_type": "str", + "required": false + }, + "base_url": { + "signature": "base_url: str = \"https://management.azure.com\",", + "description": "Service URL", + "docstring_type": "str", + "required": false + }, + "profile": { + "signature": "profile: KnownProfiles = KnownProfiles.default,", + "description": "A profile definition, from KnownProfiles to dict.", + "docstring_type": "azure.profiles.KnownProfiles", + "required": false + } + } + } + }, + "config": { + "credential": true, + "credential_scopes": ["https://management.azure.com/.default"], + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + }, + "operation_groups": { + "container_apps_auth_configs": "ContainerAppsAuthConfigsOperations", + "container_apps": "ContainerAppsOperations", + "container_apps_revisions": "ContainerAppsRevisionsOperations", + "container_apps_revision_replicas": "ContainerAppsRevisionReplicasOperations", + "dapr_components": "DaprComponentsOperations", + "operations": "Operations", + "managed_environments": "ManagedEnvironmentsOperations", + "certificates": "CertificatesOperations", + "namespaces": "NamespacesOperations", + "managed_environments_storages": "ManagedEnvironmentsStoragesOperations", + "container_apps_source_controls": "ContainerAppsSourceControlsOperations" + } +} \ No newline at end of file diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_patch.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_vendor.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/scripts/quickstart_tooling_llc/template_tests/conftest.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_version.py similarity index 51% rename from scripts/quickstart_tooling_llc/template_tests/conftest.py rename to sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_version.py index a6ab83f7f5f0..e5754a47ce68 100644 --- a/scripts/quickstart_tooling_llc/template_tests/conftest.py +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/_version.py @@ -1,15 +1,9 @@ -# coding: utf-8 -# ------------------------------------------------------------------------- +# 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. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import sys - -# fixture needs to be visible from conftest - -# Ignore async tests for Python < 3.5 -collect_ignore_glob = [] -if sys.version_info < (3, 5): - collect_ignore_glob.append("*_async.py") \ No newline at end of file +VERSION = "1.0.0b1" diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/__init__.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/__init__.py new file mode 100644 index 000000000000..cb4bbcce8e12 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/__init__.py @@ -0,0 +1,15 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._container_apps_api_client import ContainerAppsAPIClient +__all__ = ['ContainerAppsAPIClient'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/_configuration.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/_configuration.py new file mode 100644 index 000000000000..8c3aafe44398 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/_configuration.py @@ -0,0 +1,72 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy + +from .._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class ContainerAppsAPIClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes + """Configuration for ContainerAppsAPIClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + :keyword api_version: Api Version. Default value is "2022-03-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(ContainerAppsAPIClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = api_version + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-appcontainers/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/_container_apps_api_client.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/_container_apps_api_client.py new file mode 100644 index 000000000000..99da7f7ccaf7 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/_container_apps_api_client.py @@ -0,0 +1,130 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from copy import deepcopy +from typing import Any, Awaitable, TYPE_CHECKING + +from msrest import Deserializer, Serializer + +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient + +from .. import models +from ._configuration import ContainerAppsAPIClientConfiguration +from .operations import CertificatesOperations, ContainerAppsAuthConfigsOperations, ContainerAppsOperations, ContainerAppsRevisionReplicasOperations, ContainerAppsRevisionsOperations, ContainerAppsSourceControlsOperations, DaprComponentsOperations, ManagedEnvironmentsOperations, ManagedEnvironmentsStoragesOperations, NamespacesOperations, Operations + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + +class ContainerAppsAPIClient: # pylint: disable=too-many-instance-attributes + """ContainerAppsAPIClient. + + :ivar container_apps_auth_configs: ContainerAppsAuthConfigsOperations operations + :vartype container_apps_auth_configs: + azure.mgmt.appcontainers.aio.operations.ContainerAppsAuthConfigsOperations + :ivar container_apps: ContainerAppsOperations operations + :vartype container_apps: azure.mgmt.appcontainers.aio.operations.ContainerAppsOperations + :ivar container_apps_revisions: ContainerAppsRevisionsOperations operations + :vartype container_apps_revisions: + azure.mgmt.appcontainers.aio.operations.ContainerAppsRevisionsOperations + :ivar container_apps_revision_replicas: ContainerAppsRevisionReplicasOperations operations + :vartype container_apps_revision_replicas: + azure.mgmt.appcontainers.aio.operations.ContainerAppsRevisionReplicasOperations + :ivar dapr_components: DaprComponentsOperations operations + :vartype dapr_components: azure.mgmt.appcontainers.aio.operations.DaprComponentsOperations + :ivar operations: Operations operations + :vartype operations: azure.mgmt.appcontainers.aio.operations.Operations + :ivar managed_environments: ManagedEnvironmentsOperations operations + :vartype managed_environments: + azure.mgmt.appcontainers.aio.operations.ManagedEnvironmentsOperations + :ivar certificates: CertificatesOperations operations + :vartype certificates: azure.mgmt.appcontainers.aio.operations.CertificatesOperations + :ivar namespaces: NamespacesOperations operations + :vartype namespaces: azure.mgmt.appcontainers.aio.operations.NamespacesOperations + :ivar managed_environments_storages: ManagedEnvironmentsStoragesOperations operations + :vartype managed_environments_storages: + azure.mgmt.appcontainers.aio.operations.ManagedEnvironmentsStoragesOperations + :ivar container_apps_source_controls: ContainerAppsSourceControlsOperations operations + :vartype container_apps_source_controls: + azure.mgmt.appcontainers.aio.operations.ContainerAppsSourceControlsOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The ID of the target subscription. + :type subscription_id: str + :param base_url: Service URL. Default value is "https://management.azure.com". + :type base_url: str + :keyword api_version: Api Version. Default value is "2022-03-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = ContainerAppsAPIClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) + self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.container_apps_auth_configs = ContainerAppsAuthConfigsOperations(self._client, self._config, self._serialize, self._deserialize) + self.container_apps = ContainerAppsOperations(self._client, self._config, self._serialize, self._deserialize) + self.container_apps_revisions = ContainerAppsRevisionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.container_apps_revision_replicas = ContainerAppsRevisionReplicasOperations(self._client, self._config, self._serialize, self._deserialize) + self.dapr_components = DaprComponentsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.managed_environments = ManagedEnvironmentsOperations(self._client, self._config, self._serialize, self._deserialize) + self.certificates = CertificatesOperations(self._client, self._config, self._serialize, self._deserialize) + self.namespaces = NamespacesOperations(self._client, self._config, self._serialize, self._deserialize) + self.managed_environments_storages = ManagedEnvironmentsStoragesOperations(self._client, self._config, self._serialize, self._deserialize) + self.container_apps_source_controls = ContainerAppsSourceControlsOperations(self._client, self._config, self._serialize, self._deserialize) + + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: + """Runs the network request through the client's chained policies. + + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.AsyncHttpResponse + """ + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "ContainerAppsAPIClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/_patch.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/__init__.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/__init__.py new file mode 100644 index 000000000000..505be253220b --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/__init__.py @@ -0,0 +1,33 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._container_apps_auth_configs_operations import ContainerAppsAuthConfigsOperations +from ._container_apps_operations import ContainerAppsOperations +from ._container_apps_revisions_operations import ContainerAppsRevisionsOperations +from ._container_apps_revision_replicas_operations import ContainerAppsRevisionReplicasOperations +from ._dapr_components_operations import DaprComponentsOperations +from ._operations import Operations +from ._managed_environments_operations import ManagedEnvironmentsOperations +from ._certificates_operations import CertificatesOperations +from ._namespaces_operations import NamespacesOperations +from ._managed_environments_storages_operations import ManagedEnvironmentsStoragesOperations +from ._container_apps_source_controls_operations import ContainerAppsSourceControlsOperations + +__all__ = [ + 'ContainerAppsAuthConfigsOperations', + 'ContainerAppsOperations', + 'ContainerAppsRevisionsOperations', + 'ContainerAppsRevisionReplicasOperations', + 'DaprComponentsOperations', + 'Operations', + 'ManagedEnvironmentsOperations', + 'CertificatesOperations', + 'NamespacesOperations', + 'ManagedEnvironmentsStoragesOperations', + 'ContainerAppsSourceControlsOperations', +] diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_certificates_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_certificates_operations.py new file mode 100644 index 000000000000..d69728ec4059 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_certificates_operations.py @@ -0,0 +1,405 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._certificates_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_request, build_update_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class CertificatesOperations: + """CertificatesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appcontainers.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list( + self, + resource_group_name: str, + managed_environment_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.CertificateCollection"]: + """Get the Certificates in a given managed environment. + + Get the Certificates in a given managed environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param managed_environment_name: Name of the Managed Environment. + :type managed_environment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CertificateCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.CertificateCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + managed_environment_name=managed_environment_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + managed_environment_name=managed_environment_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("CertificateCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{managedEnvironmentName}/certificates"} # type: ignore + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + managed_environment_name: str, + name: str, + **kwargs: Any + ) -> "_models.Certificate": + """Get the specified Certificate. + + Get the specified Certificate. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param managed_environment_name: Name of the Managed Environment. + :type managed_environment_name: str + :param name: Name of the Certificate. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Certificate, or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.Certificate + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Certificate"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + managed_environment_name=managed_environment_name, + name=name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Certificate', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{managedEnvironmentName}/certificates/{name}"} # type: ignore + + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + managed_environment_name: str, + name: str, + certificate_envelope: Optional["_models.Certificate"] = None, + **kwargs: Any + ) -> "_models.Certificate": + """Create or Update a Certificate. + + Create or Update a Certificate. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param managed_environment_name: Name of the Managed Environment. + :type managed_environment_name: str + :param name: Name of the Certificate. + :type name: str + :param certificate_envelope: Certificate to be created or updated. Default value is None. + :type certificate_envelope: ~azure.mgmt.appcontainers.models.Certificate + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Certificate, or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.Certificate + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Certificate"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if certificate_envelope is not None: + _json = self._serialize.body(certificate_envelope, 'Certificate') + else: + _json = None + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + managed_environment_name=managed_environment_name, + name=name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Certificate', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{managedEnvironmentName}/certificates/{name}"} # type: ignore + + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + managed_environment_name: str, + name: str, + **kwargs: Any + ) -> None: + """Deletes the specified Certificate. + + Deletes the specified Certificate. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param managed_environment_name: Name of the Managed Environment. + :type managed_environment_name: str + :param name: Name of the Certificate. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + managed_environment_name=managed_environment_name, + name=name, + api_version=api_version, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{managedEnvironmentName}/certificates/{name}"} # type: ignore + + + @distributed_trace_async + async def update( + self, + resource_group_name: str, + managed_environment_name: str, + name: str, + certificate_envelope: "_models.CertificatePatch", + **kwargs: Any + ) -> "_models.Certificate": + """Update properties of a certificate. + + Patches a certificate. Currently only patching of tags is supported. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param managed_environment_name: Name of the Managed Environment. + :type managed_environment_name: str + :param name: Name of the Certificate. + :type name: str + :param certificate_envelope: Properties of a certificate that need to be updated. + :type certificate_envelope: ~azure.mgmt.appcontainers.models.CertificatePatch + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Certificate, or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.Certificate + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Certificate"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(certificate_envelope, 'CertificatePatch') + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + managed_environment_name=managed_environment_name, + name=name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Certificate', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{managedEnvironmentName}/certificates/{name}"} # type: ignore + diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_auth_configs_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_auth_configs_operations.py new file mode 100644 index 000000000000..8af7dd6136e4 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_auth_configs_operations.py @@ -0,0 +1,330 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._container_apps_auth_configs_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_by_container_app_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ContainerAppsAuthConfigsOperations: + """ContainerAppsAuthConfigsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appcontainers.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list_by_container_app( + self, + resource_group_name: str, + container_app_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.AuthConfigCollection"]: + """Get the Container App AuthConfigs in a given resource group. + + Get the Container App AuthConfigs in a given resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param container_app_name: Name of the Container App. + :type container_app_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AuthConfigCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.AuthConfigCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.AuthConfigCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_container_app_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + container_app_name=container_app_name, + api_version=api_version, + template_url=self.list_by_container_app.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_container_app_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + container_app_name=container_app_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("AuthConfigCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_container_app.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/authConfigs"} # type: ignore + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + container_app_name: str, + name: str, + **kwargs: Any + ) -> "_models.AuthConfig": + """Get a AuthConfig of a Container App. + + Get a AuthConfig of a Container App. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param container_app_name: Name of the Container App. + :type container_app_name: str + :param name: Name of the Container App AuthConfig. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AuthConfig, or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.AuthConfig + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AuthConfig"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + container_app_name=container_app_name, + name=name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AuthConfig', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/authConfigs/{name}"} # type: ignore + + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + container_app_name: str, + name: str, + auth_config_envelope: "_models.AuthConfig", + **kwargs: Any + ) -> "_models.AuthConfig": + """Create or update the AuthConfig for a Container App. + + Description for Create or update the AuthConfig for a Container App. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param container_app_name: Name of the Container App. + :type container_app_name: str + :param name: Name of the Container App AuthConfig. + :type name: str + :param auth_config_envelope: Properties used to create a Container App AuthConfig. + :type auth_config_envelope: ~azure.mgmt.appcontainers.models.AuthConfig + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AuthConfig, or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.AuthConfig + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AuthConfig"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(auth_config_envelope, 'AuthConfig') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + container_app_name=container_app_name, + name=name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AuthConfig', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/authConfigs/{name}"} # type: ignore + + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + container_app_name: str, + name: str, + **kwargs: Any + ) -> None: + """Delete a Container App AuthConfig. + + Description for Delete a Container App AuthConfig. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param container_app_name: Name of the Container App. + :type container_app_name: str + :param name: Name of the Container App AuthConfig. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + container_app_name=container_app_name, + name=name, + api_version=api_version, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/authConfigs/{name}"} # type: ignore + diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_operations.py new file mode 100644 index 000000000000..e4fa451b21ae --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_operations.py @@ -0,0 +1,744 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._container_apps_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_resource_group_request, build_list_by_subscription_request, build_list_custom_host_name_analysis_request, build_list_secrets_request, build_update_request_initial +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ContainerAppsOperations: + """ContainerAppsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appcontainers.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list_by_subscription( + self, + **kwargs: Any + ) -> AsyncIterable["_models.ContainerAppCollection"]: + """Get the Container Apps in a given subscription. + + Get the Container Apps in a given subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ContainerAppCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.ContainerAppCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.ContainerAppCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ContainerAppCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.App/containerApps"} # type: ignore + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.ContainerAppCollection"]: + """Get the Container Apps in a given resource group. + + Get the Container Apps in a given resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ContainerAppCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.ContainerAppCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.ContainerAppCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ContainerAppCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps"} # type: ignore + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + name: str, + **kwargs: Any + ) -> "_models.ContainerApp": + """Get the properties of a Container App. + + Get the properties of a Container App. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param name: Name of the Container App. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ContainerApp, or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.ContainerApp + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ContainerApp"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + name=name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ContainerApp', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{name}"} # type: ignore + + + async def _create_or_update_initial( + self, + resource_group_name: str, + name: str, + container_app_envelope: "_models.ContainerApp", + **kwargs: Any + ) -> "_models.ContainerApp": + cls = kwargs.pop('cls', None) # type: ClsType["_models.ContainerApp"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(container_app_envelope, 'ContainerApp') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + name=name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ContainerApp', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ContainerApp', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{name}"} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + name: str, + container_app_envelope: "_models.ContainerApp", + **kwargs: Any + ) -> AsyncLROPoller["_models.ContainerApp"]: + """Create or update a Container App. + + Description for Create or update a Container App. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param name: Name of the Container App. + :type name: str + :param container_app_envelope: Properties used to create a container app. + :type container_app_envelope: ~azure.mgmt.appcontainers.models.ContainerApp + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ContainerApp or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.ContainerApp] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ContainerApp"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + name=name, + container_app_envelope=container_app_envelope, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('ContainerApp', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{name}"} # type: ignore + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + name=name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{name}"} # type: ignore + + + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete a Container App. + + Description for Delete a Container App. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param name: Name of the Container App. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + name=name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{name}"} # type: ignore + + async def _update_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + name: str, + container_app_envelope: "_models.ContainerApp", + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(container_app_envelope, 'ContainerApp') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + name=name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{name}"} # type: ignore + + + @distributed_trace_async + async def begin_update( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + name: str, + container_app_envelope: "_models.ContainerApp", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Update properties of a Container App. + + Patches a Container App using JSON Merge Patch. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param name: Name of the Container App. + :type name: str + :param container_app_envelope: Properties of a Container App that need to be updated. + :type container_app_envelope: ~azure.mgmt.appcontainers.models.ContainerApp + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + name=name, + container_app_envelope=container_app_envelope, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{name}"} # type: ignore + + @distributed_trace_async + async def list_custom_host_name_analysis( + self, + resource_group_name: str, + container_app_name: str, + custom_hostname: Optional[str] = None, + **kwargs: Any + ) -> "_models.CustomHostnameAnalysisResult": + """Analyzes a custom hostname for a Container App. + + Analyzes a custom hostname for a Container App. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param container_app_name: Name of the Container App. + :type container_app_name: str + :param custom_hostname: Custom hostname. Default value is None. + :type custom_hostname: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CustomHostnameAnalysisResult, or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.CustomHostnameAnalysisResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomHostnameAnalysisResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + + request = build_list_custom_host_name_analysis_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + container_app_name=container_app_name, + api_version=api_version, + custom_hostname=custom_hostname, + template_url=self.list_custom_host_name_analysis.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CustomHostnameAnalysisResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_custom_host_name_analysis.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/listCustomHostNameAnalysis"} # type: ignore + + + @distributed_trace_async + async def list_secrets( + self, + resource_group_name: str, + name: str, + **kwargs: Any + ) -> "_models.SecretsCollection": + """List secrets for a container app. + + List secrets for a container app. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param name: Name of the Container App. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SecretsCollection, or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.SecretsCollection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretsCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + + request = build_list_secrets_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + name=name, + api_version=api_version, + template_url=self.list_secrets.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SecretsCollection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_secrets.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{name}/listSecrets"} # type: ignore + diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_revision_replicas_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_revision_replicas_operations.py new file mode 100644 index 000000000000..54fc63c0cf0f --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_revision_replicas_operations.py @@ -0,0 +1,178 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._container_apps_revision_replicas_operations import build_get_replica_request, build_list_replicas_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ContainerAppsRevisionReplicasOperations: + """ContainerAppsRevisionReplicasOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appcontainers.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace_async + async def get_replica( + self, + resource_group_name: str, + container_app_name: str, + revision_name: str, + name: str, + **kwargs: Any + ) -> "_models.Replica": + """Get a replica for a Container App Revision. + + Get a replica for a Container App Revision. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param container_app_name: Name of the Container App. + :type container_app_name: str + :param revision_name: Name of the Container App Revision. + :type revision_name: str + :param name: Name of the Container App Revision Replica. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Replica, or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.Replica + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Replica"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + + request = build_get_replica_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + container_app_name=container_app_name, + revision_name=revision_name, + name=name, + api_version=api_version, + template_url=self.get_replica.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Replica', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_replica.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{revisionName}/replicas/{name}"} # type: ignore + + + @distributed_trace_async + async def list_replicas( + self, + resource_group_name: str, + container_app_name: str, + revision_name: str, + **kwargs: Any + ) -> "_models.ReplicaCollection": + """List replicas for a Container App Revision. + + List replicas for a Container App Revision. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param container_app_name: Name of the Container App. + :type container_app_name: str + :param revision_name: Name of the Container App Revision. + :type revision_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ReplicaCollection, or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.ReplicaCollection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ReplicaCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + + request = build_list_replicas_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + container_app_name=container_app_name, + revision_name=revision_name, + api_version=api_version, + template_url=self.list_replicas.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ReplicaCollection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_replicas.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{revisionName}/replicas"} # type: ignore + diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_revisions_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_revisions_operations.py new file mode 100644 index 000000000000..362739149d46 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_revisions_operations.py @@ -0,0 +1,384 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._container_apps_revisions_operations import build_activate_revision_request, build_deactivate_revision_request, build_get_revision_request, build_list_revisions_request, build_restart_revision_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ContainerAppsRevisionsOperations: + """ContainerAppsRevisionsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appcontainers.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list_revisions( + self, + resource_group_name: str, + container_app_name: str, + filter: Optional[str] = None, + **kwargs: Any + ) -> AsyncIterable["_models.RevisionCollection"]: + """Get the Revisions for a given Container App. + + Get the Revisions for a given Container App. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param container_app_name: Name of the Container App for which Revisions are needed. + :type container_app_name: str + :param filter: The filter to apply on the operation. Default value is None. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either RevisionCollection or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.RevisionCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.RevisionCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_revisions_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + container_app_name=container_app_name, + api_version=api_version, + filter=filter, + template_url=self.list_revisions.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_revisions_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + container_app_name=container_app_name, + api_version=api_version, + filter=filter, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("RevisionCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_revisions.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions"} # type: ignore + + @distributed_trace_async + async def get_revision( + self, + resource_group_name: str, + container_app_name: str, + name: str, + **kwargs: Any + ) -> "_models.Revision": + """Get a revision of a Container App. + + Get a revision of a Container App. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param container_app_name: Name of the Container App. + :type container_app_name: str + :param name: Name of the Container App Revision. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Revision, or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.Revision + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Revision"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + + request = build_get_revision_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + container_app_name=container_app_name, + name=name, + api_version=api_version, + template_url=self.get_revision.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Revision', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_revision.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{name}"} # type: ignore + + + @distributed_trace_async + async def activate_revision( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + container_app_name: str, + name: str, + **kwargs: Any + ) -> None: + """Activates a revision for a Container App. + + Activates a revision for a Container App. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param container_app_name: Name of the Container App. + :type container_app_name: str + :param name: Name of the Container App Revision. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + + request = build_activate_revision_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + container_app_name=container_app_name, + name=name, + api_version=api_version, + template_url=self.activate_revision.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + activate_revision.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{name}/activate"} # type: ignore + + + @distributed_trace_async + async def deactivate_revision( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + container_app_name: str, + name: str, + **kwargs: Any + ) -> None: + """Deactivates a revision for a Container App. + + Deactivates a revision for a Container App. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param container_app_name: Name of the Container App. + :type container_app_name: str + :param name: Name of the Container App Revision. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + + request = build_deactivate_revision_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + container_app_name=container_app_name, + name=name, + api_version=api_version, + template_url=self.deactivate_revision.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + deactivate_revision.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{name}/deactivate"} # type: ignore + + + @distributed_trace_async + async def restart_revision( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + container_app_name: str, + name: str, + **kwargs: Any + ) -> None: + """Restarts a revision for a Container App. + + Restarts a revision for a Container App. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param container_app_name: Name of the Container App. + :type container_app_name: str + :param name: Name of the Container App Revision. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + + request = build_restart_revision_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + container_app_name=container_app_name, + name=name, + api_version=api_version, + template_url=self.restart_revision.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + restart_revision.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{name}/restart"} # type: ignore + diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_source_controls_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_source_controls_operations.py new file mode 100644 index 000000000000..1eed1ce5999e --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_container_apps_source_controls_operations.py @@ -0,0 +1,446 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._container_apps_source_controls_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_container_app_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ContainerAppsSourceControlsOperations: + """ContainerAppsSourceControlsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appcontainers.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list_by_container_app( + self, + resource_group_name: str, + container_app_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.SourceControlCollection"]: + """Get the Container App SourceControls in a given resource group. + + Get the Container App SourceControls in a given resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param container_app_name: Name of the Container App. + :type container_app_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SourceControlCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.SourceControlCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.SourceControlCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_container_app_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + container_app_name=container_app_name, + api_version=api_version, + template_url=self.list_by_container_app.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_container_app_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + container_app_name=container_app_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("SourceControlCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_container_app.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/sourcecontrols"} # type: ignore + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + container_app_name: str, + name: str, + **kwargs: Any + ) -> "_models.SourceControl": + """Get a SourceControl of a Container App. + + Get a SourceControl of a Container App. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param container_app_name: Name of the Container App. + :type container_app_name: str + :param name: Name of the Container App SourceControl. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SourceControl, or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.SourceControl + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SourceControl"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + container_app_name=container_app_name, + name=name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SourceControl', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/sourcecontrols/{name}"} # type: ignore + + + async def _create_or_update_initial( + self, + resource_group_name: str, + container_app_name: str, + name: str, + source_control_envelope: "_models.SourceControl", + **kwargs: Any + ) -> "_models.SourceControl": + cls = kwargs.pop('cls', None) # type: ClsType["_models.SourceControl"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(source_control_envelope, 'SourceControl') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + container_app_name=container_app_name, + name=name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('SourceControl', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('SourceControl', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/sourcecontrols/{name}"} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + container_app_name: str, + name: str, + source_control_envelope: "_models.SourceControl", + **kwargs: Any + ) -> AsyncLROPoller["_models.SourceControl"]: + """Create or update the SourceControl for a Container App. + + Description for Create or update the SourceControl for a Container App. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param container_app_name: Name of the Container App. + :type container_app_name: str + :param name: Name of the Container App SourceControl. + :type name: str + :param source_control_envelope: Properties used to create a Container App SourceControl. + :type source_control_envelope: ~azure.mgmt.appcontainers.models.SourceControl + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either SourceControl or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.SourceControl] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SourceControl"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + name=name, + source_control_envelope=source_control_envelope, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('SourceControl', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/sourcecontrols/{name}"} # type: ignore + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + container_app_name: str, + name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + container_app_name=container_app_name, + name=name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/sourcecontrols/{name}"} # type: ignore + + + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + container_app_name: str, + name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete a Container App SourceControl. + + Description for Delete a Container App SourceControl. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param container_app_name: Name of the Container App. + :type container_app_name: str + :param name: Name of the Container App SourceControl. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + name=name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/sourcecontrols/{name}"} # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_dapr_components_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_dapr_components_operations.py new file mode 100644 index 000000000000..0d4391f38989 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_dapr_components_operations.py @@ -0,0 +1,395 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._dapr_components_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_request, build_list_secrets_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class DaprComponentsOperations: + """DaprComponentsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appcontainers.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list( + self, + resource_group_name: str, + environment_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.DaprComponentsCollection"]: + """Get the Dapr Components for a managed environment. + + Get the Dapr Components for a managed environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. + :type environment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DaprComponentsCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.DaprComponentsCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.DaprComponentsCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + environment_name=environment_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + environment_name=environment_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("DaprComponentsCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents"} # type: ignore + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + environment_name: str, + name: str, + **kwargs: Any + ) -> "_models.DaprComponent": + """Get a dapr component. + + Get a dapr component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. + :type environment_name: str + :param name: Name of the Dapr Component. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DaprComponent, or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.DaprComponent + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DaprComponent"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DaprComponent', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents/{name}"} # type: ignore + + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + environment_name: str, + name: str, + dapr_component_envelope: "_models.DaprComponent", + **kwargs: Any + ) -> "_models.DaprComponent": + """Creates or updates a Dapr Component. + + Creates or updates a Dapr Component in a Managed Environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. + :type environment_name: str + :param name: Name of the Dapr Component. + :type name: str + :param dapr_component_envelope: Configuration details of the Dapr Component. + :type dapr_component_envelope: ~azure.mgmt.appcontainers.models.DaprComponent + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DaprComponent, or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.DaprComponent + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DaprComponent"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(dapr_component_envelope, 'DaprComponent') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DaprComponent', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents/{name}"} # type: ignore + + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + environment_name: str, + name: str, + **kwargs: Any + ) -> None: + """Delete a Dapr Component. + + Delete a Dapr Component from a Managed Environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. + :type environment_name: str + :param name: Name of the Dapr Component. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + api_version=api_version, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents/{name}"} # type: ignore + + + @distributed_trace_async + async def list_secrets( + self, + resource_group_name: str, + environment_name: str, + name: str, + **kwargs: Any + ) -> "_models.DaprSecretsCollection": + """List secrets for a dapr component. + + List secrets for a dapr component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. + :type environment_name: str + :param name: Name of the Dapr Component. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DaprSecretsCollection, or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.DaprSecretsCollection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DaprSecretsCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + + request = build_list_secrets_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + api_version=api_version, + template_url=self.list_secrets.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DaprSecretsCollection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_secrets.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents/{name}/listSecrets"} # type: ignore + diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environments_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environments_operations.py new file mode 100644 index 000000000000..d919dde997b2 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environments_operations.py @@ -0,0 +1,618 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._managed_environments_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_resource_group_request, build_list_by_subscription_request, build_update_request_initial +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ManagedEnvironmentsOperations: + """ManagedEnvironmentsOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appcontainers.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list_by_subscription( + self, + **kwargs: Any + ) -> AsyncIterable["_models.ManagedEnvironmentsCollection"]: + """Get all Environments for a subscription. + + Get all Managed Environments for a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ManagedEnvironmentsCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.ManagedEnvironmentsCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedEnvironmentsCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ManagedEnvironmentsCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.App/managedEnvironments"} # type: ignore + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.ManagedEnvironmentsCollection"]: + """Get all the Environments in a resource group. + + Get all the Managed Environments in a resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ManagedEnvironmentsCollection or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.ManagedEnvironmentsCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedEnvironmentsCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("ManagedEnvironmentsCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments"} # type: ignore + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + name: str, + **kwargs: Any + ) -> "_models.ManagedEnvironment": + """Get the properties of a Managed Environment. + + Get the properties of a Managed Environment used to host container apps. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param name: Name of the Environment. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedEnvironment, or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.ManagedEnvironment + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedEnvironment"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + name=name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ManagedEnvironment', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{name}"} # type: ignore + + + async def _create_or_update_initial( + self, + resource_group_name: str, + name: str, + environment_envelope: "_models.ManagedEnvironment", + **kwargs: Any + ) -> "_models.ManagedEnvironment": + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedEnvironment"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(environment_envelope, 'ManagedEnvironment') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + name=name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ManagedEnvironment', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ManagedEnvironment', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{name}"} # type: ignore + + + @distributed_trace_async + async def begin_create_or_update( + self, + resource_group_name: str, + name: str, + environment_envelope: "_models.ManagedEnvironment", + **kwargs: Any + ) -> AsyncLROPoller["_models.ManagedEnvironment"]: + """Creates or updates a Managed Environment. + + Creates or updates a Managed Environment used to host container apps. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param name: Name of the Environment. + :type name: str + :param environment_envelope: Configuration details of the Environment. + :type environment_envelope: ~azure.mgmt.appcontainers.models.ManagedEnvironment + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedEnvironment or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.appcontainers.models.ManagedEnvironment] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedEnvironment"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + name=name, + environment_envelope=environment_envelope, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('ManagedEnvironment', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{name}"} # type: ignore + + async def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + name=name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{name}"} # type: ignore + + + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + name: str, + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Delete a Managed Environment. + + Delete a Managed Environment if it does not have any container apps. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param name: Name of the Environment. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + name=name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{name}"} # type: ignore + + async def _update_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + name: str, + environment_envelope: "_models.ManagedEnvironment", + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(environment_envelope, 'ManagedEnvironment') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + name=name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{name}"} # type: ignore + + + @distributed_trace_async + async def begin_update( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + name: str, + environment_envelope: "_models.ManagedEnvironment", + **kwargs: Any + ) -> AsyncLROPoller[None]: + """Update Managed Environment's properties. + + Patches a Managed Environment using JSON Merge Patch. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param name: Name of the Environment. + :type name: str + :param environment_envelope: Configuration details of the Environment. + :type environment_envelope: ~azure.mgmt.appcontainers.models.ManagedEnvironment + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._update_initial( + resource_group_name=resource_group_name, + name=name, + environment_envelope=environment_envelope, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{name}"} # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environments_storages_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environments_storages_operations.py new file mode 100644 index 000000000000..420dc70a2e7b --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_managed_environments_storages_operations.py @@ -0,0 +1,303 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._managed_environments_storages_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ManagedEnvironmentsStoragesOperations: + """ManagedEnvironmentsStoragesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appcontainers.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace_async + async def list( + self, + resource_group_name: str, + env_name: str, + **kwargs: Any + ) -> "_models.ManagedEnvironmentStoragesCollection": + """Get all storages for a managedEnvironment. + + Get all storages for a managedEnvironment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param env_name: Name of the Environment. + :type env_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedEnvironmentStoragesCollection, or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.ManagedEnvironmentStoragesCollection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedEnvironmentStoragesCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + env_name=env_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ManagedEnvironmentStoragesCollection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{envName}/storages"} # type: ignore + + + @distributed_trace_async + async def get( + self, + resource_group_name: str, + env_name: str, + name: str, + **kwargs: Any + ) -> "_models.ManagedEnvironmentStorage": + """Get storage for a managedEnvironment. + + Get storage for a managedEnvironment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param env_name: Name of the Environment. + :type env_name: str + :param name: Name of the storage. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedEnvironmentStorage, or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.ManagedEnvironmentStorage + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedEnvironmentStorage"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + env_name=env_name, + name=name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ManagedEnvironmentStorage', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{envName}/storages/{name}"} # type: ignore + + + @distributed_trace_async + async def create_or_update( + self, + resource_group_name: str, + env_name: str, + name: str, + storage_envelope: "_models.ManagedEnvironmentStorage", + **kwargs: Any + ) -> "_models.ManagedEnvironmentStorage": + """Create or update storage for a managedEnvironment. + + Create or update storage for a managedEnvironment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param env_name: Name of the Environment. + :type env_name: str + :param name: Name of the storage. + :type name: str + :param storage_envelope: Configuration details of storage. + :type storage_envelope: ~azure.mgmt.appcontainers.models.ManagedEnvironmentStorage + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedEnvironmentStorage, or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.ManagedEnvironmentStorage + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedEnvironmentStorage"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(storage_envelope, 'ManagedEnvironmentStorage') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + env_name=env_name, + name=name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ManagedEnvironmentStorage', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{envName}/storages/{name}"} # type: ignore + + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + env_name: str, + name: str, + **kwargs: Any + ) -> None: + """Delete storage for a managedEnvironment. + + Delete storage for a managedEnvironment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param env_name: Name of the Environment. + :type env_name: str + :param name: Name of the storage. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + env_name=env_name, + name=name, + api_version=api_version, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{envName}/storages/{name}"} # type: ignore + diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_namespaces_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_namespaces_operations.py new file mode 100644 index 000000000000..0a32907dffb5 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_namespaces_operations.py @@ -0,0 +1,113 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Optional, TypeVar + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._namespaces_operations import build_check_name_availability_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class NamespacesOperations: + """NamespacesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appcontainers.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace_async + async def check_name_availability( + self, + resource_group_name: str, + managed_environment_name: str, + check_name_availability_request: "_models.CheckNameAvailabilityRequest", + **kwargs: Any + ) -> "_models.CheckNameAvailabilityResponse": + """Checks the resource name availability. + + Checks if resource name is available. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param managed_environment_name: Name of the Managed Environment. + :type managed_environment_name: str + :param check_name_availability_request: The check name availability request. + :type check_name_availability_request: + ~azure.mgmt.appcontainers.models.CheckNameAvailabilityRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResponse, or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.CheckNameAvailabilityResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckNameAvailabilityResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(check_name_availability_request, 'CheckNameAvailabilityRequest') + + request = build_check_name_availability_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + managed_environment_name=managed_environment_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.check_name_availability.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CheckNameAvailabilityResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + check_name_availability.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{managedEnvironmentName}/checkNameAvailability"} # type: ignore + diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_operations.py new file mode 100644 index 000000000000..a2773cdaf1ab --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/aio/operations/_operations.py @@ -0,0 +1,116 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models +from ..._vendor import _convert_request +from ...operations._operations import build_list_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class Operations: + """Operations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appcontainers.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list( + self, + **kwargs: Any + ) -> AsyncIterable["_models.AvailableOperations"]: + """Lists all of the available RP operations. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AvailableOperations or the result of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.appcontainers.models.AvailableOperations] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailableOperations"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize("AvailableOperations", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/providers/Microsoft.App/operations"} # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/models/__init__.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/models/__init__.py new file mode 100644 index 000000000000..1948f779e92c --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/models/__init__.py @@ -0,0 +1,269 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._models_py3 import AllowedAudiencesValidation +from ._models_py3 import AllowedPrincipals +from ._models_py3 import AppLogsConfiguration +from ._models_py3 import AppRegistration +from ._models_py3 import Apple +from ._models_py3 import AppleRegistration +from ._models_py3 import AuthConfig +from ._models_py3 import AuthConfigCollection +from ._models_py3 import AuthPlatform +from ._models_py3 import AvailableOperations +from ._models_py3 import AzureActiveDirectory +from ._models_py3 import AzureActiveDirectoryLogin +from ._models_py3 import AzureActiveDirectoryRegistration +from ._models_py3 import AzureActiveDirectoryValidation +from ._models_py3 import AzureCredentials +from ._models_py3 import AzureFileProperties +from ._models_py3 import AzureStaticWebApps +from ._models_py3 import AzureStaticWebAppsRegistration +from ._models_py3 import Certificate +from ._models_py3 import CertificateCollection +from ._models_py3 import CertificatePatch +from ._models_py3 import CertificateProperties +from ._models_py3 import CheckNameAvailabilityRequest +from ._models_py3 import CheckNameAvailabilityResponse +from ._models_py3 import ClientRegistration +from ._models_py3 import Configuration +from ._models_py3 import Container +from ._models_py3 import ContainerApp +from ._models_py3 import ContainerAppCollection +from ._models_py3 import ContainerAppProbe +from ._models_py3 import ContainerAppProbeHttpGet +from ._models_py3 import ContainerAppProbeHttpGetHttpHeadersItem +from ._models_py3 import ContainerAppProbeTcpSocket +from ._models_py3 import ContainerAppSecret +from ._models_py3 import ContainerResources +from ._models_py3 import CookieExpiration +from ._models_py3 import CustomDomain +from ._models_py3 import CustomHostnameAnalysisResult +from ._models_py3 import CustomOpenIdConnectProvider +from ._models_py3 import CustomScaleRule +from ._models_py3 import Dapr +from ._models_py3 import DaprComponent +from ._models_py3 import DaprComponentsCollection +from ._models_py3 import DaprMetadata +from ._models_py3 import DaprSecretsCollection +from ._models_py3 import DefaultAuthorizationPolicy +from ._models_py3 import DefaultErrorResponse +from ._models_py3 import DefaultErrorResponseError +from ._models_py3 import DefaultErrorResponseErrorDetailsItem +from ._models_py3 import EnvironmentVar +from ._models_py3 import Facebook +from ._models_py3 import ForwardProxy +from ._models_py3 import GitHub +from ._models_py3 import GithubActionConfiguration +from ._models_py3 import GlobalValidation +from ._models_py3 import Google +from ._models_py3 import HttpScaleRule +from ._models_py3 import HttpSettings +from ._models_py3 import HttpSettingsRoutes +from ._models_py3 import IdentityProviders +from ._models_py3 import Ingress +from ._models_py3 import JwtClaimChecks +from ._models_py3 import LogAnalyticsConfiguration +from ._models_py3 import Login +from ._models_py3 import LoginRoutes +from ._models_py3 import LoginScopes +from ._models_py3 import ManagedEnvironment +from ._models_py3 import ManagedEnvironmentStorage +from ._models_py3 import ManagedEnvironmentStorageProperties +from ._models_py3 import ManagedEnvironmentStoragesCollection +from ._models_py3 import ManagedEnvironmentsCollection +from ._models_py3 import ManagedServiceIdentity +from ._models_py3 import Nonce +from ._models_py3 import OpenIdConnectClientCredential +from ._models_py3 import OpenIdConnectConfig +from ._models_py3 import OpenIdConnectLogin +from ._models_py3 import OpenIdConnectRegistration +from ._models_py3 import OperationDetail +from ._models_py3 import OperationDisplay +from ._models_py3 import ProxyResource +from ._models_py3 import QueueScaleRule +from ._models_py3 import RegistryCredentials +from ._models_py3 import RegistryInfo +from ._models_py3 import Replica +from ._models_py3 import ReplicaCollection +from ._models_py3 import ReplicaContainer +from ._models_py3 import Resource +from ._models_py3 import Revision +from ._models_py3 import RevisionCollection +from ._models_py3 import Scale +from ._models_py3 import ScaleRule +from ._models_py3 import ScaleRuleAuth +from ._models_py3 import Secret +from ._models_py3 import SecretsCollection +from ._models_py3 import SourceControl +from ._models_py3 import SourceControlCollection +from ._models_py3 import SystemData +from ._models_py3 import Template +from ._models_py3 import TrackedResource +from ._models_py3 import TrafficWeight +from ._models_py3 import Twitter +from ._models_py3 import TwitterRegistration +from ._models_py3 import UserAssignedIdentity +from ._models_py3 import VnetConfiguration +from ._models_py3 import Volume +from ._models_py3 import VolumeMount + + +from ._container_apps_api_client_enums import ( + AccessMode, + ActiveRevisionsMode, + AppProtocol, + BindingType, + CertificateProvisioningState, + CheckNameAvailabilityReason, + ContainerAppProvisioningState, + CookieExpirationConvention, + CreatedByType, + DnsVerificationTestResult, + EnvironmentProvisioningState, + ForwardProxyConvention, + IngressTransportMethod, + ManagedServiceIdentityType, + RevisionHealthState, + RevisionProvisioningState, + Scheme, + SourceControlOperationState, + StorageType, + Type, + UnauthenticatedClientActionV2, +) + +__all__ = [ + 'AllowedAudiencesValidation', + 'AllowedPrincipals', + 'AppLogsConfiguration', + 'AppRegistration', + 'Apple', + 'AppleRegistration', + 'AuthConfig', + 'AuthConfigCollection', + 'AuthPlatform', + 'AvailableOperations', + 'AzureActiveDirectory', + 'AzureActiveDirectoryLogin', + 'AzureActiveDirectoryRegistration', + 'AzureActiveDirectoryValidation', + 'AzureCredentials', + 'AzureFileProperties', + 'AzureStaticWebApps', + 'AzureStaticWebAppsRegistration', + 'Certificate', + 'CertificateCollection', + 'CertificatePatch', + 'CertificateProperties', + 'CheckNameAvailabilityRequest', + 'CheckNameAvailabilityResponse', + 'ClientRegistration', + 'Configuration', + 'Container', + 'ContainerApp', + 'ContainerAppCollection', + 'ContainerAppProbe', + 'ContainerAppProbeHttpGet', + 'ContainerAppProbeHttpGetHttpHeadersItem', + 'ContainerAppProbeTcpSocket', + 'ContainerAppSecret', + 'ContainerResources', + 'CookieExpiration', + 'CustomDomain', + 'CustomHostnameAnalysisResult', + 'CustomOpenIdConnectProvider', + 'CustomScaleRule', + 'Dapr', + 'DaprComponent', + 'DaprComponentsCollection', + 'DaprMetadata', + 'DaprSecretsCollection', + 'DefaultAuthorizationPolicy', + 'DefaultErrorResponse', + 'DefaultErrorResponseError', + 'DefaultErrorResponseErrorDetailsItem', + 'EnvironmentVar', + 'Facebook', + 'ForwardProxy', + 'GitHub', + 'GithubActionConfiguration', + 'GlobalValidation', + 'Google', + 'HttpScaleRule', + 'HttpSettings', + 'HttpSettingsRoutes', + 'IdentityProviders', + 'Ingress', + 'JwtClaimChecks', + 'LogAnalyticsConfiguration', + 'Login', + 'LoginRoutes', + 'LoginScopes', + 'ManagedEnvironment', + 'ManagedEnvironmentStorage', + 'ManagedEnvironmentStorageProperties', + 'ManagedEnvironmentStoragesCollection', + 'ManagedEnvironmentsCollection', + 'ManagedServiceIdentity', + 'Nonce', + 'OpenIdConnectClientCredential', + 'OpenIdConnectConfig', + 'OpenIdConnectLogin', + 'OpenIdConnectRegistration', + 'OperationDetail', + 'OperationDisplay', + 'ProxyResource', + 'QueueScaleRule', + 'RegistryCredentials', + 'RegistryInfo', + 'Replica', + 'ReplicaCollection', + 'ReplicaContainer', + 'Resource', + 'Revision', + 'RevisionCollection', + 'Scale', + 'ScaleRule', + 'ScaleRuleAuth', + 'Secret', + 'SecretsCollection', + 'SourceControl', + 'SourceControlCollection', + 'SystemData', + 'Template', + 'TrackedResource', + 'TrafficWeight', + 'Twitter', + 'TwitterRegistration', + 'UserAssignedIdentity', + 'VnetConfiguration', + 'Volume', + 'VolumeMount', + 'AccessMode', + 'ActiveRevisionsMode', + 'AppProtocol', + 'BindingType', + 'CertificateProvisioningState', + 'CheckNameAvailabilityReason', + 'ContainerAppProvisioningState', + 'CookieExpirationConvention', + 'CreatedByType', + 'DnsVerificationTestResult', + 'EnvironmentProvisioningState', + 'ForwardProxyConvention', + 'IngressTransportMethod', + 'ManagedServiceIdentityType', + 'RevisionHealthState', + 'RevisionProvisioningState', + 'Scheme', + 'SourceControlOperationState', + 'StorageType', + 'Type', + 'UnauthenticatedClientActionV2', +] diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/models/_container_apps_api_client_enums.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/models/_container_apps_api_client_enums.py new file mode 100644 index 000000000000..942689302057 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/models/_container_apps_api_client_enums.py @@ -0,0 +1,197 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from enum import Enum +from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta + + +class AccessMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Access mode for storage + """ + + READ_ONLY = "ReadOnly" + READ_WRITE = "ReadWrite" + +class ActiveRevisionsMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """ActiveRevisionsMode controls how active revisions are handled for the Container app: + + + .. raw:: html + + Multiple: multiple revisions can be active.Single: Only one + revision can be active at a time. Revision weights can not be used in this mode. If no value if + provided, this is the default. + """ + + MULTIPLE = "Multiple" + SINGLE = "Single" + +class AppProtocol(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Tells Dapr which protocol your application is using. Valid options are http and grpc. Default + is http + """ + + HTTP = "http" + GRPC = "grpc" + +class BindingType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Custom Domain binding type. + """ + + DISABLED = "Disabled" + SNI_ENABLED = "SniEnabled" + +class CertificateProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Provisioning state of the certificate. + """ + + SUCCEEDED = "Succeeded" + FAILED = "Failed" + CANCELED = "Canceled" + DELETE_FAILED = "DeleteFailed" + PENDING = "Pending" + +class CheckNameAvailabilityReason(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The reason why the given name is not available. + """ + + INVALID = "Invalid" + ALREADY_EXISTS = "AlreadyExists" + +class ContainerAppProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Provisioning state of the Container App. + """ + + IN_PROGRESS = "InProgress" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + CANCELED = "Canceled" + +class CookieExpirationConvention(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The convention used when determining the session cookie's expiration. + """ + + FIXED_TIME = "FixedTime" + IDENTITY_PROVIDER_DERIVED = "IdentityProviderDerived" + +class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The type of identity that created the resource. + """ + + USER = "User" + APPLICATION = "Application" + MANAGED_IDENTITY = "ManagedIdentity" + KEY = "Key" + +class DnsVerificationTestResult(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """DNS verification test result. + """ + + PASSED = "Passed" + FAILED = "Failed" + SKIPPED = "Skipped" + +class EnvironmentProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Provisioning state of the Environment. + """ + + SUCCEEDED = "Succeeded" + FAILED = "Failed" + CANCELED = "Canceled" + WAITING = "Waiting" + INITIALIZATION_IN_PROGRESS = "InitializationInProgress" + INFRASTRUCTURE_SETUP_IN_PROGRESS = "InfrastructureSetupInProgress" + INFRASTRUCTURE_SETUP_COMPLETE = "InfrastructureSetupComplete" + SCHEDULED_FOR_DELETE = "ScheduledForDelete" + UPGRADE_REQUESTED = "UpgradeRequested" + UPGRADE_FAILED = "UpgradeFailed" + +class ForwardProxyConvention(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The convention used to determine the url of the request made. + """ + + NO_PROXY = "NoProxy" + STANDARD = "Standard" + CUSTOM = "Custom" + +class IngressTransportMethod(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Ingress transport protocol + """ + + AUTO = "auto" + HTTP = "http" + HTTP2 = "http2" + +class ManagedServiceIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Type of managed service identity (where both SystemAssigned and UserAssigned types are + allowed). + """ + + NONE = "None" + SYSTEM_ASSIGNED = "SystemAssigned" + USER_ASSIGNED = "UserAssigned" + SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned,UserAssigned" + +class RevisionHealthState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Current health State of the revision + """ + + HEALTHY = "Healthy" + UNHEALTHY = "Unhealthy" + NONE = "None" + +class RevisionProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Current provisioning State of the revision + """ + + PROVISIONING = "Provisioning" + PROVISIONED = "Provisioned" + FAILED = "Failed" + DEPROVISIONING = "Deprovisioning" + DEPROVISIONED = "Deprovisioned" + +class Scheme(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Scheme to use for connecting to the host. Defaults to HTTP. + """ + + HTTP = "HTTP" + HTTPS = "HTTPS" + +class SourceControlOperationState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Current provisioning State of the operation + """ + + IN_PROGRESS = "InProgress" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + CANCELED = "Canceled" + +class StorageType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Storage type for the volume. If not provided, use EmptyDir. + """ + + AZURE_FILE = "AzureFile" + EMPTY_DIR = "EmptyDir" + +class Type(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The type of probe. + """ + + LIVENESS = "Liveness" + READINESS = "Readiness" + STARTUP = "Startup" + +class UnauthenticatedClientActionV2(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The action to take when an unauthenticated client attempts to access the app. + """ + + REDIRECT_TO_LOGIN_PAGE = "RedirectToLoginPage" + ALLOW_ANONYMOUS = "AllowAnonymous" + RETURN401 = "Return401" + RETURN403 = "Return403" diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/models/_models_py3.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/models/_models_py3.py new file mode 100644 index 000000000000..0767b061c0d2 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/models/_models_py3.py @@ -0,0 +1,5101 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +import datetime +from typing import Dict, List, Optional, Union + +from azure.core.exceptions import HttpResponseError +import msrest.serialization + +from ._container_apps_api_client_enums import * + + +class AllowedAudiencesValidation(msrest.serialization.Model): + """The configuration settings of the Allowed Audiences validation flow. + + :ivar allowed_audiences: The configuration settings of the allowed list of audiences from which + to validate the JWT token. + :vartype allowed_audiences: list[str] + """ + + _attribute_map = { + 'allowed_audiences': {'key': 'allowedAudiences', 'type': '[str]'}, + } + + def __init__( + self, + *, + allowed_audiences: Optional[List[str]] = None, + **kwargs + ): + """ + :keyword allowed_audiences: The configuration settings of the allowed list of audiences from + which to validate the JWT token. + :paramtype allowed_audiences: list[str] + """ + super(AllowedAudiencesValidation, self).__init__(**kwargs) + self.allowed_audiences = allowed_audiences + + +class AllowedPrincipals(msrest.serialization.Model): + """The configuration settings of the Azure Active Directory allowed principals. + + :ivar groups: The list of the allowed groups. + :vartype groups: list[str] + :ivar identities: The list of the allowed identities. + :vartype identities: list[str] + """ + + _attribute_map = { + 'groups': {'key': 'groups', 'type': '[str]'}, + 'identities': {'key': 'identities', 'type': '[str]'}, + } + + def __init__( + self, + *, + groups: Optional[List[str]] = None, + identities: Optional[List[str]] = None, + **kwargs + ): + """ + :keyword groups: The list of the allowed groups. + :paramtype groups: list[str] + :keyword identities: The list of the allowed identities. + :paramtype identities: list[str] + """ + super(AllowedPrincipals, self).__init__(**kwargs) + self.groups = groups + self.identities = identities + + +class Apple(msrest.serialization.Model): + """The configuration settings of the Apple provider. + + :ivar enabled: :code:`false` if the Apple provider should not be enabled despite + the set registration; otherwise, :code:`true`. + :vartype enabled: bool + :ivar registration: The configuration settings of the Apple registration. + :vartype registration: ~azure.mgmt.appcontainers.models.AppleRegistration + :ivar login: The configuration settings of the login flow. + :vartype login: ~azure.mgmt.appcontainers.models.LoginScopes + """ + + _attribute_map = { + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'registration': {'key': 'registration', 'type': 'AppleRegistration'}, + 'login': {'key': 'login', 'type': 'LoginScopes'}, + } + + def __init__( + self, + *, + enabled: Optional[bool] = None, + registration: Optional["AppleRegistration"] = None, + login: Optional["LoginScopes"] = None, + **kwargs + ): + """ + :keyword enabled: :code:`false` if the Apple provider should not be enabled + despite the set registration; otherwise, :code:`true`. + :paramtype enabled: bool + :keyword registration: The configuration settings of the Apple registration. + :paramtype registration: ~azure.mgmt.appcontainers.models.AppleRegistration + :keyword login: The configuration settings of the login flow. + :paramtype login: ~azure.mgmt.appcontainers.models.LoginScopes + """ + super(Apple, self).__init__(**kwargs) + self.enabled = enabled + self.registration = registration + self.login = login + + +class AppleRegistration(msrest.serialization.Model): + """The configuration settings of the registration for the Apple provider. + + :ivar client_id: The Client ID of the app used for login. + :vartype client_id: str + :ivar client_secret_setting_name: The app setting name that contains the client secret. + :vartype client_secret_setting_name: str + """ + + _attribute_map = { + 'client_id': {'key': 'clientId', 'type': 'str'}, + 'client_secret_setting_name': {'key': 'clientSecretSettingName', 'type': 'str'}, + } + + def __init__( + self, + *, + client_id: Optional[str] = None, + client_secret_setting_name: Optional[str] = None, + **kwargs + ): + """ + :keyword client_id: The Client ID of the app used for login. + :paramtype client_id: str + :keyword client_secret_setting_name: The app setting name that contains the client secret. + :paramtype client_secret_setting_name: str + """ + super(AppleRegistration, self).__init__(**kwargs) + self.client_id = client_id + self.client_secret_setting_name = client_secret_setting_name + + +class AppLogsConfiguration(msrest.serialization.Model): + """Configuration of application logs. + + :ivar destination: Logs destination. + :vartype destination: str + :ivar log_analytics_configuration: Log Analytics configuration. + :vartype log_analytics_configuration: + ~azure.mgmt.appcontainers.models.LogAnalyticsConfiguration + """ + + _attribute_map = { + 'destination': {'key': 'destination', 'type': 'str'}, + 'log_analytics_configuration': {'key': 'logAnalyticsConfiguration', 'type': 'LogAnalyticsConfiguration'}, + } + + def __init__( + self, + *, + destination: Optional[str] = None, + log_analytics_configuration: Optional["LogAnalyticsConfiguration"] = None, + **kwargs + ): + """ + :keyword destination: Logs destination. + :paramtype destination: str + :keyword log_analytics_configuration: Log Analytics configuration. + :paramtype log_analytics_configuration: + ~azure.mgmt.appcontainers.models.LogAnalyticsConfiguration + """ + super(AppLogsConfiguration, self).__init__(**kwargs) + self.destination = destination + self.log_analytics_configuration = log_analytics_configuration + + +class AppRegistration(msrest.serialization.Model): + """The configuration settings of the app registration for providers that have app ids and app secrets. + + :ivar app_id: The App ID of the app used for login. + :vartype app_id: str + :ivar app_secret_setting_name: The app setting name that contains the app secret. + :vartype app_secret_setting_name: str + """ + + _attribute_map = { + 'app_id': {'key': 'appId', 'type': 'str'}, + 'app_secret_setting_name': {'key': 'appSecretSettingName', 'type': 'str'}, + } + + def __init__( + self, + *, + app_id: Optional[str] = None, + app_secret_setting_name: Optional[str] = None, + **kwargs + ): + """ + :keyword app_id: The App ID of the app used for login. + :paramtype app_id: str + :keyword app_secret_setting_name: The app setting name that contains the app secret. + :paramtype app_secret_setting_name: str + """ + super(AppRegistration, self).__init__(**kwargs) + self.app_id = app_id + self.app_secret_setting_name = app_secret_setting_name + + +class Resource(msrest.serialization.Model): + """Common fields that are returned in the response for all Azure Resource Manager resources. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.system_data = None + + +class ProxyResource(Resource): + """The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a location. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ProxyResource, self).__init__(**kwargs) + + +class AuthConfig(ProxyResource): + """Configuration settings for the Azure ContainerApp Service Authentication / Authorization feature. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData + :ivar platform: The configuration settings of the platform of ContainerApp Service + Authentication/Authorization. + :vartype platform: ~azure.mgmt.appcontainers.models.AuthPlatform + :ivar global_validation: The configuration settings that determines the validation flow of + users using Service Authentication/Authorization. + :vartype global_validation: ~azure.mgmt.appcontainers.models.GlobalValidation + :ivar identity_providers: The configuration settings of each of the identity providers used to + configure ContainerApp Service Authentication/Authorization. + :vartype identity_providers: ~azure.mgmt.appcontainers.models.IdentityProviders + :ivar login: The configuration settings of the login flow of users using ContainerApp Service + Authentication/Authorization. + :vartype login: ~azure.mgmt.appcontainers.models.Login + :ivar http_settings: The configuration settings of the HTTP requests for authentication and + authorization requests made against ContainerApp Service Authentication/Authorization. + :vartype http_settings: ~azure.mgmt.appcontainers.models.HttpSettings + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'platform': {'key': 'properties.platform', 'type': 'AuthPlatform'}, + 'global_validation': {'key': 'properties.globalValidation', 'type': 'GlobalValidation'}, + 'identity_providers': {'key': 'properties.identityProviders', 'type': 'IdentityProviders'}, + 'login': {'key': 'properties.login', 'type': 'Login'}, + 'http_settings': {'key': 'properties.httpSettings', 'type': 'HttpSettings'}, + } + + def __init__( + self, + *, + platform: Optional["AuthPlatform"] = None, + global_validation: Optional["GlobalValidation"] = None, + identity_providers: Optional["IdentityProviders"] = None, + login: Optional["Login"] = None, + http_settings: Optional["HttpSettings"] = None, + **kwargs + ): + """ + :keyword platform: The configuration settings of the platform of ContainerApp Service + Authentication/Authorization. + :paramtype platform: ~azure.mgmt.appcontainers.models.AuthPlatform + :keyword global_validation: The configuration settings that determines the validation flow of + users using Service Authentication/Authorization. + :paramtype global_validation: ~azure.mgmt.appcontainers.models.GlobalValidation + :keyword identity_providers: The configuration settings of each of the identity providers used + to configure ContainerApp Service Authentication/Authorization. + :paramtype identity_providers: ~azure.mgmt.appcontainers.models.IdentityProviders + :keyword login: The configuration settings of the login flow of users using ContainerApp + Service Authentication/Authorization. + :paramtype login: ~azure.mgmt.appcontainers.models.Login + :keyword http_settings: The configuration settings of the HTTP requests for authentication and + authorization requests made against ContainerApp Service Authentication/Authorization. + :paramtype http_settings: ~azure.mgmt.appcontainers.models.HttpSettings + """ + super(AuthConfig, self).__init__(**kwargs) + self.platform = platform + self.global_validation = global_validation + self.identity_providers = identity_providers + self.login = login + self.http_settings = http_settings + + +class AuthConfigCollection(msrest.serialization.Model): + """AuthConfig collection ARM resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar value: Required. Collection of resources. + :vartype value: list[~azure.mgmt.appcontainers.models.AuthConfig] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[AuthConfig]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["AuthConfig"], + **kwargs + ): + """ + :keyword value: Required. Collection of resources. + :paramtype value: list[~azure.mgmt.appcontainers.models.AuthConfig] + """ + super(AuthConfigCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class AuthPlatform(msrest.serialization.Model): + """The configuration settings of the platform of ContainerApp Service Authentication/Authorization. + + :ivar enabled: :code:`true` if the Authentication / Authorization feature is + enabled for the current app; otherwise, :code:`false`. + :vartype enabled: bool + :ivar runtime_version: The RuntimeVersion of the Authentication / Authorization feature in use + for the current app. + The setting in this value can control the behavior of certain features in the Authentication / + Authorization module. + :vartype runtime_version: str + """ + + _attribute_map = { + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'runtime_version': {'key': 'runtimeVersion', 'type': 'str'}, + } + + def __init__( + self, + *, + enabled: Optional[bool] = None, + runtime_version: Optional[str] = None, + **kwargs + ): + """ + :keyword enabled: :code:`true` if the Authentication / Authorization feature is + enabled for the current app; otherwise, :code:`false`. + :paramtype enabled: bool + :keyword runtime_version: The RuntimeVersion of the Authentication / Authorization feature in + use for the current app. + The setting in this value can control the behavior of certain features in the Authentication / + Authorization module. + :paramtype runtime_version: str + """ + super(AuthPlatform, self).__init__(**kwargs) + self.enabled = enabled + self.runtime_version = runtime_version + + +class AvailableOperations(msrest.serialization.Model): + """Available operations of the service. + + :ivar value: Collection of available operation details. + :vartype value: list[~azure.mgmt.appcontainers.models.OperationDetail] + :ivar next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :vartype next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[OperationDetail]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["OperationDetail"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: Collection of available operation details. + :paramtype value: list[~azure.mgmt.appcontainers.models.OperationDetail] + :keyword next_link: URL client should use to fetch the next page (per server side paging). + It's null for now, added for future use. + :paramtype next_link: str + """ + super(AvailableOperations, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class AzureActiveDirectory(msrest.serialization.Model): + """The configuration settings of the Azure Active directory provider. + + :ivar enabled: :code:`false` if the Azure Active Directory provider should not be + enabled despite the set registration; otherwise, :code:`true`. + :vartype enabled: bool + :ivar registration: The configuration settings of the Azure Active Directory app registration. + :vartype registration: ~azure.mgmt.appcontainers.models.AzureActiveDirectoryRegistration + :ivar login: The configuration settings of the Azure Active Directory login flow. + :vartype login: ~azure.mgmt.appcontainers.models.AzureActiveDirectoryLogin + :ivar validation: The configuration settings of the Azure Active Directory token validation + flow. + :vartype validation: ~azure.mgmt.appcontainers.models.AzureActiveDirectoryValidation + :ivar is_auto_provisioned: Gets a value indicating whether the Azure AD configuration was + auto-provisioned using 1st party tooling. + This is an internal flag primarily intended to support the Azure Management Portal. Users + should not + read or write to this property. + :vartype is_auto_provisioned: bool + """ + + _attribute_map = { + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'registration': {'key': 'registration', 'type': 'AzureActiveDirectoryRegistration'}, + 'login': {'key': 'login', 'type': 'AzureActiveDirectoryLogin'}, + 'validation': {'key': 'validation', 'type': 'AzureActiveDirectoryValidation'}, + 'is_auto_provisioned': {'key': 'isAutoProvisioned', 'type': 'bool'}, + } + + def __init__( + self, + *, + enabled: Optional[bool] = None, + registration: Optional["AzureActiveDirectoryRegistration"] = None, + login: Optional["AzureActiveDirectoryLogin"] = None, + validation: Optional["AzureActiveDirectoryValidation"] = None, + is_auto_provisioned: Optional[bool] = None, + **kwargs + ): + """ + :keyword enabled: :code:`false` if the Azure Active Directory provider should not + be enabled despite the set registration; otherwise, :code:`true`. + :paramtype enabled: bool + :keyword registration: The configuration settings of the Azure Active Directory app + registration. + :paramtype registration: ~azure.mgmt.appcontainers.models.AzureActiveDirectoryRegistration + :keyword login: The configuration settings of the Azure Active Directory login flow. + :paramtype login: ~azure.mgmt.appcontainers.models.AzureActiveDirectoryLogin + :keyword validation: The configuration settings of the Azure Active Directory token validation + flow. + :paramtype validation: ~azure.mgmt.appcontainers.models.AzureActiveDirectoryValidation + :keyword is_auto_provisioned: Gets a value indicating whether the Azure AD configuration was + auto-provisioned using 1st party tooling. + This is an internal flag primarily intended to support the Azure Management Portal. Users + should not + read or write to this property. + :paramtype is_auto_provisioned: bool + """ + super(AzureActiveDirectory, self).__init__(**kwargs) + self.enabled = enabled + self.registration = registration + self.login = login + self.validation = validation + self.is_auto_provisioned = is_auto_provisioned + + +class AzureActiveDirectoryLogin(msrest.serialization.Model): + """The configuration settings of the Azure Active Directory login flow. + + :ivar login_parameters: Login parameters to send to the OpenID Connect authorization endpoint + when + a user logs in. Each parameter must be in the form "key=value". + :vartype login_parameters: list[str] + :ivar disable_www_authenticate: :code:`true` if the www-authenticate provider + should be omitted from the request; otherwise, :code:`false`. + :vartype disable_www_authenticate: bool + """ + + _attribute_map = { + 'login_parameters': {'key': 'loginParameters', 'type': '[str]'}, + 'disable_www_authenticate': {'key': 'disableWWWAuthenticate', 'type': 'bool'}, + } + + def __init__( + self, + *, + login_parameters: Optional[List[str]] = None, + disable_www_authenticate: Optional[bool] = None, + **kwargs + ): + """ + :keyword login_parameters: Login parameters to send to the OpenID Connect authorization + endpoint when + a user logs in. Each parameter must be in the form "key=value". + :paramtype login_parameters: list[str] + :keyword disable_www_authenticate: :code:`true` if the www-authenticate provider + should be omitted from the request; otherwise, :code:`false`. + :paramtype disable_www_authenticate: bool + """ + super(AzureActiveDirectoryLogin, self).__init__(**kwargs) + self.login_parameters = login_parameters + self.disable_www_authenticate = disable_www_authenticate + + +class AzureActiveDirectoryRegistration(msrest.serialization.Model): + """The configuration settings of the Azure Active Directory app registration. + + :ivar open_id_issuer: The OpenID Connect Issuer URI that represents the entity which issues + access tokens for this application. + When using Azure Active Directory, this value is the URI of the directory tenant, e.g. + https://login.microsoftonline.com/v2.0/{tenant-guid}/. + This URI is a case-sensitive identifier for the token issuer. + More information on OpenID Connect Discovery: + http://openid.net/specs/openid-connect-discovery-1_0.html. + :vartype open_id_issuer: str + :ivar client_id: The Client ID of this relying party application, known as the client_id. + This setting is required for enabling OpenID Connection authentication with Azure Active + Directory or + other 3rd party OpenID Connect providers. + More information on OpenID Connect: http://openid.net/specs/openid-connect-core-1_0.html. + :vartype client_id: str + :ivar client_secret_setting_name: The app setting name that contains the client secret of the + relying party application. + :vartype client_secret_setting_name: str + :ivar client_secret_certificate_thumbprint: An alternative to the client secret, that is the + thumbprint of a certificate used for signing purposes. This property acts as + a replacement for the Client Secret. It is also optional. + :vartype client_secret_certificate_thumbprint: str + :ivar client_secret_certificate_subject_alternative_name: An alternative to the client secret + thumbprint, that is the subject alternative name of a certificate used for signing purposes. + This property acts as + a replacement for the Client Secret Certificate Thumbprint. It is also optional. + :vartype client_secret_certificate_subject_alternative_name: str + :ivar client_secret_certificate_issuer: An alternative to the client secret thumbprint, that is + the issuer of a certificate used for signing purposes. This property acts as + a replacement for the Client Secret Certificate Thumbprint. It is also optional. + :vartype client_secret_certificate_issuer: str + """ + + _attribute_map = { + 'open_id_issuer': {'key': 'openIdIssuer', 'type': 'str'}, + 'client_id': {'key': 'clientId', 'type': 'str'}, + 'client_secret_setting_name': {'key': 'clientSecretSettingName', 'type': 'str'}, + 'client_secret_certificate_thumbprint': {'key': 'clientSecretCertificateThumbprint', 'type': 'str'}, + 'client_secret_certificate_subject_alternative_name': {'key': 'clientSecretCertificateSubjectAlternativeName', 'type': 'str'}, + 'client_secret_certificate_issuer': {'key': 'clientSecretCertificateIssuer', 'type': 'str'}, + } + + def __init__( + self, + *, + open_id_issuer: Optional[str] = None, + client_id: Optional[str] = None, + client_secret_setting_name: Optional[str] = None, + client_secret_certificate_thumbprint: Optional[str] = None, + client_secret_certificate_subject_alternative_name: Optional[str] = None, + client_secret_certificate_issuer: Optional[str] = None, + **kwargs + ): + """ + :keyword open_id_issuer: The OpenID Connect Issuer URI that represents the entity which issues + access tokens for this application. + When using Azure Active Directory, this value is the URI of the directory tenant, e.g. + https://login.microsoftonline.com/v2.0/{tenant-guid}/. + This URI is a case-sensitive identifier for the token issuer. + More information on OpenID Connect Discovery: + http://openid.net/specs/openid-connect-discovery-1_0.html. + :paramtype open_id_issuer: str + :keyword client_id: The Client ID of this relying party application, known as the client_id. + This setting is required for enabling OpenID Connection authentication with Azure Active + Directory or + other 3rd party OpenID Connect providers. + More information on OpenID Connect: http://openid.net/specs/openid-connect-core-1_0.html. + :paramtype client_id: str + :keyword client_secret_setting_name: The app setting name that contains the client secret of + the relying party application. + :paramtype client_secret_setting_name: str + :keyword client_secret_certificate_thumbprint: An alternative to the client secret, that is the + thumbprint of a certificate used for signing purposes. This property acts as + a replacement for the Client Secret. It is also optional. + :paramtype client_secret_certificate_thumbprint: str + :keyword client_secret_certificate_subject_alternative_name: An alternative to the client + secret thumbprint, that is the subject alternative name of a certificate used for signing + purposes. This property acts as + a replacement for the Client Secret Certificate Thumbprint. It is also optional. + :paramtype client_secret_certificate_subject_alternative_name: str + :keyword client_secret_certificate_issuer: An alternative to the client secret thumbprint, that + is the issuer of a certificate used for signing purposes. This property acts as + a replacement for the Client Secret Certificate Thumbprint. It is also optional. + :paramtype client_secret_certificate_issuer: str + """ + super(AzureActiveDirectoryRegistration, self).__init__(**kwargs) + self.open_id_issuer = open_id_issuer + self.client_id = client_id + self.client_secret_setting_name = client_secret_setting_name + self.client_secret_certificate_thumbprint = client_secret_certificate_thumbprint + self.client_secret_certificate_subject_alternative_name = client_secret_certificate_subject_alternative_name + self.client_secret_certificate_issuer = client_secret_certificate_issuer + + +class AzureActiveDirectoryValidation(msrest.serialization.Model): + """The configuration settings of the Azure Active Directory token validation flow. + + :ivar jwt_claim_checks: The configuration settings of the checks that should be made while + validating the JWT Claims. + :vartype jwt_claim_checks: ~azure.mgmt.appcontainers.models.JwtClaimChecks + :ivar allowed_audiences: The list of audiences that can make successful + authentication/authorization requests. + :vartype allowed_audiences: list[str] + :ivar default_authorization_policy: The configuration settings of the default authorization + policy. + :vartype default_authorization_policy: + ~azure.mgmt.appcontainers.models.DefaultAuthorizationPolicy + """ + + _attribute_map = { + 'jwt_claim_checks': {'key': 'jwtClaimChecks', 'type': 'JwtClaimChecks'}, + 'allowed_audiences': {'key': 'allowedAudiences', 'type': '[str]'}, + 'default_authorization_policy': {'key': 'defaultAuthorizationPolicy', 'type': 'DefaultAuthorizationPolicy'}, + } + + def __init__( + self, + *, + jwt_claim_checks: Optional["JwtClaimChecks"] = None, + allowed_audiences: Optional[List[str]] = None, + default_authorization_policy: Optional["DefaultAuthorizationPolicy"] = None, + **kwargs + ): + """ + :keyword jwt_claim_checks: The configuration settings of the checks that should be made while + validating the JWT Claims. + :paramtype jwt_claim_checks: ~azure.mgmt.appcontainers.models.JwtClaimChecks + :keyword allowed_audiences: The list of audiences that can make successful + authentication/authorization requests. + :paramtype allowed_audiences: list[str] + :keyword default_authorization_policy: The configuration settings of the default authorization + policy. + :paramtype default_authorization_policy: + ~azure.mgmt.appcontainers.models.DefaultAuthorizationPolicy + """ + super(AzureActiveDirectoryValidation, self).__init__(**kwargs) + self.jwt_claim_checks = jwt_claim_checks + self.allowed_audiences = allowed_audiences + self.default_authorization_policy = default_authorization_policy + + +class AzureCredentials(msrest.serialization.Model): + """Container App credentials. + + :ivar client_id: Client Id. + :vartype client_id: str + :ivar client_secret: Client Secret. + :vartype client_secret: str + :ivar tenant_id: Tenant Id. + :vartype tenant_id: str + :ivar subscription_id: Subscription Id. + :vartype subscription_id: str + """ + + _attribute_map = { + 'client_id': {'key': 'clientId', 'type': 'str'}, + 'client_secret': {'key': 'clientSecret', 'type': 'str'}, + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'subscription_id': {'key': 'subscriptionId', 'type': 'str'}, + } + + def __init__( + self, + *, + client_id: Optional[str] = None, + client_secret: Optional[str] = None, + tenant_id: Optional[str] = None, + subscription_id: Optional[str] = None, + **kwargs + ): + """ + :keyword client_id: Client Id. + :paramtype client_id: str + :keyword client_secret: Client Secret. + :paramtype client_secret: str + :keyword tenant_id: Tenant Id. + :paramtype tenant_id: str + :keyword subscription_id: Subscription Id. + :paramtype subscription_id: str + """ + super(AzureCredentials, self).__init__(**kwargs) + self.client_id = client_id + self.client_secret = client_secret + self.tenant_id = tenant_id + self.subscription_id = subscription_id + + +class AzureFileProperties(msrest.serialization.Model): + """Azure File Properties. + + :ivar account_name: Storage account name for azure file. + :vartype account_name: str + :ivar account_key: Storage account key for azure file. + :vartype account_key: str + :ivar access_mode: Access mode for storage. Possible values include: "ReadOnly", "ReadWrite". + :vartype access_mode: str or ~azure.mgmt.appcontainers.models.AccessMode + :ivar share_name: Azure file share name. + :vartype share_name: str + """ + + _attribute_map = { + 'account_name': {'key': 'accountName', 'type': 'str'}, + 'account_key': {'key': 'accountKey', 'type': 'str'}, + 'access_mode': {'key': 'accessMode', 'type': 'str'}, + 'share_name': {'key': 'shareName', 'type': 'str'}, + } + + def __init__( + self, + *, + account_name: Optional[str] = None, + account_key: Optional[str] = None, + access_mode: Optional[Union[str, "AccessMode"]] = None, + share_name: Optional[str] = None, + **kwargs + ): + """ + :keyword account_name: Storage account name for azure file. + :paramtype account_name: str + :keyword account_key: Storage account key for azure file. + :paramtype account_key: str + :keyword access_mode: Access mode for storage. Possible values include: "ReadOnly", + "ReadWrite". + :paramtype access_mode: str or ~azure.mgmt.appcontainers.models.AccessMode + :keyword share_name: Azure file share name. + :paramtype share_name: str + """ + super(AzureFileProperties, self).__init__(**kwargs) + self.account_name = account_name + self.account_key = account_key + self.access_mode = access_mode + self.share_name = share_name + + +class AzureStaticWebApps(msrest.serialization.Model): + """The configuration settings of the Azure Static Web Apps provider. + + :ivar enabled: :code:`false` if the Azure Static Web Apps provider should not be + enabled despite the set registration; otherwise, :code:`true`. + :vartype enabled: bool + :ivar registration: The configuration settings of the Azure Static Web Apps registration. + :vartype registration: ~azure.mgmt.appcontainers.models.AzureStaticWebAppsRegistration + """ + + _attribute_map = { + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'registration': {'key': 'registration', 'type': 'AzureStaticWebAppsRegistration'}, + } + + def __init__( + self, + *, + enabled: Optional[bool] = None, + registration: Optional["AzureStaticWebAppsRegistration"] = None, + **kwargs + ): + """ + :keyword enabled: :code:`false` if the Azure Static Web Apps provider should not + be enabled despite the set registration; otherwise, :code:`true`. + :paramtype enabled: bool + :keyword registration: The configuration settings of the Azure Static Web Apps registration. + :paramtype registration: ~azure.mgmt.appcontainers.models.AzureStaticWebAppsRegistration + """ + super(AzureStaticWebApps, self).__init__(**kwargs) + self.enabled = enabled + self.registration = registration + + +class AzureStaticWebAppsRegistration(msrest.serialization.Model): + """The configuration settings of the registration for the Azure Static Web Apps provider. + + :ivar client_id: The Client ID of the app used for login. + :vartype client_id: str + """ + + _attribute_map = { + 'client_id': {'key': 'clientId', 'type': 'str'}, + } + + def __init__( + self, + *, + client_id: Optional[str] = None, + **kwargs + ): + """ + :keyword client_id: The Client ID of the app used for login. + :paramtype client_id: str + """ + super(AzureStaticWebAppsRegistration, self).__init__(**kwargs) + self.client_id = client_id + + +class TrackedResource(Resource): + """The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + """ + super(TrackedResource, self).__init__(**kwargs) + self.tags = tags + self.location = location + + +class Certificate(TrackedResource): + """Certificate used for Custom Domain bindings of Container Apps in a Managed Environment. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str + :ivar properties: Certificate resource specific properties. + :vartype properties: ~azure.mgmt.appcontainers.models.CertificateProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'location': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'properties': {'key': 'properties', 'type': 'CertificateProperties'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + properties: Optional["CertificateProperties"] = None, + **kwargs + ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + :keyword properties: Certificate resource specific properties. + :paramtype properties: ~azure.mgmt.appcontainers.models.CertificateProperties + """ + super(Certificate, self).__init__(tags=tags, location=location, **kwargs) + self.properties = properties + + +class CertificateCollection(msrest.serialization.Model): + """Collection of Certificates. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar value: Required. Collection of resources. + :vartype value: list[~azure.mgmt.appcontainers.models.Certificate] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Certificate]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["Certificate"], + **kwargs + ): + """ + :keyword value: Required. Collection of resources. + :paramtype value: list[~azure.mgmt.appcontainers.models.Certificate] + """ + super(CertificateCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class CertificatePatch(msrest.serialization.Model): + """A certificate to update. + + :ivar tags: A set of tags. Application-specific metadata in the form of key-value pairs. + :vartype tags: dict[str, str] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + """ + :keyword tags: A set of tags. Application-specific metadata in the form of key-value pairs. + :paramtype tags: dict[str, str] + """ + super(CertificatePatch, self).__init__(**kwargs) + self.tags = tags + + +class CertificateProperties(msrest.serialization.Model): + """Certificate resource specific properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar provisioning_state: Provisioning state of the certificate. Possible values include: + "Succeeded", "Failed", "Canceled", "DeleteFailed", "Pending". + :vartype provisioning_state: str or + ~azure.mgmt.appcontainers.models.CertificateProvisioningState + :ivar password: Certificate password. + :vartype password: str + :ivar subject_name: Subject name of the certificate. + :vartype subject_name: str + :ivar value: PFX or PEM blob. + :vartype value: bytearray + :ivar issuer: Certificate issuer. + :vartype issuer: str + :ivar issue_date: Certificate issue Date. + :vartype issue_date: ~datetime.datetime + :ivar expiration_date: Certificate expiration date. + :vartype expiration_date: ~datetime.datetime + :ivar thumbprint: Certificate thumbprint. + :vartype thumbprint: str + :ivar valid: Is the certificate valid?. + :vartype valid: bool + :ivar public_key_hash: Public key hash. + :vartype public_key_hash: str + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'subject_name': {'readonly': True}, + 'issuer': {'readonly': True}, + 'issue_date': {'readonly': True}, + 'expiration_date': {'readonly': True}, + 'thumbprint': {'readonly': True}, + 'valid': {'readonly': True}, + 'public_key_hash': {'readonly': True}, + } + + _attribute_map = { + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'password': {'key': 'password', 'type': 'str'}, + 'subject_name': {'key': 'subjectName', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'bytearray'}, + 'issuer': {'key': 'issuer', 'type': 'str'}, + 'issue_date': {'key': 'issueDate', 'type': 'iso-8601'}, + 'expiration_date': {'key': 'expirationDate', 'type': 'iso-8601'}, + 'thumbprint': {'key': 'thumbprint', 'type': 'str'}, + 'valid': {'key': 'valid', 'type': 'bool'}, + 'public_key_hash': {'key': 'publicKeyHash', 'type': 'str'}, + } + + def __init__( + self, + *, + password: Optional[str] = None, + value: Optional[bytearray] = None, + **kwargs + ): + """ + :keyword password: Certificate password. + :paramtype password: str + :keyword value: PFX or PEM blob. + :paramtype value: bytearray + """ + super(CertificateProperties, self).__init__(**kwargs) + self.provisioning_state = None + self.password = password + self.subject_name = None + self.value = value + self.issuer = None + self.issue_date = None + self.expiration_date = None + self.thumbprint = None + self.valid = None + self.public_key_hash = None + + +class CheckNameAvailabilityRequest(msrest.serialization.Model): + """The check availability request body. + + :ivar name: The name of the resource for which availability needs to be checked. + :vartype name: str + :ivar type: The resource type. + :vartype type: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + type: Optional[str] = None, + **kwargs + ): + """ + :keyword name: The name of the resource for which availability needs to be checked. + :paramtype name: str + :keyword type: The resource type. + :paramtype type: str + """ + super(CheckNameAvailabilityRequest, self).__init__(**kwargs) + self.name = name + self.type = type + + +class CheckNameAvailabilityResponse(msrest.serialization.Model): + """The check availability result. + + :ivar name_available: Indicates if the resource name is available. + :vartype name_available: bool + :ivar reason: The reason why the given name is not available. Possible values include: + "Invalid", "AlreadyExists". + :vartype reason: str or ~azure.mgmt.appcontainers.models.CheckNameAvailabilityReason + :ivar message: Detailed reason why the given name is available. + :vartype message: str + """ + + _attribute_map = { + 'name_available': {'key': 'nameAvailable', 'type': 'bool'}, + 'reason': {'key': 'reason', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + } + + def __init__( + self, + *, + name_available: Optional[bool] = None, + reason: Optional[Union[str, "CheckNameAvailabilityReason"]] = None, + message: Optional[str] = None, + **kwargs + ): + """ + :keyword name_available: Indicates if the resource name is available. + :paramtype name_available: bool + :keyword reason: The reason why the given name is not available. Possible values include: + "Invalid", "AlreadyExists". + :paramtype reason: str or ~azure.mgmt.appcontainers.models.CheckNameAvailabilityReason + :keyword message: Detailed reason why the given name is available. + :paramtype message: str + """ + super(CheckNameAvailabilityResponse, self).__init__(**kwargs) + self.name_available = name_available + self.reason = reason + self.message = message + + +class ClientRegistration(msrest.serialization.Model): + """The configuration settings of the app registration for providers that have client ids and client secrets. + + :ivar client_id: The Client ID of the app used for login. + :vartype client_id: str + :ivar client_secret_setting_name: The app setting name that contains the client secret. + :vartype client_secret_setting_name: str + """ + + _attribute_map = { + 'client_id': {'key': 'clientId', 'type': 'str'}, + 'client_secret_setting_name': {'key': 'clientSecretSettingName', 'type': 'str'}, + } + + def __init__( + self, + *, + client_id: Optional[str] = None, + client_secret_setting_name: Optional[str] = None, + **kwargs + ): + """ + :keyword client_id: The Client ID of the app used for login. + :paramtype client_id: str + :keyword client_secret_setting_name: The app setting name that contains the client secret. + :paramtype client_secret_setting_name: str + """ + super(ClientRegistration, self).__init__(**kwargs) + self.client_id = client_id + self.client_secret_setting_name = client_secret_setting_name + + +class Configuration(msrest.serialization.Model): + """Non versioned Container App configuration properties that define the mutable settings of a Container app. + + :ivar secrets: Collection of secrets used by a Container app. + :vartype secrets: list[~azure.mgmt.appcontainers.models.Secret] + :ivar active_revisions_mode: ActiveRevisionsMode controls how active revisions are handled for + the Container app: + + + .. raw:: html + + Multiple: multiple revisions can be active.Single: Only one + revision can be active at a time. Revision weights can not be used in this mode. If no value if + provided, this is the default.. Possible values include: "Multiple", "Single". + :vartype active_revisions_mode: str or ~azure.mgmt.appcontainers.models.ActiveRevisionsMode + :ivar ingress: Ingress configurations. + :vartype ingress: ~azure.mgmt.appcontainers.models.Ingress + :ivar registries: Collection of private container registry credentials for containers used by + the Container app. + :vartype registries: list[~azure.mgmt.appcontainers.models.RegistryCredentials] + :ivar dapr: Dapr configuration for the Container App. + :vartype dapr: ~azure.mgmt.appcontainers.models.Dapr + """ + + _attribute_map = { + 'secrets': {'key': 'secrets', 'type': '[Secret]'}, + 'active_revisions_mode': {'key': 'activeRevisionsMode', 'type': 'str'}, + 'ingress': {'key': 'ingress', 'type': 'Ingress'}, + 'registries': {'key': 'registries', 'type': '[RegistryCredentials]'}, + 'dapr': {'key': 'dapr', 'type': 'Dapr'}, + } + + def __init__( + self, + *, + secrets: Optional[List["Secret"]] = None, + active_revisions_mode: Optional[Union[str, "ActiveRevisionsMode"]] = None, + ingress: Optional["Ingress"] = None, + registries: Optional[List["RegistryCredentials"]] = None, + dapr: Optional["Dapr"] = None, + **kwargs + ): + """ + :keyword secrets: Collection of secrets used by a Container app. + :paramtype secrets: list[~azure.mgmt.appcontainers.models.Secret] + :keyword active_revisions_mode: ActiveRevisionsMode controls how active revisions are handled + for the Container app: + + + .. raw:: html + + Multiple: multiple revisions can be active.Single: Only one + revision can be active at a time. Revision weights can not be used in this mode. If no value if + provided, this is the default.. Possible values include: "Multiple", "Single". + :paramtype active_revisions_mode: str or ~azure.mgmt.appcontainers.models.ActiveRevisionsMode + :keyword ingress: Ingress configurations. + :paramtype ingress: ~azure.mgmt.appcontainers.models.Ingress + :keyword registries: Collection of private container registry credentials for containers used + by the Container app. + :paramtype registries: list[~azure.mgmt.appcontainers.models.RegistryCredentials] + :keyword dapr: Dapr configuration for the Container App. + :paramtype dapr: ~azure.mgmt.appcontainers.models.Dapr + """ + super(Configuration, self).__init__(**kwargs) + self.secrets = secrets + self.active_revisions_mode = active_revisions_mode + self.ingress = ingress + self.registries = registries + self.dapr = dapr + + +class Container(msrest.serialization.Model): + """Container App container definition. + + :ivar image: Container image tag. + :vartype image: str + :ivar name: Custom container name. + :vartype name: str + :ivar command: Container start command. + :vartype command: list[str] + :ivar args: Container start command arguments. + :vartype args: list[str] + :ivar env: Container environment variables. + :vartype env: list[~azure.mgmt.appcontainers.models.EnvironmentVar] + :ivar resources: Container resource requirements. + :vartype resources: ~azure.mgmt.appcontainers.models.ContainerResources + :ivar probes: List of probes for the container. + :vartype probes: list[~azure.mgmt.appcontainers.models.ContainerAppProbe] + :ivar volume_mounts: Container volume mounts. + :vartype volume_mounts: list[~azure.mgmt.appcontainers.models.VolumeMount] + """ + + _attribute_map = { + 'image': {'key': 'image', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'command': {'key': 'command', 'type': '[str]'}, + 'args': {'key': 'args', 'type': '[str]'}, + 'env': {'key': 'env', 'type': '[EnvironmentVar]'}, + 'resources': {'key': 'resources', 'type': 'ContainerResources'}, + 'probes': {'key': 'probes', 'type': '[ContainerAppProbe]'}, + 'volume_mounts': {'key': 'volumeMounts', 'type': '[VolumeMount]'}, + } + + def __init__( + self, + *, + image: Optional[str] = None, + name: Optional[str] = None, + command: Optional[List[str]] = None, + args: Optional[List[str]] = None, + env: Optional[List["EnvironmentVar"]] = None, + resources: Optional["ContainerResources"] = None, + probes: Optional[List["ContainerAppProbe"]] = None, + volume_mounts: Optional[List["VolumeMount"]] = None, + **kwargs + ): + """ + :keyword image: Container image tag. + :paramtype image: str + :keyword name: Custom container name. + :paramtype name: str + :keyword command: Container start command. + :paramtype command: list[str] + :keyword args: Container start command arguments. + :paramtype args: list[str] + :keyword env: Container environment variables. + :paramtype env: list[~azure.mgmt.appcontainers.models.EnvironmentVar] + :keyword resources: Container resource requirements. + :paramtype resources: ~azure.mgmt.appcontainers.models.ContainerResources + :keyword probes: List of probes for the container. + :paramtype probes: list[~azure.mgmt.appcontainers.models.ContainerAppProbe] + :keyword volume_mounts: Container volume mounts. + :paramtype volume_mounts: list[~azure.mgmt.appcontainers.models.VolumeMount] + """ + super(Container, self).__init__(**kwargs) + self.image = image + self.name = name + self.command = command + self.args = args + self.env = env + self.resources = resources + self.probes = probes + self.volume_mounts = volume_mounts + + +class ContainerApp(TrackedResource): + """Container App. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str + :ivar identity: managed identities for the Container App to interact with other Azure services + without maintaining any secrets or credentials in code. + :vartype identity: ~azure.mgmt.appcontainers.models.ManagedServiceIdentity + :ivar provisioning_state: Provisioning state of the Container App. Possible values include: + "InProgress", "Succeeded", "Failed", "Canceled". + :vartype provisioning_state: str or + ~azure.mgmt.appcontainers.models.ContainerAppProvisioningState + :ivar managed_environment_id: Resource ID of the Container App's environment. + :vartype managed_environment_id: str + :ivar latest_revision_name: Name of the latest revision of the Container App. + :vartype latest_revision_name: str + :ivar latest_revision_fqdn: Fully Qualified Domain Name of the latest revision of the Container + App. + :vartype latest_revision_fqdn: str + :ivar custom_domain_verification_id: Id used to verify domain name ownership. + :vartype custom_domain_verification_id: str + :ivar configuration: Non versioned Container App configuration properties. + :vartype configuration: ~azure.mgmt.appcontainers.models.Configuration + :ivar template: Container App versioned application definition. + :vartype template: ~azure.mgmt.appcontainers.models.Template + :ivar outbound_ip_addresses: Outbound IP Addresses for container app. + :vartype outbound_ip_addresses: list[str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'location': {'required': True}, + 'provisioning_state': {'readonly': True}, + 'latest_revision_name': {'readonly': True}, + 'latest_revision_fqdn': {'readonly': True}, + 'custom_domain_verification_id': {'readonly': True}, + 'outbound_ip_addresses': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'ManagedServiceIdentity'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'managed_environment_id': {'key': 'properties.managedEnvironmentId', 'type': 'str'}, + 'latest_revision_name': {'key': 'properties.latestRevisionName', 'type': 'str'}, + 'latest_revision_fqdn': {'key': 'properties.latestRevisionFqdn', 'type': 'str'}, + 'custom_domain_verification_id': {'key': 'properties.customDomainVerificationId', 'type': 'str'}, + 'configuration': {'key': 'properties.configuration', 'type': 'Configuration'}, + 'template': {'key': 'properties.template', 'type': 'Template'}, + 'outbound_ip_addresses': {'key': 'properties.outboundIPAddresses', 'type': '[str]'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + identity: Optional["ManagedServiceIdentity"] = None, + managed_environment_id: Optional[str] = None, + configuration: Optional["Configuration"] = None, + template: Optional["Template"] = None, + **kwargs + ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + :keyword identity: managed identities for the Container App to interact with other Azure + services without maintaining any secrets or credentials in code. + :paramtype identity: ~azure.mgmt.appcontainers.models.ManagedServiceIdentity + :keyword managed_environment_id: Resource ID of the Container App's environment. + :paramtype managed_environment_id: str + :keyword configuration: Non versioned Container App configuration properties. + :paramtype configuration: ~azure.mgmt.appcontainers.models.Configuration + :keyword template: Container App versioned application definition. + :paramtype template: ~azure.mgmt.appcontainers.models.Template + """ + super(ContainerApp, self).__init__(tags=tags, location=location, **kwargs) + self.identity = identity + self.provisioning_state = None + self.managed_environment_id = managed_environment_id + self.latest_revision_name = None + self.latest_revision_fqdn = None + self.custom_domain_verification_id = None + self.configuration = configuration + self.template = template + self.outbound_ip_addresses = None + + +class ContainerAppCollection(msrest.serialization.Model): + """Container App collection ARM resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar value: Required. Collection of resources. + :vartype value: list[~azure.mgmt.appcontainers.models.ContainerApp] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ContainerApp]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["ContainerApp"], + **kwargs + ): + """ + :keyword value: Required. Collection of resources. + :paramtype value: list[~azure.mgmt.appcontainers.models.ContainerApp] + """ + super(ContainerAppCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class ContainerAppProbe(msrest.serialization.Model): + """Probe describes a health check to be performed against a container to determine whether it is alive or ready to receive traffic. + + :ivar failure_threshold: Minimum consecutive failures for the probe to be considered failed + after having succeeded. Defaults to 3. Minimum value is 1. Maximum value is 10. + :vartype failure_threshold: int + :ivar http_get: HTTPGet specifies the http request to perform. + :vartype http_get: ~azure.mgmt.appcontainers.models.ContainerAppProbeHttpGet + :ivar initial_delay_seconds: Number of seconds after the container has started before liveness + probes are initiated. Minimum value is 1. Maximum value is 60. + :vartype initial_delay_seconds: int + :ivar period_seconds: How often (in seconds) to perform the probe. Default to 10 seconds. + Minimum value is 1. Maximum value is 240. + :vartype period_seconds: int + :ivar success_threshold: Minimum consecutive successes for the probe to be considered + successful after having failed. Defaults to 1. Must be 1 for liveness and startup. Minimum + value is 1. Maximum value is 10. + :vartype success_threshold: int + :ivar tcp_socket: TCPSocket specifies an action involving a TCP port. TCP hooks not yet + supported. + :vartype tcp_socket: ~azure.mgmt.appcontainers.models.ContainerAppProbeTcpSocket + :ivar termination_grace_period_seconds: Optional duration in seconds the pod needs to terminate + gracefully upon probe failure. The grace period is the duration in seconds after the processes + running in the pod are sent a termination signal and the time when the processes are forcibly + halted with a kill signal. Set this value longer than the expected cleanup time for your + process. If this value is nil, the pod's terminationGracePeriodSeconds will be used. Otherwise, + this value overrides the value provided by the pod spec. Value must be non-negative integer. + The value zero indicates stop immediately via the kill signal (no opportunity to shut down). + This is an alpha field and requires enabling ProbeTerminationGracePeriod feature gate. Maximum + value is 3600 seconds (1 hour). + :vartype termination_grace_period_seconds: long + :ivar timeout_seconds: Number of seconds after which the probe times out. Defaults to 1 second. + Minimum value is 1. Maximum value is 240. + :vartype timeout_seconds: int + :ivar type: The type of probe. Possible values include: "Liveness", "Readiness", "Startup". + :vartype type: str or ~azure.mgmt.appcontainers.models.Type + """ + + _attribute_map = { + 'failure_threshold': {'key': 'failureThreshold', 'type': 'int'}, + 'http_get': {'key': 'httpGet', 'type': 'ContainerAppProbeHttpGet'}, + 'initial_delay_seconds': {'key': 'initialDelaySeconds', 'type': 'int'}, + 'period_seconds': {'key': 'periodSeconds', 'type': 'int'}, + 'success_threshold': {'key': 'successThreshold', 'type': 'int'}, + 'tcp_socket': {'key': 'tcpSocket', 'type': 'ContainerAppProbeTcpSocket'}, + 'termination_grace_period_seconds': {'key': 'terminationGracePeriodSeconds', 'type': 'long'}, + 'timeout_seconds': {'key': 'timeoutSeconds', 'type': 'int'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + *, + failure_threshold: Optional[int] = None, + http_get: Optional["ContainerAppProbeHttpGet"] = None, + initial_delay_seconds: Optional[int] = None, + period_seconds: Optional[int] = None, + success_threshold: Optional[int] = None, + tcp_socket: Optional["ContainerAppProbeTcpSocket"] = None, + termination_grace_period_seconds: Optional[int] = None, + timeout_seconds: Optional[int] = None, + type: Optional[Union[str, "Type"]] = None, + **kwargs + ): + """ + :keyword failure_threshold: Minimum consecutive failures for the probe to be considered failed + after having succeeded. Defaults to 3. Minimum value is 1. Maximum value is 10. + :paramtype failure_threshold: int + :keyword http_get: HTTPGet specifies the http request to perform. + :paramtype http_get: ~azure.mgmt.appcontainers.models.ContainerAppProbeHttpGet + :keyword initial_delay_seconds: Number of seconds after the container has started before + liveness probes are initiated. Minimum value is 1. Maximum value is 60. + :paramtype initial_delay_seconds: int + :keyword period_seconds: How often (in seconds) to perform the probe. Default to 10 seconds. + Minimum value is 1. Maximum value is 240. + :paramtype period_seconds: int + :keyword success_threshold: Minimum consecutive successes for the probe to be considered + successful after having failed. Defaults to 1. Must be 1 for liveness and startup. Minimum + value is 1. Maximum value is 10. + :paramtype success_threshold: int + :keyword tcp_socket: TCPSocket specifies an action involving a TCP port. TCP hooks not yet + supported. + :paramtype tcp_socket: ~azure.mgmt.appcontainers.models.ContainerAppProbeTcpSocket + :keyword termination_grace_period_seconds: Optional duration in seconds the pod needs to + terminate gracefully upon probe failure. The grace period is the duration in seconds after the + processes running in the pod are sent a termination signal and the time when the processes are + forcibly halted with a kill signal. Set this value longer than the expected cleanup time for + your process. If this value is nil, the pod's terminationGracePeriodSeconds will be used. + Otherwise, this value overrides the value provided by the pod spec. Value must be non-negative + integer. The value zero indicates stop immediately via the kill signal (no opportunity to shut + down). This is an alpha field and requires enabling ProbeTerminationGracePeriod feature gate. + Maximum value is 3600 seconds (1 hour). + :paramtype termination_grace_period_seconds: long + :keyword timeout_seconds: Number of seconds after which the probe times out. Defaults to 1 + second. Minimum value is 1. Maximum value is 240. + :paramtype timeout_seconds: int + :keyword type: The type of probe. Possible values include: "Liveness", "Readiness", "Startup". + :paramtype type: str or ~azure.mgmt.appcontainers.models.Type + """ + super(ContainerAppProbe, self).__init__(**kwargs) + self.failure_threshold = failure_threshold + self.http_get = http_get + self.initial_delay_seconds = initial_delay_seconds + self.period_seconds = period_seconds + self.success_threshold = success_threshold + self.tcp_socket = tcp_socket + self.termination_grace_period_seconds = termination_grace_period_seconds + self.timeout_seconds = timeout_seconds + self.type = type + + +class ContainerAppProbeHttpGet(msrest.serialization.Model): + """HTTPGet specifies the http request to perform. + + All required parameters must be populated in order to send to Azure. + + :ivar host: Host name to connect to, defaults to the pod IP. You probably want to set "Host" in + httpHeaders instead. + :vartype host: str + :ivar http_headers: Custom headers to set in the request. HTTP allows repeated headers. + :vartype http_headers: + list[~azure.mgmt.appcontainers.models.ContainerAppProbeHttpGetHttpHeadersItem] + :ivar path: Path to access on the HTTP server. + :vartype path: str + :ivar port: Required. Name or number of the port to access on the container. Number must be in + the range 1 to 65535. Name must be an IANA_SVC_NAME. + :vartype port: int + :ivar scheme: Scheme to use for connecting to the host. Defaults to HTTP. Possible values + include: "HTTP", "HTTPS". + :vartype scheme: str or ~azure.mgmt.appcontainers.models.Scheme + """ + + _validation = { + 'port': {'required': True}, + } + + _attribute_map = { + 'host': {'key': 'host', 'type': 'str'}, + 'http_headers': {'key': 'httpHeaders', 'type': '[ContainerAppProbeHttpGetHttpHeadersItem]'}, + 'path': {'key': 'path', 'type': 'str'}, + 'port': {'key': 'port', 'type': 'int'}, + 'scheme': {'key': 'scheme', 'type': 'str'}, + } + + def __init__( + self, + *, + port: int, + host: Optional[str] = None, + http_headers: Optional[List["ContainerAppProbeHttpGetHttpHeadersItem"]] = None, + path: Optional[str] = None, + scheme: Optional[Union[str, "Scheme"]] = None, + **kwargs + ): + """ + :keyword host: Host name to connect to, defaults to the pod IP. You probably want to set "Host" + in httpHeaders instead. + :paramtype host: str + :keyword http_headers: Custom headers to set in the request. HTTP allows repeated headers. + :paramtype http_headers: + list[~azure.mgmt.appcontainers.models.ContainerAppProbeHttpGetHttpHeadersItem] + :keyword path: Path to access on the HTTP server. + :paramtype path: str + :keyword port: Required. Name or number of the port to access on the container. Number must be + in the range 1 to 65535. Name must be an IANA_SVC_NAME. + :paramtype port: int + :keyword scheme: Scheme to use for connecting to the host. Defaults to HTTP. Possible values + include: "HTTP", "HTTPS". + :paramtype scheme: str or ~azure.mgmt.appcontainers.models.Scheme + """ + super(ContainerAppProbeHttpGet, self).__init__(**kwargs) + self.host = host + self.http_headers = http_headers + self.path = path + self.port = port + self.scheme = scheme + + +class ContainerAppProbeHttpGetHttpHeadersItem(msrest.serialization.Model): + """HTTPHeader describes a custom header to be used in HTTP probes. + + All required parameters must be populated in order to send to Azure. + + :ivar name: Required. The header field name. + :vartype name: str + :ivar value: Required. The header field value. + :vartype value: str + """ + + _validation = { + 'name': {'required': True}, + 'value': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, + } + + def __init__( + self, + *, + name: str, + value: str, + **kwargs + ): + """ + :keyword name: Required. The header field name. + :paramtype name: str + :keyword value: Required. The header field value. + :paramtype value: str + """ + super(ContainerAppProbeHttpGetHttpHeadersItem, self).__init__(**kwargs) + self.name = name + self.value = value + + +class ContainerAppProbeTcpSocket(msrest.serialization.Model): + """TCPSocket specifies an action involving a TCP port. TCP hooks not yet supported. + + All required parameters must be populated in order to send to Azure. + + :ivar host: Optional: Host name to connect to, defaults to the pod IP. + :vartype host: str + :ivar port: Required. Number or name of the port to access on the container. Number must be in + the range 1 to 65535. Name must be an IANA_SVC_NAME. + :vartype port: int + """ + + _validation = { + 'port': {'required': True}, + } + + _attribute_map = { + 'host': {'key': 'host', 'type': 'str'}, + 'port': {'key': 'port', 'type': 'int'}, + } + + def __init__( + self, + *, + port: int, + host: Optional[str] = None, + **kwargs + ): + """ + :keyword host: Optional: Host name to connect to, defaults to the pod IP. + :paramtype host: str + :keyword port: Required. Number or name of the port to access on the container. Number must be + in the range 1 to 65535. Name must be an IANA_SVC_NAME. + :paramtype port: int + """ + super(ContainerAppProbeTcpSocket, self).__init__(**kwargs) + self.host = host + self.port = port + + +class ContainerAppSecret(msrest.serialization.Model): + """Container App Secret. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: Secret Name. + :vartype name: str + :ivar value: Secret Value. + :vartype value: str + """ + + _validation = { + 'name': {'readonly': True}, + 'value': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ContainerAppSecret, self).__init__(**kwargs) + self.name = None + self.value = None + + +class ContainerResources(msrest.serialization.Model): + """Container App container resource requirements. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar cpu: Required CPU in cores, e.g. 0.5. + :vartype cpu: float + :ivar memory: Required memory, e.g. "250Mb". + :vartype memory: str + :ivar ephemeral_storage: Ephemeral Storage, e.g. "1Gi". + :vartype ephemeral_storage: str + """ + + _validation = { + 'ephemeral_storage': {'readonly': True}, + } + + _attribute_map = { + 'cpu': {'key': 'cpu', 'type': 'float'}, + 'memory': {'key': 'memory', 'type': 'str'}, + 'ephemeral_storage': {'key': 'ephemeralStorage', 'type': 'str'}, + } + + def __init__( + self, + *, + cpu: Optional[float] = None, + memory: Optional[str] = None, + **kwargs + ): + """ + :keyword cpu: Required CPU in cores, e.g. 0.5. + :paramtype cpu: float + :keyword memory: Required memory, e.g. "250Mb". + :paramtype memory: str + """ + super(ContainerResources, self).__init__(**kwargs) + self.cpu = cpu + self.memory = memory + self.ephemeral_storage = None + + +class CookieExpiration(msrest.serialization.Model): + """The configuration settings of the session cookie's expiration. + + :ivar convention: The convention used when determining the session cookie's expiration. + Possible values include: "FixedTime", "IdentityProviderDerived". + :vartype convention: str or ~azure.mgmt.appcontainers.models.CookieExpirationConvention + :ivar time_to_expiration: The time after the request is made when the session cookie should + expire. + :vartype time_to_expiration: str + """ + + _attribute_map = { + 'convention': {'key': 'convention', 'type': 'str'}, + 'time_to_expiration': {'key': 'timeToExpiration', 'type': 'str'}, + } + + def __init__( + self, + *, + convention: Optional[Union[str, "CookieExpirationConvention"]] = None, + time_to_expiration: Optional[str] = None, + **kwargs + ): + """ + :keyword convention: The convention used when determining the session cookie's expiration. + Possible values include: "FixedTime", "IdentityProviderDerived". + :paramtype convention: str or ~azure.mgmt.appcontainers.models.CookieExpirationConvention + :keyword time_to_expiration: The time after the request is made when the session cookie should + expire. + :paramtype time_to_expiration: str + """ + super(CookieExpiration, self).__init__(**kwargs) + self.convention = convention + self.time_to_expiration = time_to_expiration + + +class CustomDomain(msrest.serialization.Model): + """Custom Domain of a Container App. + + All required parameters must be populated in order to send to Azure. + + :ivar name: Required. Hostname. + :vartype name: str + :ivar binding_type: Custom Domain binding type. Possible values include: "Disabled", + "SniEnabled". + :vartype binding_type: str or ~azure.mgmt.appcontainers.models.BindingType + :ivar certificate_id: Required. Resource Id of the Certificate to be bound to this hostname. + Must exist in the Managed Environment. + :vartype certificate_id: str + """ + + _validation = { + 'name': {'required': True}, + 'certificate_id': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'binding_type': {'key': 'bindingType', 'type': 'str'}, + 'certificate_id': {'key': 'certificateId', 'type': 'str'}, + } + + def __init__( + self, + *, + name: str, + certificate_id: str, + binding_type: Optional[Union[str, "BindingType"]] = None, + **kwargs + ): + """ + :keyword name: Required. Hostname. + :paramtype name: str + :keyword binding_type: Custom Domain binding type. Possible values include: "Disabled", + "SniEnabled". + :paramtype binding_type: str or ~azure.mgmt.appcontainers.models.BindingType + :keyword certificate_id: Required. Resource Id of the Certificate to be bound to this hostname. + Must exist in the Managed Environment. + :paramtype certificate_id: str + """ + super(CustomDomain, self).__init__(**kwargs) + self.name = name + self.binding_type = binding_type + self.certificate_id = certificate_id + + +class CustomHostnameAnalysisResult(ProxyResource): + """Custom domain analysis. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData + :ivar host_name: Host name that was analyzed. + :vartype host_name: str + :ivar is_hostname_already_verified: :code:`true` if hostname is already verified; + otherwise, :code:`false`. + :vartype is_hostname_already_verified: bool + :ivar custom_domain_verification_test: DNS verification test result. Possible values include: + "Passed", "Failed", "Skipped". + :vartype custom_domain_verification_test: str or + ~azure.mgmt.appcontainers.models.DnsVerificationTestResult + :ivar custom_domain_verification_failure_info: Raw failure information if DNS verification + fails. + :vartype custom_domain_verification_failure_info: + ~azure.mgmt.appcontainers.models.DefaultErrorResponse + :ivar has_conflict_on_managed_environment: :code:`true` if there is a conflict on + the Container App's managed environment; otherwise, :code:`false`. + :vartype has_conflict_on_managed_environment: bool + :ivar conflicting_container_app_resource_id: Name of the conflicting Container App on the + Managed Environment if it's within the same subscription. + :vartype conflicting_container_app_resource_id: str + :ivar c_name_records: CName records visible for this hostname. + :vartype c_name_records: list[str] + :ivar txt_records: TXT records visible for this hostname. + :vartype txt_records: list[str] + :ivar a_records: A records visible for this hostname. + :vartype a_records: list[str] + :ivar alternate_c_name_records: Alternate CName records visible for this hostname. + :vartype alternate_c_name_records: list[str] + :ivar alternate_txt_records: Alternate TXT records visible for this hostname. + :vartype alternate_txt_records: list[str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'host_name': {'readonly': True}, + 'is_hostname_already_verified': {'readonly': True}, + 'custom_domain_verification_test': {'readonly': True}, + 'custom_domain_verification_failure_info': {'readonly': True}, + 'has_conflict_on_managed_environment': {'readonly': True}, + 'conflicting_container_app_resource_id': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'host_name': {'key': 'properties.hostName', 'type': 'str'}, + 'is_hostname_already_verified': {'key': 'properties.isHostnameAlreadyVerified', 'type': 'bool'}, + 'custom_domain_verification_test': {'key': 'properties.customDomainVerificationTest', 'type': 'str'}, + 'custom_domain_verification_failure_info': {'key': 'properties.customDomainVerificationFailureInfo', 'type': 'DefaultErrorResponse'}, + 'has_conflict_on_managed_environment': {'key': 'properties.hasConflictOnManagedEnvironment', 'type': 'bool'}, + 'conflicting_container_app_resource_id': {'key': 'properties.conflictingContainerAppResourceId', 'type': 'str'}, + 'c_name_records': {'key': 'properties.cNameRecords', 'type': '[str]'}, + 'txt_records': {'key': 'properties.txtRecords', 'type': '[str]'}, + 'a_records': {'key': 'properties.aRecords', 'type': '[str]'}, + 'alternate_c_name_records': {'key': 'properties.alternateCNameRecords', 'type': '[str]'}, + 'alternate_txt_records': {'key': 'properties.alternateTxtRecords', 'type': '[str]'}, + } + + def __init__( + self, + *, + c_name_records: Optional[List[str]] = None, + txt_records: Optional[List[str]] = None, + a_records: Optional[List[str]] = None, + alternate_c_name_records: Optional[List[str]] = None, + alternate_txt_records: Optional[List[str]] = None, + **kwargs + ): + """ + :keyword c_name_records: CName records visible for this hostname. + :paramtype c_name_records: list[str] + :keyword txt_records: TXT records visible for this hostname. + :paramtype txt_records: list[str] + :keyword a_records: A records visible for this hostname. + :paramtype a_records: list[str] + :keyword alternate_c_name_records: Alternate CName records visible for this hostname. + :paramtype alternate_c_name_records: list[str] + :keyword alternate_txt_records: Alternate TXT records visible for this hostname. + :paramtype alternate_txt_records: list[str] + """ + super(CustomHostnameAnalysisResult, self).__init__(**kwargs) + self.host_name = None + self.is_hostname_already_verified = None + self.custom_domain_verification_test = None + self.custom_domain_verification_failure_info = None + self.has_conflict_on_managed_environment = None + self.conflicting_container_app_resource_id = None + self.c_name_records = c_name_records + self.txt_records = txt_records + self.a_records = a_records + self.alternate_c_name_records = alternate_c_name_records + self.alternate_txt_records = alternate_txt_records + + +class CustomOpenIdConnectProvider(msrest.serialization.Model): + """The configuration settings of the custom Open ID Connect provider. + + :ivar enabled: :code:`false` if the custom Open ID provider provider should not be + enabled; otherwise, :code:`true`. + :vartype enabled: bool + :ivar registration: The configuration settings of the app registration for the custom Open ID + Connect provider. + :vartype registration: ~azure.mgmt.appcontainers.models.OpenIdConnectRegistration + :ivar login: The configuration settings of the login flow of the custom Open ID Connect + provider. + :vartype login: ~azure.mgmt.appcontainers.models.OpenIdConnectLogin + """ + + _attribute_map = { + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'registration': {'key': 'registration', 'type': 'OpenIdConnectRegistration'}, + 'login': {'key': 'login', 'type': 'OpenIdConnectLogin'}, + } + + def __init__( + self, + *, + enabled: Optional[bool] = None, + registration: Optional["OpenIdConnectRegistration"] = None, + login: Optional["OpenIdConnectLogin"] = None, + **kwargs + ): + """ + :keyword enabled: :code:`false` if the custom Open ID provider provider should not + be enabled; otherwise, :code:`true`. + :paramtype enabled: bool + :keyword registration: The configuration settings of the app registration for the custom Open + ID Connect provider. + :paramtype registration: ~azure.mgmt.appcontainers.models.OpenIdConnectRegistration + :keyword login: The configuration settings of the login flow of the custom Open ID Connect + provider. + :paramtype login: ~azure.mgmt.appcontainers.models.OpenIdConnectLogin + """ + super(CustomOpenIdConnectProvider, self).__init__(**kwargs) + self.enabled = enabled + self.registration = registration + self.login = login + + +class CustomScaleRule(msrest.serialization.Model): + """Container App container Custom scaling rule. + + :ivar type: Type of the custom scale rule + eg: azure-servicebus, redis etc. + :vartype type: str + :ivar metadata: Metadata properties to describe custom scale rule. + :vartype metadata: dict[str, str] + :ivar auth: Authentication secrets for the custom scale rule. + :vartype auth: list[~azure.mgmt.appcontainers.models.ScaleRuleAuth] + """ + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'metadata': {'key': 'metadata', 'type': '{str}'}, + 'auth': {'key': 'auth', 'type': '[ScaleRuleAuth]'}, + } + + def __init__( + self, + *, + type: Optional[str] = None, + metadata: Optional[Dict[str, str]] = None, + auth: Optional[List["ScaleRuleAuth"]] = None, + **kwargs + ): + """ + :keyword type: Type of the custom scale rule + eg: azure-servicebus, redis etc. + :paramtype type: str + :keyword metadata: Metadata properties to describe custom scale rule. + :paramtype metadata: dict[str, str] + :keyword auth: Authentication secrets for the custom scale rule. + :paramtype auth: list[~azure.mgmt.appcontainers.models.ScaleRuleAuth] + """ + super(CustomScaleRule, self).__init__(**kwargs) + self.type = type + self.metadata = metadata + self.auth = auth + + +class Dapr(msrest.serialization.Model): + """Container App Dapr configuration. + + :ivar enabled: Boolean indicating if the Dapr side car is enabled. + :vartype enabled: bool + :ivar app_id: Dapr application identifier. + :vartype app_id: str + :ivar app_protocol: Tells Dapr which protocol your application is using. Valid options are http + and grpc. Default is http. Possible values include: "http", "grpc". + :vartype app_protocol: str or ~azure.mgmt.appcontainers.models.AppProtocol + :ivar app_port: Tells Dapr which port your application is listening on. + :vartype app_port: int + """ + + _attribute_map = { + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'app_id': {'key': 'appId', 'type': 'str'}, + 'app_protocol': {'key': 'appProtocol', 'type': 'str'}, + 'app_port': {'key': 'appPort', 'type': 'int'}, + } + + def __init__( + self, + *, + enabled: Optional[bool] = None, + app_id: Optional[str] = None, + app_protocol: Optional[Union[str, "AppProtocol"]] = None, + app_port: Optional[int] = None, + **kwargs + ): + """ + :keyword enabled: Boolean indicating if the Dapr side car is enabled. + :paramtype enabled: bool + :keyword app_id: Dapr application identifier. + :paramtype app_id: str + :keyword app_protocol: Tells Dapr which protocol your application is using. Valid options are + http and grpc. Default is http. Possible values include: "http", "grpc". + :paramtype app_protocol: str or ~azure.mgmt.appcontainers.models.AppProtocol + :keyword app_port: Tells Dapr which port your application is listening on. + :paramtype app_port: int + """ + super(Dapr, self).__init__(**kwargs) + self.enabled = enabled + self.app_id = app_id + self.app_protocol = app_protocol + self.app_port = app_port + + +class DaprComponent(ProxyResource): + """Dapr Component. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData + :ivar component_type: Component type. + :vartype component_type: str + :ivar version: Component version. + :vartype version: str + :ivar ignore_errors: Boolean describing if the component errors are ignores. + :vartype ignore_errors: bool + :ivar init_timeout: Initialization timeout. + :vartype init_timeout: str + :ivar secrets: Collection of secrets used by a Dapr component. + :vartype secrets: list[~azure.mgmt.appcontainers.models.Secret] + :ivar metadata: Component metadata. + :vartype metadata: list[~azure.mgmt.appcontainers.models.DaprMetadata] + :ivar scopes: Names of container apps that can use this Dapr component. + :vartype scopes: list[str] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'component_type': {'key': 'properties.componentType', 'type': 'str'}, + 'version': {'key': 'properties.version', 'type': 'str'}, + 'ignore_errors': {'key': 'properties.ignoreErrors', 'type': 'bool'}, + 'init_timeout': {'key': 'properties.initTimeout', 'type': 'str'}, + 'secrets': {'key': 'properties.secrets', 'type': '[Secret]'}, + 'metadata': {'key': 'properties.metadata', 'type': '[DaprMetadata]'}, + 'scopes': {'key': 'properties.scopes', 'type': '[str]'}, + } + + def __init__( + self, + *, + component_type: Optional[str] = None, + version: Optional[str] = None, + ignore_errors: Optional[bool] = None, + init_timeout: Optional[str] = None, + secrets: Optional[List["Secret"]] = None, + metadata: Optional[List["DaprMetadata"]] = None, + scopes: Optional[List[str]] = None, + **kwargs + ): + """ + :keyword component_type: Component type. + :paramtype component_type: str + :keyword version: Component version. + :paramtype version: str + :keyword ignore_errors: Boolean describing if the component errors are ignores. + :paramtype ignore_errors: bool + :keyword init_timeout: Initialization timeout. + :paramtype init_timeout: str + :keyword secrets: Collection of secrets used by a Dapr component. + :paramtype secrets: list[~azure.mgmt.appcontainers.models.Secret] + :keyword metadata: Component metadata. + :paramtype metadata: list[~azure.mgmt.appcontainers.models.DaprMetadata] + :keyword scopes: Names of container apps that can use this Dapr component. + :paramtype scopes: list[str] + """ + super(DaprComponent, self).__init__(**kwargs) + self.component_type = component_type + self.version = version + self.ignore_errors = ignore_errors + self.init_timeout = init_timeout + self.secrets = secrets + self.metadata = metadata + self.scopes = scopes + + +class DaprComponentsCollection(msrest.serialization.Model): + """Dapr Components ARM resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar value: Required. Collection of resources. + :vartype value: list[~azure.mgmt.appcontainers.models.DaprComponent] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[DaprComponent]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["DaprComponent"], + **kwargs + ): + """ + :keyword value: Required. Collection of resources. + :paramtype value: list[~azure.mgmt.appcontainers.models.DaprComponent] + """ + super(DaprComponentsCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class DaprMetadata(msrest.serialization.Model): + """Dapr component metadata. + + :ivar name: Metadata property name. + :vartype name: str + :ivar value: Metadata property value. + :vartype value: str + :ivar secret_ref: Name of the Dapr Component secret from which to pull the metadata property + value. + :vartype secret_ref: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, + 'secret_ref': {'key': 'secretRef', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + value: Optional[str] = None, + secret_ref: Optional[str] = None, + **kwargs + ): + """ + :keyword name: Metadata property name. + :paramtype name: str + :keyword value: Metadata property value. + :paramtype value: str + :keyword secret_ref: Name of the Dapr Component secret from which to pull the metadata property + value. + :paramtype secret_ref: str + """ + super(DaprMetadata, self).__init__(**kwargs) + self.name = name + self.value = value + self.secret_ref = secret_ref + + +class DaprSecretsCollection(msrest.serialization.Model): + """Dapr component Secrets Collection ARM resource. + + All required parameters must be populated in order to send to Azure. + + :ivar value: Required. Collection of secrets used by a Dapr component. + :vartype value: list[~azure.mgmt.appcontainers.models.Secret] + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Secret]'}, + } + + def __init__( + self, + *, + value: List["Secret"], + **kwargs + ): + """ + :keyword value: Required. Collection of secrets used by a Dapr component. + :paramtype value: list[~azure.mgmt.appcontainers.models.Secret] + """ + super(DaprSecretsCollection, self).__init__(**kwargs) + self.value = value + + +class DefaultAuthorizationPolicy(msrest.serialization.Model): + """The configuration settings of the Azure Active Directory default authorization policy. + + :ivar allowed_principals: The configuration settings of the Azure Active Directory allowed + principals. + :vartype allowed_principals: ~azure.mgmt.appcontainers.models.AllowedPrincipals + :ivar allowed_applications: The configuration settings of the Azure Active Directory allowed + applications. + :vartype allowed_applications: list[str] + """ + + _attribute_map = { + 'allowed_principals': {'key': 'allowedPrincipals', 'type': 'AllowedPrincipals'}, + 'allowed_applications': {'key': 'allowedApplications', 'type': '[str]'}, + } + + def __init__( + self, + *, + allowed_principals: Optional["AllowedPrincipals"] = None, + allowed_applications: Optional[List[str]] = None, + **kwargs + ): + """ + :keyword allowed_principals: The configuration settings of the Azure Active Directory allowed + principals. + :paramtype allowed_principals: ~azure.mgmt.appcontainers.models.AllowedPrincipals + :keyword allowed_applications: The configuration settings of the Azure Active Directory allowed + applications. + :paramtype allowed_applications: list[str] + """ + super(DefaultAuthorizationPolicy, self).__init__(**kwargs) + self.allowed_principals = allowed_principals + self.allowed_applications = allowed_applications + + +class DefaultErrorResponse(msrest.serialization.Model): + """App Service error response. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar error: Error model. + :vartype error: ~azure.mgmt.appcontainers.models.DefaultErrorResponseError + """ + + _validation = { + 'error': {'readonly': True}, + } + + _attribute_map = { + 'error': {'key': 'error', 'type': 'DefaultErrorResponseError'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(DefaultErrorResponse, self).__init__(**kwargs) + self.error = None + + +class DefaultErrorResponseError(msrest.serialization.Model): + """Error model. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: Standardized string to programmatically identify the error. + :vartype code: str + :ivar message: Detailed error description and debugging information. + :vartype message: str + :ivar target: Detailed error description and debugging information. + :vartype target: str + :ivar details: Details or the error. + :vartype details: list[~azure.mgmt.appcontainers.models.DefaultErrorResponseErrorDetailsItem] + :ivar innererror: More information to debug error. + :vartype innererror: str + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + 'innererror': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + 'details': {'key': 'details', 'type': '[DefaultErrorResponseErrorDetailsItem]'}, + 'innererror': {'key': 'innererror', 'type': 'str'}, + } + + def __init__( + self, + *, + details: Optional[List["DefaultErrorResponseErrorDetailsItem"]] = None, + **kwargs + ): + """ + :keyword details: Details or the error. + :paramtype details: list[~azure.mgmt.appcontainers.models.DefaultErrorResponseErrorDetailsItem] + """ + super(DefaultErrorResponseError, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + self.details = details + self.innererror = None + + +class DefaultErrorResponseErrorDetailsItem(msrest.serialization.Model): + """Detailed errors. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar code: Standardized string to programmatically identify the error. + :vartype code: str + :ivar message: Detailed error description and debugging information. + :vartype message: str + :ivar target: Detailed error description and debugging information. + :vartype target: str + """ + + _validation = { + 'code': {'readonly': True}, + 'message': {'readonly': True}, + 'target': {'readonly': True}, + } + + _attribute_map = { + 'code': {'key': 'code', 'type': 'str'}, + 'message': {'key': 'message', 'type': 'str'}, + 'target': {'key': 'target', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(DefaultErrorResponseErrorDetailsItem, self).__init__(**kwargs) + self.code = None + self.message = None + self.target = None + + +class EnvironmentVar(msrest.serialization.Model): + """Container App container environment variable. + + :ivar name: Environment variable name. + :vartype name: str + :ivar value: Non-secret environment variable value. + :vartype value: str + :ivar secret_ref: Name of the Container App secret from which to pull the environment variable + value. + :vartype secret_ref: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, + 'secret_ref': {'key': 'secretRef', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + value: Optional[str] = None, + secret_ref: Optional[str] = None, + **kwargs + ): + """ + :keyword name: Environment variable name. + :paramtype name: str + :keyword value: Non-secret environment variable value. + :paramtype value: str + :keyword secret_ref: Name of the Container App secret from which to pull the environment + variable value. + :paramtype secret_ref: str + """ + super(EnvironmentVar, self).__init__(**kwargs) + self.name = name + self.value = value + self.secret_ref = secret_ref + + +class Facebook(msrest.serialization.Model): + """The configuration settings of the Facebook provider. + + :ivar enabled: :code:`false` if the Facebook provider should not be enabled + despite the set registration; otherwise, :code:`true`. + :vartype enabled: bool + :ivar registration: The configuration settings of the app registration for the Facebook + provider. + :vartype registration: ~azure.mgmt.appcontainers.models.AppRegistration + :ivar graph_api_version: The version of the Facebook api to be used while logging in. + :vartype graph_api_version: str + :ivar login: The configuration settings of the login flow. + :vartype login: ~azure.mgmt.appcontainers.models.LoginScopes + """ + + _attribute_map = { + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'registration': {'key': 'registration', 'type': 'AppRegistration'}, + 'graph_api_version': {'key': 'graphApiVersion', 'type': 'str'}, + 'login': {'key': 'login', 'type': 'LoginScopes'}, + } + + def __init__( + self, + *, + enabled: Optional[bool] = None, + registration: Optional["AppRegistration"] = None, + graph_api_version: Optional[str] = None, + login: Optional["LoginScopes"] = None, + **kwargs + ): + """ + :keyword enabled: :code:`false` if the Facebook provider should not be enabled + despite the set registration; otherwise, :code:`true`. + :paramtype enabled: bool + :keyword registration: The configuration settings of the app registration for the Facebook + provider. + :paramtype registration: ~azure.mgmt.appcontainers.models.AppRegistration + :keyword graph_api_version: The version of the Facebook api to be used while logging in. + :paramtype graph_api_version: str + :keyword login: The configuration settings of the login flow. + :paramtype login: ~azure.mgmt.appcontainers.models.LoginScopes + """ + super(Facebook, self).__init__(**kwargs) + self.enabled = enabled + self.registration = registration + self.graph_api_version = graph_api_version + self.login = login + + +class ForwardProxy(msrest.serialization.Model): + """The configuration settings of a forward proxy used to make the requests. + + :ivar convention: The convention used to determine the url of the request made. Possible values + include: "NoProxy", "Standard", "Custom". + :vartype convention: str or ~azure.mgmt.appcontainers.models.ForwardProxyConvention + :ivar custom_host_header_name: The name of the header containing the host of the request. + :vartype custom_host_header_name: str + :ivar custom_proto_header_name: The name of the header containing the scheme of the request. + :vartype custom_proto_header_name: str + """ + + _attribute_map = { + 'convention': {'key': 'convention', 'type': 'str'}, + 'custom_host_header_name': {'key': 'customHostHeaderName', 'type': 'str'}, + 'custom_proto_header_name': {'key': 'customProtoHeaderName', 'type': 'str'}, + } + + def __init__( + self, + *, + convention: Optional[Union[str, "ForwardProxyConvention"]] = None, + custom_host_header_name: Optional[str] = None, + custom_proto_header_name: Optional[str] = None, + **kwargs + ): + """ + :keyword convention: The convention used to determine the url of the request made. Possible + values include: "NoProxy", "Standard", "Custom". + :paramtype convention: str or ~azure.mgmt.appcontainers.models.ForwardProxyConvention + :keyword custom_host_header_name: The name of the header containing the host of the request. + :paramtype custom_host_header_name: str + :keyword custom_proto_header_name: The name of the header containing the scheme of the request. + :paramtype custom_proto_header_name: str + """ + super(ForwardProxy, self).__init__(**kwargs) + self.convention = convention + self.custom_host_header_name = custom_host_header_name + self.custom_proto_header_name = custom_proto_header_name + + +class GitHub(msrest.serialization.Model): + """The configuration settings of the GitHub provider. + + :ivar enabled: :code:`false` if the GitHub provider should not be enabled despite + the set registration; otherwise, :code:`true`. + :vartype enabled: bool + :ivar registration: The configuration settings of the app registration for the GitHub provider. + :vartype registration: ~azure.mgmt.appcontainers.models.ClientRegistration + :ivar login: The configuration settings of the login flow. + :vartype login: ~azure.mgmt.appcontainers.models.LoginScopes + """ + + _attribute_map = { + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'registration': {'key': 'registration', 'type': 'ClientRegistration'}, + 'login': {'key': 'login', 'type': 'LoginScopes'}, + } + + def __init__( + self, + *, + enabled: Optional[bool] = None, + registration: Optional["ClientRegistration"] = None, + login: Optional["LoginScopes"] = None, + **kwargs + ): + """ + :keyword enabled: :code:`false` if the GitHub provider should not be enabled + despite the set registration; otherwise, :code:`true`. + :paramtype enabled: bool + :keyword registration: The configuration settings of the app registration for the GitHub + provider. + :paramtype registration: ~azure.mgmt.appcontainers.models.ClientRegistration + :keyword login: The configuration settings of the login flow. + :paramtype login: ~azure.mgmt.appcontainers.models.LoginScopes + """ + super(GitHub, self).__init__(**kwargs) + self.enabled = enabled + self.registration = registration + self.login = login + + +class GithubActionConfiguration(msrest.serialization.Model): + """Configuration properties that define the mutable settings of a Container App SourceControl. + + :ivar registry_info: Registry configurations. + :vartype registry_info: ~azure.mgmt.appcontainers.models.RegistryInfo + :ivar azure_credentials: AzureCredentials configurations. + :vartype azure_credentials: ~azure.mgmt.appcontainers.models.AzureCredentials + :ivar context_path: Context path. + :vartype context_path: str + :ivar image: Image name. + :vartype image: str + :ivar publish_type: Code or Image. + :vartype publish_type: str + :ivar os: Operation system. + :vartype os: str + :ivar runtime_stack: Runtime stack. + :vartype runtime_stack: str + :ivar runtime_version: Runtime version. + :vartype runtime_version: str + """ + + _attribute_map = { + 'registry_info': {'key': 'registryInfo', 'type': 'RegistryInfo'}, + 'azure_credentials': {'key': 'azureCredentials', 'type': 'AzureCredentials'}, + 'context_path': {'key': 'contextPath', 'type': 'str'}, + 'image': {'key': 'image', 'type': 'str'}, + 'publish_type': {'key': 'publishType', 'type': 'str'}, + 'os': {'key': 'os', 'type': 'str'}, + 'runtime_stack': {'key': 'runtimeStack', 'type': 'str'}, + 'runtime_version': {'key': 'runtimeVersion', 'type': 'str'}, + } + + def __init__( + self, + *, + registry_info: Optional["RegistryInfo"] = None, + azure_credentials: Optional["AzureCredentials"] = None, + context_path: Optional[str] = None, + image: Optional[str] = None, + publish_type: Optional[str] = None, + os: Optional[str] = None, + runtime_stack: Optional[str] = None, + runtime_version: Optional[str] = None, + **kwargs + ): + """ + :keyword registry_info: Registry configurations. + :paramtype registry_info: ~azure.mgmt.appcontainers.models.RegistryInfo + :keyword azure_credentials: AzureCredentials configurations. + :paramtype azure_credentials: ~azure.mgmt.appcontainers.models.AzureCredentials + :keyword context_path: Context path. + :paramtype context_path: str + :keyword image: Image name. + :paramtype image: str + :keyword publish_type: Code or Image. + :paramtype publish_type: str + :keyword os: Operation system. + :paramtype os: str + :keyword runtime_stack: Runtime stack. + :paramtype runtime_stack: str + :keyword runtime_version: Runtime version. + :paramtype runtime_version: str + """ + super(GithubActionConfiguration, self).__init__(**kwargs) + self.registry_info = registry_info + self.azure_credentials = azure_credentials + self.context_path = context_path + self.image = image + self.publish_type = publish_type + self.os = os + self.runtime_stack = runtime_stack + self.runtime_version = runtime_version + + +class GlobalValidation(msrest.serialization.Model): + """The configuration settings that determines the validation flow of users using ContainerApp Service Authentication/Authorization. + + :ivar unauthenticated_client_action: The action to take when an unauthenticated client attempts + to access the app. Possible values include: "RedirectToLoginPage", "AllowAnonymous", + "Return401", "Return403". + :vartype unauthenticated_client_action: str or + ~azure.mgmt.appcontainers.models.UnauthenticatedClientActionV2 + :ivar redirect_to_provider: The default authentication provider to use when multiple providers + are configured. + This setting is only needed if multiple providers are configured and the unauthenticated + client + action is set to "RedirectToLoginPage". + :vartype redirect_to_provider: str + :ivar excluded_paths: The paths for which unauthenticated flow would not be redirected to the + login page. + :vartype excluded_paths: list[str] + """ + + _attribute_map = { + 'unauthenticated_client_action': {'key': 'unauthenticatedClientAction', 'type': 'str'}, + 'redirect_to_provider': {'key': 'redirectToProvider', 'type': 'str'}, + 'excluded_paths': {'key': 'excludedPaths', 'type': '[str]'}, + } + + def __init__( + self, + *, + unauthenticated_client_action: Optional[Union[str, "UnauthenticatedClientActionV2"]] = None, + redirect_to_provider: Optional[str] = None, + excluded_paths: Optional[List[str]] = None, + **kwargs + ): + """ + :keyword unauthenticated_client_action: The action to take when an unauthenticated client + attempts to access the app. Possible values include: "RedirectToLoginPage", "AllowAnonymous", + "Return401", "Return403". + :paramtype unauthenticated_client_action: str or + ~azure.mgmt.appcontainers.models.UnauthenticatedClientActionV2 + :keyword redirect_to_provider: The default authentication provider to use when multiple + providers are configured. + This setting is only needed if multiple providers are configured and the unauthenticated + client + action is set to "RedirectToLoginPage". + :paramtype redirect_to_provider: str + :keyword excluded_paths: The paths for which unauthenticated flow would not be redirected to + the login page. + :paramtype excluded_paths: list[str] + """ + super(GlobalValidation, self).__init__(**kwargs) + self.unauthenticated_client_action = unauthenticated_client_action + self.redirect_to_provider = redirect_to_provider + self.excluded_paths = excluded_paths + + +class Google(msrest.serialization.Model): + """The configuration settings of the Google provider. + + :ivar enabled: :code:`false` if the Google provider should not be enabled despite + the set registration; otherwise, :code:`true`. + :vartype enabled: bool + :ivar registration: The configuration settings of the app registration for the Google provider. + :vartype registration: ~azure.mgmt.appcontainers.models.ClientRegistration + :ivar login: The configuration settings of the login flow. + :vartype login: ~azure.mgmt.appcontainers.models.LoginScopes + :ivar validation: The configuration settings of the Azure Active Directory token validation + flow. + :vartype validation: ~azure.mgmt.appcontainers.models.AllowedAudiencesValidation + """ + + _attribute_map = { + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'registration': {'key': 'registration', 'type': 'ClientRegistration'}, + 'login': {'key': 'login', 'type': 'LoginScopes'}, + 'validation': {'key': 'validation', 'type': 'AllowedAudiencesValidation'}, + } + + def __init__( + self, + *, + enabled: Optional[bool] = None, + registration: Optional["ClientRegistration"] = None, + login: Optional["LoginScopes"] = None, + validation: Optional["AllowedAudiencesValidation"] = None, + **kwargs + ): + """ + :keyword enabled: :code:`false` if the Google provider should not be enabled + despite the set registration; otherwise, :code:`true`. + :paramtype enabled: bool + :keyword registration: The configuration settings of the app registration for the Google + provider. + :paramtype registration: ~azure.mgmt.appcontainers.models.ClientRegistration + :keyword login: The configuration settings of the login flow. + :paramtype login: ~azure.mgmt.appcontainers.models.LoginScopes + :keyword validation: The configuration settings of the Azure Active Directory token validation + flow. + :paramtype validation: ~azure.mgmt.appcontainers.models.AllowedAudiencesValidation + """ + super(Google, self).__init__(**kwargs) + self.enabled = enabled + self.registration = registration + self.login = login + self.validation = validation + + +class HttpScaleRule(msrest.serialization.Model): + """Container App container Custom scaling rule. + + :ivar metadata: Metadata properties to describe http scale rule. + :vartype metadata: dict[str, str] + :ivar auth: Authentication secrets for the custom scale rule. + :vartype auth: list[~azure.mgmt.appcontainers.models.ScaleRuleAuth] + """ + + _attribute_map = { + 'metadata': {'key': 'metadata', 'type': '{str}'}, + 'auth': {'key': 'auth', 'type': '[ScaleRuleAuth]'}, + } + + def __init__( + self, + *, + metadata: Optional[Dict[str, str]] = None, + auth: Optional[List["ScaleRuleAuth"]] = None, + **kwargs + ): + """ + :keyword metadata: Metadata properties to describe http scale rule. + :paramtype metadata: dict[str, str] + :keyword auth: Authentication secrets for the custom scale rule. + :paramtype auth: list[~azure.mgmt.appcontainers.models.ScaleRuleAuth] + """ + super(HttpScaleRule, self).__init__(**kwargs) + self.metadata = metadata + self.auth = auth + + +class HttpSettings(msrest.serialization.Model): + """The configuration settings of the HTTP requests for authentication and authorization requests made against ContainerApp Service Authentication/Authorization. + + :ivar require_https: :code:`false` if the authentication/authorization responses + not having the HTTPS scheme are permissible; otherwise, :code:`true`. + :vartype require_https: bool + :ivar routes: The configuration settings of the paths HTTP requests. + :vartype routes: ~azure.mgmt.appcontainers.models.HttpSettingsRoutes + :ivar forward_proxy: The configuration settings of a forward proxy used to make the requests. + :vartype forward_proxy: ~azure.mgmt.appcontainers.models.ForwardProxy + """ + + _attribute_map = { + 'require_https': {'key': 'requireHttps', 'type': 'bool'}, + 'routes': {'key': 'routes', 'type': 'HttpSettingsRoutes'}, + 'forward_proxy': {'key': 'forwardProxy', 'type': 'ForwardProxy'}, + } + + def __init__( + self, + *, + require_https: Optional[bool] = None, + routes: Optional["HttpSettingsRoutes"] = None, + forward_proxy: Optional["ForwardProxy"] = None, + **kwargs + ): + """ + :keyword require_https: :code:`false` if the authentication/authorization + responses not having the HTTPS scheme are permissible; otherwise, :code:`true`. + :paramtype require_https: bool + :keyword routes: The configuration settings of the paths HTTP requests. + :paramtype routes: ~azure.mgmt.appcontainers.models.HttpSettingsRoutes + :keyword forward_proxy: The configuration settings of a forward proxy used to make the + requests. + :paramtype forward_proxy: ~azure.mgmt.appcontainers.models.ForwardProxy + """ + super(HttpSettings, self).__init__(**kwargs) + self.require_https = require_https + self.routes = routes + self.forward_proxy = forward_proxy + + +class HttpSettingsRoutes(msrest.serialization.Model): + """The configuration settings of the paths HTTP requests. + + :ivar api_prefix: The prefix that should precede all the authentication/authorization paths. + :vartype api_prefix: str + """ + + _attribute_map = { + 'api_prefix': {'key': 'apiPrefix', 'type': 'str'}, + } + + def __init__( + self, + *, + api_prefix: Optional[str] = None, + **kwargs + ): + """ + :keyword api_prefix: The prefix that should precede all the authentication/authorization paths. + :paramtype api_prefix: str + """ + super(HttpSettingsRoutes, self).__init__(**kwargs) + self.api_prefix = api_prefix + + +class IdentityProviders(msrest.serialization.Model): + """The configuration settings of each of the identity providers used to configure ContainerApp Service Authentication/Authorization. + + :ivar azure_active_directory: The configuration settings of the Azure Active directory + provider. + :vartype azure_active_directory: ~azure.mgmt.appcontainers.models.AzureActiveDirectory + :ivar facebook: The configuration settings of the Facebook provider. + :vartype facebook: ~azure.mgmt.appcontainers.models.Facebook + :ivar git_hub: The configuration settings of the GitHub provider. + :vartype git_hub: ~azure.mgmt.appcontainers.models.GitHub + :ivar google: The configuration settings of the Google provider. + :vartype google: ~azure.mgmt.appcontainers.models.Google + :ivar twitter: The configuration settings of the Twitter provider. + :vartype twitter: ~azure.mgmt.appcontainers.models.Twitter + :ivar apple: The configuration settings of the Apple provider. + :vartype apple: ~azure.mgmt.appcontainers.models.Apple + :ivar azure_static_web_apps: The configuration settings of the Azure Static Web Apps provider. + :vartype azure_static_web_apps: ~azure.mgmt.appcontainers.models.AzureStaticWebApps + :ivar custom_open_id_connect_providers: The map of the name of the alias of each custom Open ID + Connect provider to the + configuration settings of the custom Open ID Connect provider. + :vartype custom_open_id_connect_providers: dict[str, + ~azure.mgmt.appcontainers.models.CustomOpenIdConnectProvider] + """ + + _attribute_map = { + 'azure_active_directory': {'key': 'azureActiveDirectory', 'type': 'AzureActiveDirectory'}, + 'facebook': {'key': 'facebook', 'type': 'Facebook'}, + 'git_hub': {'key': 'gitHub', 'type': 'GitHub'}, + 'google': {'key': 'google', 'type': 'Google'}, + 'twitter': {'key': 'twitter', 'type': 'Twitter'}, + 'apple': {'key': 'apple', 'type': 'Apple'}, + 'azure_static_web_apps': {'key': 'azureStaticWebApps', 'type': 'AzureStaticWebApps'}, + 'custom_open_id_connect_providers': {'key': 'customOpenIdConnectProviders', 'type': '{CustomOpenIdConnectProvider}'}, + } + + def __init__( + self, + *, + azure_active_directory: Optional["AzureActiveDirectory"] = None, + facebook: Optional["Facebook"] = None, + git_hub: Optional["GitHub"] = None, + google: Optional["Google"] = None, + twitter: Optional["Twitter"] = None, + apple: Optional["Apple"] = None, + azure_static_web_apps: Optional["AzureStaticWebApps"] = None, + custom_open_id_connect_providers: Optional[Dict[str, "CustomOpenIdConnectProvider"]] = None, + **kwargs + ): + """ + :keyword azure_active_directory: The configuration settings of the Azure Active directory + provider. + :paramtype azure_active_directory: ~azure.mgmt.appcontainers.models.AzureActiveDirectory + :keyword facebook: The configuration settings of the Facebook provider. + :paramtype facebook: ~azure.mgmt.appcontainers.models.Facebook + :keyword git_hub: The configuration settings of the GitHub provider. + :paramtype git_hub: ~azure.mgmt.appcontainers.models.GitHub + :keyword google: The configuration settings of the Google provider. + :paramtype google: ~azure.mgmt.appcontainers.models.Google + :keyword twitter: The configuration settings of the Twitter provider. + :paramtype twitter: ~azure.mgmt.appcontainers.models.Twitter + :keyword apple: The configuration settings of the Apple provider. + :paramtype apple: ~azure.mgmt.appcontainers.models.Apple + :keyword azure_static_web_apps: The configuration settings of the Azure Static Web Apps + provider. + :paramtype azure_static_web_apps: ~azure.mgmt.appcontainers.models.AzureStaticWebApps + :keyword custom_open_id_connect_providers: The map of the name of the alias of each custom Open + ID Connect provider to the + configuration settings of the custom Open ID Connect provider. + :paramtype custom_open_id_connect_providers: dict[str, + ~azure.mgmt.appcontainers.models.CustomOpenIdConnectProvider] + """ + super(IdentityProviders, self).__init__(**kwargs) + self.azure_active_directory = azure_active_directory + self.facebook = facebook + self.git_hub = git_hub + self.google = google + self.twitter = twitter + self.apple = apple + self.azure_static_web_apps = azure_static_web_apps + self.custom_open_id_connect_providers = custom_open_id_connect_providers + + +class Ingress(msrest.serialization.Model): + """Container App Ingress configuration. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar fqdn: Hostname. + :vartype fqdn: str + :ivar external: Bool indicating if app exposes an external http endpoint. + :vartype external: bool + :ivar target_port: Target Port in containers for traffic from ingress. + :vartype target_port: int + :ivar transport: Ingress transport protocol. Possible values include: "auto", "http", "http2". + :vartype transport: str or ~azure.mgmt.appcontainers.models.IngressTransportMethod + :ivar traffic: Traffic weights for app's revisions. + :vartype traffic: list[~azure.mgmt.appcontainers.models.TrafficWeight] + :ivar custom_domains: custom domain bindings for Container Apps' hostnames. + :vartype custom_domains: list[~azure.mgmt.appcontainers.models.CustomDomain] + :ivar allow_insecure: Bool indicating if HTTP connections to is allowed. If set to false HTTP + connections are automatically redirected to HTTPS connections. + :vartype allow_insecure: bool + """ + + _validation = { + 'fqdn': {'readonly': True}, + } + + _attribute_map = { + 'fqdn': {'key': 'fqdn', 'type': 'str'}, + 'external': {'key': 'external', 'type': 'bool'}, + 'target_port': {'key': 'targetPort', 'type': 'int'}, + 'transport': {'key': 'transport', 'type': 'str'}, + 'traffic': {'key': 'traffic', 'type': '[TrafficWeight]'}, + 'custom_domains': {'key': 'customDomains', 'type': '[CustomDomain]'}, + 'allow_insecure': {'key': 'allowInsecure', 'type': 'bool'}, + } + + def __init__( + self, + *, + external: Optional[bool] = False, + target_port: Optional[int] = None, + transport: Optional[Union[str, "IngressTransportMethod"]] = None, + traffic: Optional[List["TrafficWeight"]] = None, + custom_domains: Optional[List["CustomDomain"]] = None, + allow_insecure: Optional[bool] = None, + **kwargs + ): + """ + :keyword external: Bool indicating if app exposes an external http endpoint. + :paramtype external: bool + :keyword target_port: Target Port in containers for traffic from ingress. + :paramtype target_port: int + :keyword transport: Ingress transport protocol. Possible values include: "auto", "http", + "http2". + :paramtype transport: str or ~azure.mgmt.appcontainers.models.IngressTransportMethod + :keyword traffic: Traffic weights for app's revisions. + :paramtype traffic: list[~azure.mgmt.appcontainers.models.TrafficWeight] + :keyword custom_domains: custom domain bindings for Container Apps' hostnames. + :paramtype custom_domains: list[~azure.mgmt.appcontainers.models.CustomDomain] + :keyword allow_insecure: Bool indicating if HTTP connections to is allowed. If set to false + HTTP connections are automatically redirected to HTTPS connections. + :paramtype allow_insecure: bool + """ + super(Ingress, self).__init__(**kwargs) + self.fqdn = None + self.external = external + self.target_port = target_port + self.transport = transport + self.traffic = traffic + self.custom_domains = custom_domains + self.allow_insecure = allow_insecure + + +class JwtClaimChecks(msrest.serialization.Model): + """The configuration settings of the checks that should be made while validating the JWT Claims. + + :ivar allowed_groups: The list of the allowed groups. + :vartype allowed_groups: list[str] + :ivar allowed_client_applications: The list of the allowed client applications. + :vartype allowed_client_applications: list[str] + """ + + _attribute_map = { + 'allowed_groups': {'key': 'allowedGroups', 'type': '[str]'}, + 'allowed_client_applications': {'key': 'allowedClientApplications', 'type': '[str]'}, + } + + def __init__( + self, + *, + allowed_groups: Optional[List[str]] = None, + allowed_client_applications: Optional[List[str]] = None, + **kwargs + ): + """ + :keyword allowed_groups: The list of the allowed groups. + :paramtype allowed_groups: list[str] + :keyword allowed_client_applications: The list of the allowed client applications. + :paramtype allowed_client_applications: list[str] + """ + super(JwtClaimChecks, self).__init__(**kwargs) + self.allowed_groups = allowed_groups + self.allowed_client_applications = allowed_client_applications + + +class LogAnalyticsConfiguration(msrest.serialization.Model): + """Log analytics configuration. + + :ivar customer_id: Log analytics customer id. + :vartype customer_id: str + :ivar shared_key: Log analytics customer key. + :vartype shared_key: str + """ + + _attribute_map = { + 'customer_id': {'key': 'customerId', 'type': 'str'}, + 'shared_key': {'key': 'sharedKey', 'type': 'str'}, + } + + def __init__( + self, + *, + customer_id: Optional[str] = None, + shared_key: Optional[str] = None, + **kwargs + ): + """ + :keyword customer_id: Log analytics customer id. + :paramtype customer_id: str + :keyword shared_key: Log analytics customer key. + :paramtype shared_key: str + """ + super(LogAnalyticsConfiguration, self).__init__(**kwargs) + self.customer_id = customer_id + self.shared_key = shared_key + + +class Login(msrest.serialization.Model): + """The configuration settings of the login flow of users using ContainerApp Service Authentication/Authorization. + + :ivar routes: The routes that specify the endpoints used for login and logout requests. + :vartype routes: ~azure.mgmt.appcontainers.models.LoginRoutes + :ivar preserve_url_fragments_for_logins: :code:`true` if the fragments from the + request are preserved after the login request is made; otherwise, :code:`false`. + :vartype preserve_url_fragments_for_logins: bool + :ivar allowed_external_redirect_urls: External URLs that can be redirected to as part of + logging in or logging out of the app. Note that the query string part of the URL is ignored. + This is an advanced setting typically only needed by Windows Store application backends. + Note that URLs within the current domain are always implicitly allowed. + :vartype allowed_external_redirect_urls: list[str] + :ivar cookie_expiration: The configuration settings of the session cookie's expiration. + :vartype cookie_expiration: ~azure.mgmt.appcontainers.models.CookieExpiration + :ivar nonce: The configuration settings of the nonce used in the login flow. + :vartype nonce: ~azure.mgmt.appcontainers.models.Nonce + """ + + _attribute_map = { + 'routes': {'key': 'routes', 'type': 'LoginRoutes'}, + 'preserve_url_fragments_for_logins': {'key': 'preserveUrlFragmentsForLogins', 'type': 'bool'}, + 'allowed_external_redirect_urls': {'key': 'allowedExternalRedirectUrls', 'type': '[str]'}, + 'cookie_expiration': {'key': 'cookieExpiration', 'type': 'CookieExpiration'}, + 'nonce': {'key': 'nonce', 'type': 'Nonce'}, + } + + def __init__( + self, + *, + routes: Optional["LoginRoutes"] = None, + preserve_url_fragments_for_logins: Optional[bool] = None, + allowed_external_redirect_urls: Optional[List[str]] = None, + cookie_expiration: Optional["CookieExpiration"] = None, + nonce: Optional["Nonce"] = None, + **kwargs + ): + """ + :keyword routes: The routes that specify the endpoints used for login and logout requests. + :paramtype routes: ~azure.mgmt.appcontainers.models.LoginRoutes + :keyword preserve_url_fragments_for_logins: :code:`true` if the fragments from the + request are preserved after the login request is made; otherwise, :code:`false`. + :paramtype preserve_url_fragments_for_logins: bool + :keyword allowed_external_redirect_urls: External URLs that can be redirected to as part of + logging in or logging out of the app. Note that the query string part of the URL is ignored. + This is an advanced setting typically only needed by Windows Store application backends. + Note that URLs within the current domain are always implicitly allowed. + :paramtype allowed_external_redirect_urls: list[str] + :keyword cookie_expiration: The configuration settings of the session cookie's expiration. + :paramtype cookie_expiration: ~azure.mgmt.appcontainers.models.CookieExpiration + :keyword nonce: The configuration settings of the nonce used in the login flow. + :paramtype nonce: ~azure.mgmt.appcontainers.models.Nonce + """ + super(Login, self).__init__(**kwargs) + self.routes = routes + self.preserve_url_fragments_for_logins = preserve_url_fragments_for_logins + self.allowed_external_redirect_urls = allowed_external_redirect_urls + self.cookie_expiration = cookie_expiration + self.nonce = nonce + + +class LoginRoutes(msrest.serialization.Model): + """The routes that specify the endpoints used for login and logout requests. + + :ivar logout_endpoint: The endpoint at which a logout request should be made. + :vartype logout_endpoint: str + """ + + _attribute_map = { + 'logout_endpoint': {'key': 'logoutEndpoint', 'type': 'str'}, + } + + def __init__( + self, + *, + logout_endpoint: Optional[str] = None, + **kwargs + ): + """ + :keyword logout_endpoint: The endpoint at which a logout request should be made. + :paramtype logout_endpoint: str + """ + super(LoginRoutes, self).__init__(**kwargs) + self.logout_endpoint = logout_endpoint + + +class LoginScopes(msrest.serialization.Model): + """The configuration settings of the login flow, including the scopes that should be requested. + + :ivar scopes: A list of the scopes that should be requested while authenticating. + :vartype scopes: list[str] + """ + + _attribute_map = { + 'scopes': {'key': 'scopes', 'type': '[str]'}, + } + + def __init__( + self, + *, + scopes: Optional[List[str]] = None, + **kwargs + ): + """ + :keyword scopes: A list of the scopes that should be requested while authenticating. + :paramtype scopes: list[str] + """ + super(LoginScopes, self).__init__(**kwargs) + self.scopes = scopes + + +class ManagedEnvironment(TrackedResource): + """An environment for hosting container apps. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str + :ivar provisioning_state: Provisioning state of the Environment. Possible values include: + "Succeeded", "Failed", "Canceled", "Waiting", "InitializationInProgress", + "InfrastructureSetupInProgress", "InfrastructureSetupComplete", "ScheduledForDelete", + "UpgradeRequested", "UpgradeFailed". + :vartype provisioning_state: str or + ~azure.mgmt.appcontainers.models.EnvironmentProvisioningState + :ivar dapr_ai_instrumentation_key: Azure Monitor instrumentation key used by Dapr to export + Service to Service communication telemetry. + :vartype dapr_ai_instrumentation_key: str + :ivar dapr_ai_connection_string: Application Insights connection string used by Dapr to export + Service to Service communication telemetry. + :vartype dapr_ai_connection_string: str + :ivar vnet_configuration: Vnet configuration for the environment. + :vartype vnet_configuration: ~azure.mgmt.appcontainers.models.VnetConfiguration + :ivar deployment_errors: Any errors that occurred during deployment or deployment validation. + :vartype deployment_errors: str + :ivar default_domain: Default Domain Name for the cluster. + :vartype default_domain: str + :ivar static_ip: Static IP of the Environment. + :vartype static_ip: str + :ivar app_logs_configuration: Cluster configuration which enables the log daemon to export + app logs to a destination. Currently only "log-analytics" is + supported. + :vartype app_logs_configuration: ~azure.mgmt.appcontainers.models.AppLogsConfiguration + :ivar zone_redundant: Whether or not this Managed Environment is zone-redundant. + :vartype zone_redundant: bool + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'location': {'required': True}, + 'provisioning_state': {'readonly': True}, + 'deployment_errors': {'readonly': True}, + 'default_domain': {'readonly': True}, + 'static_ip': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'location': {'key': 'location', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'dapr_ai_instrumentation_key': {'key': 'properties.daprAIInstrumentationKey', 'type': 'str'}, + 'dapr_ai_connection_string': {'key': 'properties.daprAIConnectionString', 'type': 'str'}, + 'vnet_configuration': {'key': 'properties.vnetConfiguration', 'type': 'VnetConfiguration'}, + 'deployment_errors': {'key': 'properties.deploymentErrors', 'type': 'str'}, + 'default_domain': {'key': 'properties.defaultDomain', 'type': 'str'}, + 'static_ip': {'key': 'properties.staticIp', 'type': 'str'}, + 'app_logs_configuration': {'key': 'properties.appLogsConfiguration', 'type': 'AppLogsConfiguration'}, + 'zone_redundant': {'key': 'properties.zoneRedundant', 'type': 'bool'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + dapr_ai_instrumentation_key: Optional[str] = None, + dapr_ai_connection_string: Optional[str] = None, + vnet_configuration: Optional["VnetConfiguration"] = None, + app_logs_configuration: Optional["AppLogsConfiguration"] = None, + zone_redundant: Optional[bool] = None, + **kwargs + ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + :keyword dapr_ai_instrumentation_key: Azure Monitor instrumentation key used by Dapr to export + Service to Service communication telemetry. + :paramtype dapr_ai_instrumentation_key: str + :keyword dapr_ai_connection_string: Application Insights connection string used by Dapr to + export Service to Service communication telemetry. + :paramtype dapr_ai_connection_string: str + :keyword vnet_configuration: Vnet configuration for the environment. + :paramtype vnet_configuration: ~azure.mgmt.appcontainers.models.VnetConfiguration + :keyword app_logs_configuration: Cluster configuration which enables the log daemon to export + app logs to a destination. Currently only "log-analytics" is + supported. + :paramtype app_logs_configuration: ~azure.mgmt.appcontainers.models.AppLogsConfiguration + :keyword zone_redundant: Whether or not this Managed Environment is zone-redundant. + :paramtype zone_redundant: bool + """ + super(ManagedEnvironment, self).__init__(tags=tags, location=location, **kwargs) + self.provisioning_state = None + self.dapr_ai_instrumentation_key = dapr_ai_instrumentation_key + self.dapr_ai_connection_string = dapr_ai_connection_string + self.vnet_configuration = vnet_configuration + self.deployment_errors = None + self.default_domain = None + self.static_ip = None + self.app_logs_configuration = app_logs_configuration + self.zone_redundant = zone_redundant + + +class ManagedEnvironmentsCollection(msrest.serialization.Model): + """Collection of Environments. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar value: Required. Collection of resources. + :vartype value: list[~azure.mgmt.appcontainers.models.ManagedEnvironment] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ManagedEnvironment]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["ManagedEnvironment"], + **kwargs + ): + """ + :keyword value: Required. Collection of resources. + :paramtype value: list[~azure.mgmt.appcontainers.models.ManagedEnvironment] + """ + super(ManagedEnvironmentsCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class ManagedEnvironmentStorage(ProxyResource): + """Storage resource for managedEnvironment. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData + :ivar properties: Storage properties. + :vartype properties: ~azure.mgmt.appcontainers.models.ManagedEnvironmentStorageProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'properties': {'key': 'properties', 'type': 'ManagedEnvironmentStorageProperties'}, + } + + def __init__( + self, + *, + properties: Optional["ManagedEnvironmentStorageProperties"] = None, + **kwargs + ): + """ + :keyword properties: Storage properties. + :paramtype properties: ~azure.mgmt.appcontainers.models.ManagedEnvironmentStorageProperties + """ + super(ManagedEnvironmentStorage, self).__init__(**kwargs) + self.properties = properties + + +class ManagedEnvironmentStorageProperties(msrest.serialization.Model): + """Storage properties. + + :ivar azure_file: Azure file properties. + :vartype azure_file: ~azure.mgmt.appcontainers.models.AzureFileProperties + """ + + _attribute_map = { + 'azure_file': {'key': 'azureFile', 'type': 'AzureFileProperties'}, + } + + def __init__( + self, + *, + azure_file: Optional["AzureFileProperties"] = None, + **kwargs + ): + """ + :keyword azure_file: Azure file properties. + :paramtype azure_file: ~azure.mgmt.appcontainers.models.AzureFileProperties + """ + super(ManagedEnvironmentStorageProperties, self).__init__(**kwargs) + self.azure_file = azure_file + + +class ManagedEnvironmentStoragesCollection(msrest.serialization.Model): + """Collection of Storage for Environments. + + All required parameters must be populated in order to send to Azure. + + :ivar value: Required. Collection of storage resources. + :vartype value: list[~azure.mgmt.appcontainers.models.ManagedEnvironmentStorage] + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ManagedEnvironmentStorage]'}, + } + + def __init__( + self, + *, + value: List["ManagedEnvironmentStorage"], + **kwargs + ): + """ + :keyword value: Required. Collection of storage resources. + :paramtype value: list[~azure.mgmt.appcontainers.models.ManagedEnvironmentStorage] + """ + super(ManagedEnvironmentStoragesCollection, self).__init__(**kwargs) + self.value = value + + +class ManagedServiceIdentity(msrest.serialization.Model): + """Managed service identity (system assigned and/or user assigned identities). + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar principal_id: The service principal ID of the system assigned identity. This property + will only be provided for a system assigned identity. + :vartype principal_id: str + :ivar tenant_id: The tenant ID of the system assigned identity. This property will only be + provided for a system assigned identity. + :vartype tenant_id: str + :ivar type: Required. Type of managed service identity (where both SystemAssigned and + UserAssigned types are allowed). Possible values include: "None", "SystemAssigned", + "UserAssigned", "SystemAssigned,UserAssigned". + :vartype type: str or ~azure.mgmt.appcontainers.models.ManagedServiceIdentityType + :ivar user_assigned_identities: The set of user assigned identities associated with the + resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. + The dictionary values can be empty objects ({}) in requests. + :vartype user_assigned_identities: dict[str, + ~azure.mgmt.appcontainers.models.UserAssignedIdentity] + """ + + _validation = { + 'principal_id': {'readonly': True}, + 'tenant_id': {'readonly': True}, + 'type': {'required': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'tenant_id': {'key': 'tenantId', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{UserAssignedIdentity}'}, + } + + def __init__( + self, + *, + type: Union[str, "ManagedServiceIdentityType"], + user_assigned_identities: Optional[Dict[str, "UserAssignedIdentity"]] = None, + **kwargs + ): + """ + :keyword type: Required. Type of managed service identity (where both SystemAssigned and + UserAssigned types are allowed). Possible values include: "None", "SystemAssigned", + "UserAssigned", "SystemAssigned,UserAssigned". + :paramtype type: str or ~azure.mgmt.appcontainers.models.ManagedServiceIdentityType + :keyword user_assigned_identities: The set of user assigned identities associated with the + resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. + The dictionary values can be empty objects ({}) in requests. + :paramtype user_assigned_identities: dict[str, + ~azure.mgmt.appcontainers.models.UserAssignedIdentity] + """ + super(ManagedServiceIdentity, self).__init__(**kwargs) + self.principal_id = None + self.tenant_id = None + self.type = type + self.user_assigned_identities = user_assigned_identities + + +class Nonce(msrest.serialization.Model): + """The configuration settings of the nonce used in the login flow. + + :ivar validate_nonce: :code:`false` if the nonce should not be validated while + completing the login flow; otherwise, :code:`true`. + :vartype validate_nonce: bool + :ivar nonce_expiration_interval: The time after the request is made when the nonce should + expire. + :vartype nonce_expiration_interval: str + """ + + _attribute_map = { + 'validate_nonce': {'key': 'validateNonce', 'type': 'bool'}, + 'nonce_expiration_interval': {'key': 'nonceExpirationInterval', 'type': 'str'}, + } + + def __init__( + self, + *, + validate_nonce: Optional[bool] = None, + nonce_expiration_interval: Optional[str] = None, + **kwargs + ): + """ + :keyword validate_nonce: :code:`false` if the nonce should not be validated while + completing the login flow; otherwise, :code:`true`. + :paramtype validate_nonce: bool + :keyword nonce_expiration_interval: The time after the request is made when the nonce should + expire. + :paramtype nonce_expiration_interval: str + """ + super(Nonce, self).__init__(**kwargs) + self.validate_nonce = validate_nonce + self.nonce_expiration_interval = nonce_expiration_interval + + +class OpenIdConnectClientCredential(msrest.serialization.Model): + """The authentication client credentials of the custom Open ID Connect provider. + + :ivar method: The method that should be used to authenticate the user. The only acceptable + values to pass in are None and "ClientSecretPost". The default value is None. + :vartype method: str + :ivar client_secret_setting_name: The app setting that contains the client secret for the + custom Open ID Connect provider. + :vartype client_secret_setting_name: str + """ + + _attribute_map = { + 'method': {'key': 'method', 'type': 'str'}, + 'client_secret_setting_name': {'key': 'clientSecretSettingName', 'type': 'str'}, + } + + def __init__( + self, + *, + method: Optional[str] = None, + client_secret_setting_name: Optional[str] = None, + **kwargs + ): + """ + :keyword method: The method that should be used to authenticate the user. The only acceptable + values to pass in are None and "ClientSecretPost". The default value is None. + :paramtype method: str + :keyword client_secret_setting_name: The app setting that contains the client secret for the + custom Open ID Connect provider. + :paramtype client_secret_setting_name: str + """ + super(OpenIdConnectClientCredential, self).__init__(**kwargs) + self.method = method + self.client_secret_setting_name = client_secret_setting_name + + +class OpenIdConnectConfig(msrest.serialization.Model): + """The configuration settings of the endpoints used for the custom Open ID Connect provider. + + :ivar authorization_endpoint: The endpoint to be used to make an authorization request. + :vartype authorization_endpoint: str + :ivar token_endpoint: The endpoint to be used to request a token. + :vartype token_endpoint: str + :ivar issuer: The endpoint that issues the token. + :vartype issuer: str + :ivar certification_uri: The endpoint that provides the keys necessary to validate the token. + :vartype certification_uri: str + :ivar well_known_open_id_configuration: The endpoint that contains all the configuration + endpoints for the provider. + :vartype well_known_open_id_configuration: str + """ + + _attribute_map = { + 'authorization_endpoint': {'key': 'authorizationEndpoint', 'type': 'str'}, + 'token_endpoint': {'key': 'tokenEndpoint', 'type': 'str'}, + 'issuer': {'key': 'issuer', 'type': 'str'}, + 'certification_uri': {'key': 'certificationUri', 'type': 'str'}, + 'well_known_open_id_configuration': {'key': 'wellKnownOpenIdConfiguration', 'type': 'str'}, + } + + def __init__( + self, + *, + authorization_endpoint: Optional[str] = None, + token_endpoint: Optional[str] = None, + issuer: Optional[str] = None, + certification_uri: Optional[str] = None, + well_known_open_id_configuration: Optional[str] = None, + **kwargs + ): + """ + :keyword authorization_endpoint: The endpoint to be used to make an authorization request. + :paramtype authorization_endpoint: str + :keyword token_endpoint: The endpoint to be used to request a token. + :paramtype token_endpoint: str + :keyword issuer: The endpoint that issues the token. + :paramtype issuer: str + :keyword certification_uri: The endpoint that provides the keys necessary to validate the + token. + :paramtype certification_uri: str + :keyword well_known_open_id_configuration: The endpoint that contains all the configuration + endpoints for the provider. + :paramtype well_known_open_id_configuration: str + """ + super(OpenIdConnectConfig, self).__init__(**kwargs) + self.authorization_endpoint = authorization_endpoint + self.token_endpoint = token_endpoint + self.issuer = issuer + self.certification_uri = certification_uri + self.well_known_open_id_configuration = well_known_open_id_configuration + + +class OpenIdConnectLogin(msrest.serialization.Model): + """The configuration settings of the login flow of the custom Open ID Connect provider. + + :ivar name_claim_type: The name of the claim that contains the users name. + :vartype name_claim_type: str + :ivar scopes: A list of the scopes that should be requested while authenticating. + :vartype scopes: list[str] + """ + + _attribute_map = { + 'name_claim_type': {'key': 'nameClaimType', 'type': 'str'}, + 'scopes': {'key': 'scopes', 'type': '[str]'}, + } + + def __init__( + self, + *, + name_claim_type: Optional[str] = None, + scopes: Optional[List[str]] = None, + **kwargs + ): + """ + :keyword name_claim_type: The name of the claim that contains the users name. + :paramtype name_claim_type: str + :keyword scopes: A list of the scopes that should be requested while authenticating. + :paramtype scopes: list[str] + """ + super(OpenIdConnectLogin, self).__init__(**kwargs) + self.name_claim_type = name_claim_type + self.scopes = scopes + + +class OpenIdConnectRegistration(msrest.serialization.Model): + """The configuration settings of the app registration for the custom Open ID Connect provider. + + :ivar client_id: The client id of the custom Open ID Connect provider. + :vartype client_id: str + :ivar client_credential: The authentication credentials of the custom Open ID Connect provider. + :vartype client_credential: ~azure.mgmt.appcontainers.models.OpenIdConnectClientCredential + :ivar open_id_connect_configuration: The configuration settings of the endpoints used for the + custom Open ID Connect provider. + :vartype open_id_connect_configuration: ~azure.mgmt.appcontainers.models.OpenIdConnectConfig + """ + + _attribute_map = { + 'client_id': {'key': 'clientId', 'type': 'str'}, + 'client_credential': {'key': 'clientCredential', 'type': 'OpenIdConnectClientCredential'}, + 'open_id_connect_configuration': {'key': 'openIdConnectConfiguration', 'type': 'OpenIdConnectConfig'}, + } + + def __init__( + self, + *, + client_id: Optional[str] = None, + client_credential: Optional["OpenIdConnectClientCredential"] = None, + open_id_connect_configuration: Optional["OpenIdConnectConfig"] = None, + **kwargs + ): + """ + :keyword client_id: The client id of the custom Open ID Connect provider. + :paramtype client_id: str + :keyword client_credential: The authentication credentials of the custom Open ID Connect + provider. + :paramtype client_credential: ~azure.mgmt.appcontainers.models.OpenIdConnectClientCredential + :keyword open_id_connect_configuration: The configuration settings of the endpoints used for + the custom Open ID Connect provider. + :paramtype open_id_connect_configuration: ~azure.mgmt.appcontainers.models.OpenIdConnectConfig + """ + super(OpenIdConnectRegistration, self).__init__(**kwargs) + self.client_id = client_id + self.client_credential = client_credential + self.open_id_connect_configuration = open_id_connect_configuration + + +class OperationDetail(msrest.serialization.Model): + """Operation detail payload. + + :ivar name: Name of the operation. + :vartype name: str + :ivar is_data_action: Indicates whether the operation is a data action. + :vartype is_data_action: bool + :ivar display: Display of the operation. + :vartype display: ~azure.mgmt.appcontainers.models.OperationDisplay + :ivar origin: Origin of the operation. + :vartype origin: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, + 'display': {'key': 'display', 'type': 'OperationDisplay'}, + 'origin': {'key': 'origin', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + is_data_action: Optional[bool] = None, + display: Optional["OperationDisplay"] = None, + origin: Optional[str] = None, + **kwargs + ): + """ + :keyword name: Name of the operation. + :paramtype name: str + :keyword is_data_action: Indicates whether the operation is a data action. + :paramtype is_data_action: bool + :keyword display: Display of the operation. + :paramtype display: ~azure.mgmt.appcontainers.models.OperationDisplay + :keyword origin: Origin of the operation. + :paramtype origin: str + """ + super(OperationDetail, self).__init__(**kwargs) + self.name = name + self.is_data_action = is_data_action + self.display = display + self.origin = origin + + +class OperationDisplay(msrest.serialization.Model): + """Operation display payload. + + :ivar provider: Resource provider of the operation. + :vartype provider: str + :ivar resource: Resource of the operation. + :vartype resource: str + :ivar operation: Localized friendly name for the operation. + :vartype operation: str + :ivar description: Localized friendly description for the operation. + :vartype description: str + """ + + _attribute_map = { + 'provider': {'key': 'provider', 'type': 'str'}, + 'resource': {'key': 'resource', 'type': 'str'}, + 'operation': {'key': 'operation', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + } + + def __init__( + self, + *, + provider: Optional[str] = None, + resource: Optional[str] = None, + operation: Optional[str] = None, + description: Optional[str] = None, + **kwargs + ): + """ + :keyword provider: Resource provider of the operation. + :paramtype provider: str + :keyword resource: Resource of the operation. + :paramtype resource: str + :keyword operation: Localized friendly name for the operation. + :paramtype operation: str + :keyword description: Localized friendly description for the operation. + :paramtype description: str + """ + super(OperationDisplay, self).__init__(**kwargs) + self.provider = provider + self.resource = resource + self.operation = operation + self.description = description + + +class QueueScaleRule(msrest.serialization.Model): + """Container App container Azure Queue based scaling rule. + + :ivar queue_name: Queue name. + :vartype queue_name: str + :ivar queue_length: Queue length. + :vartype queue_length: int + :ivar auth: Authentication secrets for the queue scale rule. + :vartype auth: list[~azure.mgmt.appcontainers.models.ScaleRuleAuth] + """ + + _attribute_map = { + 'queue_name': {'key': 'queueName', 'type': 'str'}, + 'queue_length': {'key': 'queueLength', 'type': 'int'}, + 'auth': {'key': 'auth', 'type': '[ScaleRuleAuth]'}, + } + + def __init__( + self, + *, + queue_name: Optional[str] = None, + queue_length: Optional[int] = None, + auth: Optional[List["ScaleRuleAuth"]] = None, + **kwargs + ): + """ + :keyword queue_name: Queue name. + :paramtype queue_name: str + :keyword queue_length: Queue length. + :paramtype queue_length: int + :keyword auth: Authentication secrets for the queue scale rule. + :paramtype auth: list[~azure.mgmt.appcontainers.models.ScaleRuleAuth] + """ + super(QueueScaleRule, self).__init__(**kwargs) + self.queue_name = queue_name + self.queue_length = queue_length + self.auth = auth + + +class RegistryCredentials(msrest.serialization.Model): + """Container App Private Registry. + + :ivar server: Container Registry Server. + :vartype server: str + :ivar username: Container Registry Username. + :vartype username: str + :ivar password_secret_ref: The name of the Secret that contains the registry login password. + :vartype password_secret_ref: str + :ivar identity: A Managed Identity to use to authenticate with Azure Container Registry. For + user-assigned identities, use the full user-assigned identity Resource ID. For system-assigned + identities, use 'system'. + :vartype identity: str + """ + + _attribute_map = { + 'server': {'key': 'server', 'type': 'str'}, + 'username': {'key': 'username', 'type': 'str'}, + 'password_secret_ref': {'key': 'passwordSecretRef', 'type': 'str'}, + 'identity': {'key': 'identity', 'type': 'str'}, + } + + def __init__( + self, + *, + server: Optional[str] = None, + username: Optional[str] = None, + password_secret_ref: Optional[str] = None, + identity: Optional[str] = None, + **kwargs + ): + """ + :keyword server: Container Registry Server. + :paramtype server: str + :keyword username: Container Registry Username. + :paramtype username: str + :keyword password_secret_ref: The name of the Secret that contains the registry login password. + :paramtype password_secret_ref: str + :keyword identity: A Managed Identity to use to authenticate with Azure Container Registry. For + user-assigned identities, use the full user-assigned identity Resource ID. For system-assigned + identities, use 'system'. + :paramtype identity: str + """ + super(RegistryCredentials, self).__init__(**kwargs) + self.server = server + self.username = username + self.password_secret_ref = password_secret_ref + self.identity = identity + + +class RegistryInfo(msrest.serialization.Model): + """Container App registry information. + + :ivar registry_url: registry server Url. + :vartype registry_url: str + :ivar registry_user_name: registry username. + :vartype registry_user_name: str + :ivar registry_password: registry secret. + :vartype registry_password: str + """ + + _attribute_map = { + 'registry_url': {'key': 'registryUrl', 'type': 'str'}, + 'registry_user_name': {'key': 'registryUserName', 'type': 'str'}, + 'registry_password': {'key': 'registryPassword', 'type': 'str'}, + } + + def __init__( + self, + *, + registry_url: Optional[str] = None, + registry_user_name: Optional[str] = None, + registry_password: Optional[str] = None, + **kwargs + ): + """ + :keyword registry_url: registry server Url. + :paramtype registry_url: str + :keyword registry_user_name: registry username. + :paramtype registry_user_name: str + :keyword registry_password: registry secret. + :paramtype registry_password: str + """ + super(RegistryInfo, self).__init__(**kwargs) + self.registry_url = registry_url + self.registry_user_name = registry_user_name + self.registry_password = registry_password + + +class Replica(ProxyResource): + """Container App Revision Replica. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData + :ivar created_time: Timestamp describing when the pod was created by controller. + :vartype created_time: ~datetime.datetime + :ivar containers: The containers collection under a replica. + :vartype containers: list[~azure.mgmt.appcontainers.models.ReplicaContainer] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'created_time': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'created_time': {'key': 'properties.createdTime', 'type': 'iso-8601'}, + 'containers': {'key': 'properties.containers', 'type': '[ReplicaContainer]'}, + } + + def __init__( + self, + *, + containers: Optional[List["ReplicaContainer"]] = None, + **kwargs + ): + """ + :keyword containers: The containers collection under a replica. + :paramtype containers: list[~azure.mgmt.appcontainers.models.ReplicaContainer] + """ + super(Replica, self).__init__(**kwargs) + self.created_time = None + self.containers = containers + + +class ReplicaCollection(msrest.serialization.Model): + """Container App Revision Replicas collection ARM resource. + + All required parameters must be populated in order to send to Azure. + + :ivar value: Required. Collection of resources. + :vartype value: list[~azure.mgmt.appcontainers.models.Replica] + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Replica]'}, + } + + def __init__( + self, + *, + value: List["Replica"], + **kwargs + ): + """ + :keyword value: Required. Collection of resources. + :paramtype value: list[~azure.mgmt.appcontainers.models.Replica] + """ + super(ReplicaCollection, self).__init__(**kwargs) + self.value = value + + +class ReplicaContainer(msrest.serialization.Model): + """Container object under Container App Revision Replica. + + :ivar name: The Name of the Container. + :vartype name: str + :ivar container_id: The Id of the Container. + :vartype container_id: str + :ivar ready: The container ready status. + :vartype ready: bool + :ivar started: The container start status. + :vartype started: bool + :ivar restart_count: The container restart count. + :vartype restart_count: int + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'container_id': {'key': 'containerId', 'type': 'str'}, + 'ready': {'key': 'ready', 'type': 'bool'}, + 'started': {'key': 'started', 'type': 'bool'}, + 'restart_count': {'key': 'restartCount', 'type': 'int'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + container_id: Optional[str] = None, + ready: Optional[bool] = None, + started: Optional[bool] = None, + restart_count: Optional[int] = None, + **kwargs + ): + """ + :keyword name: The Name of the Container. + :paramtype name: str + :keyword container_id: The Id of the Container. + :paramtype container_id: str + :keyword ready: The container ready status. + :paramtype ready: bool + :keyword started: The container start status. + :paramtype started: bool + :keyword restart_count: The container restart count. + :paramtype restart_count: int + """ + super(ReplicaContainer, self).__init__(**kwargs) + self.name = name + self.container_id = container_id + self.ready = ready + self.started = started + self.restart_count = restart_count + + +class Revision(ProxyResource): + """Container App Revision. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData + :ivar created_time: Timestamp describing when the revision was created + by controller. + :vartype created_time: ~datetime.datetime + :ivar fqdn: Fully qualified domain name of the revision. + :vartype fqdn: str + :ivar template: Container App Revision Template with all possible settings and the + defaults if user did not provide them. The defaults are populated + as they were at the creation time. + :vartype template: ~azure.mgmt.appcontainers.models.Template + :ivar active: Boolean describing if the Revision is Active. + :vartype active: bool + :ivar replicas: Number of pods currently running for this revision. + :vartype replicas: int + :ivar traffic_weight: Traffic weight assigned to this revision. + :vartype traffic_weight: int + :ivar provisioning_error: Optional Field - Platform Error Message. + :vartype provisioning_error: str + :ivar health_state: Current health State of the revision. Possible values include: "Healthy", + "Unhealthy", "None". + :vartype health_state: str or ~azure.mgmt.appcontainers.models.RevisionHealthState + :ivar provisioning_state: Current provisioning State of the revision. Possible values include: + "Provisioning", "Provisioned", "Failed", "Deprovisioning", "Deprovisioned". + :vartype provisioning_state: str or ~azure.mgmt.appcontainers.models.RevisionProvisioningState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'created_time': {'readonly': True}, + 'fqdn': {'readonly': True}, + 'template': {'readonly': True}, + 'active': {'readonly': True}, + 'replicas': {'readonly': True}, + 'traffic_weight': {'readonly': True}, + 'provisioning_error': {'readonly': True}, + 'health_state': {'readonly': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'created_time': {'key': 'properties.createdTime', 'type': 'iso-8601'}, + 'fqdn': {'key': 'properties.fqdn', 'type': 'str'}, + 'template': {'key': 'properties.template', 'type': 'Template'}, + 'active': {'key': 'properties.active', 'type': 'bool'}, + 'replicas': {'key': 'properties.replicas', 'type': 'int'}, + 'traffic_weight': {'key': 'properties.trafficWeight', 'type': 'int'}, + 'provisioning_error': {'key': 'properties.provisioningError', 'type': 'str'}, + 'health_state': {'key': 'properties.healthState', 'type': 'str'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(Revision, self).__init__(**kwargs) + self.created_time = None + self.fqdn = None + self.template = None + self.active = None + self.replicas = None + self.traffic_weight = None + self.provisioning_error = None + self.health_state = None + self.provisioning_state = None + + +class RevisionCollection(msrest.serialization.Model): + """Container App Revisions collection ARM resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar value: Required. Collection of resources. + :vartype value: list[~azure.mgmt.appcontainers.models.Revision] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[Revision]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["Revision"], + **kwargs + ): + """ + :keyword value: Required. Collection of resources. + :paramtype value: list[~azure.mgmt.appcontainers.models.Revision] + """ + super(RevisionCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class Scale(msrest.serialization.Model): + """Container App scaling configurations. + + :ivar min_replicas: Optional. Minimum number of container replicas. + :vartype min_replicas: int + :ivar max_replicas: Optional. Maximum number of container replicas. Defaults to 10 if not set. + :vartype max_replicas: int + :ivar rules: Scaling rules. + :vartype rules: list[~azure.mgmt.appcontainers.models.ScaleRule] + """ + + _attribute_map = { + 'min_replicas': {'key': 'minReplicas', 'type': 'int'}, + 'max_replicas': {'key': 'maxReplicas', 'type': 'int'}, + 'rules': {'key': 'rules', 'type': '[ScaleRule]'}, + } + + def __init__( + self, + *, + min_replicas: Optional[int] = None, + max_replicas: Optional[int] = None, + rules: Optional[List["ScaleRule"]] = None, + **kwargs + ): + """ + :keyword min_replicas: Optional. Minimum number of container replicas. + :paramtype min_replicas: int + :keyword max_replicas: Optional. Maximum number of container replicas. Defaults to 10 if not + set. + :paramtype max_replicas: int + :keyword rules: Scaling rules. + :paramtype rules: list[~azure.mgmt.appcontainers.models.ScaleRule] + """ + super(Scale, self).__init__(**kwargs) + self.min_replicas = min_replicas + self.max_replicas = max_replicas + self.rules = rules + + +class ScaleRule(msrest.serialization.Model): + """Container App container scaling rule. + + :ivar name: Scale Rule Name. + :vartype name: str + :ivar azure_queue: Azure Queue based scaling. + :vartype azure_queue: ~azure.mgmt.appcontainers.models.QueueScaleRule + :ivar custom: Custom scale rule. + :vartype custom: ~azure.mgmt.appcontainers.models.CustomScaleRule + :ivar http: HTTP requests based scaling. + :vartype http: ~azure.mgmt.appcontainers.models.HttpScaleRule + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'azure_queue': {'key': 'azureQueue', 'type': 'QueueScaleRule'}, + 'custom': {'key': 'custom', 'type': 'CustomScaleRule'}, + 'http': {'key': 'http', 'type': 'HttpScaleRule'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + azure_queue: Optional["QueueScaleRule"] = None, + custom: Optional["CustomScaleRule"] = None, + http: Optional["HttpScaleRule"] = None, + **kwargs + ): + """ + :keyword name: Scale Rule Name. + :paramtype name: str + :keyword azure_queue: Azure Queue based scaling. + :paramtype azure_queue: ~azure.mgmt.appcontainers.models.QueueScaleRule + :keyword custom: Custom scale rule. + :paramtype custom: ~azure.mgmt.appcontainers.models.CustomScaleRule + :keyword http: HTTP requests based scaling. + :paramtype http: ~azure.mgmt.appcontainers.models.HttpScaleRule + """ + super(ScaleRule, self).__init__(**kwargs) + self.name = name + self.azure_queue = azure_queue + self.custom = custom + self.http = http + + +class ScaleRuleAuth(msrest.serialization.Model): + """Auth Secrets for Container App Scale Rule. + + :ivar secret_ref: Name of the Container App secret from which to pull the auth params. + :vartype secret_ref: str + :ivar trigger_parameter: Trigger Parameter that uses the secret. + :vartype trigger_parameter: str + """ + + _attribute_map = { + 'secret_ref': {'key': 'secretRef', 'type': 'str'}, + 'trigger_parameter': {'key': 'triggerParameter', 'type': 'str'}, + } + + def __init__( + self, + *, + secret_ref: Optional[str] = None, + trigger_parameter: Optional[str] = None, + **kwargs + ): + """ + :keyword secret_ref: Name of the Container App secret from which to pull the auth params. + :paramtype secret_ref: str + :keyword trigger_parameter: Trigger Parameter that uses the secret. + :paramtype trigger_parameter: str + """ + super(ScaleRuleAuth, self).__init__(**kwargs) + self.secret_ref = secret_ref + self.trigger_parameter = trigger_parameter + + +class Secret(msrest.serialization.Model): + """Secret definition. + + :ivar name: Secret Name. + :vartype name: str + :ivar value: Secret Value. + :vartype value: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'value': {'key': 'value', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + value: Optional[str] = None, + **kwargs + ): + """ + :keyword name: Secret Name. + :paramtype name: str + :keyword value: Secret Value. + :paramtype value: str + """ + super(Secret, self).__init__(**kwargs) + self.name = name + self.value = value + + +class SecretsCollection(msrest.serialization.Model): + """Container App Secrets Collection ARM resource. + + All required parameters must be populated in order to send to Azure. + + :ivar value: Required. Collection of resources. + :vartype value: list[~azure.mgmt.appcontainers.models.ContainerAppSecret] + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ContainerAppSecret]'}, + } + + def __init__( + self, + *, + value: List["ContainerAppSecret"], + **kwargs + ): + """ + :keyword value: Required. Collection of resources. + :paramtype value: list[~azure.mgmt.appcontainers.models.ContainerAppSecret] + """ + super(SecretsCollection, self).__init__(**kwargs) + self.value = value + + +class SourceControl(ProxyResource): + """Container App SourceControl. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar id: Fully qualified resource ID for the resource. Ex - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. + :vartype id: str + :ivar name: The name of the resource. + :vartype name: str + :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or + "Microsoft.Storage/storageAccounts". + :vartype type: str + :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy + information. + :vartype system_data: ~azure.mgmt.appcontainers.models.SystemData + :ivar operation_state: Current provisioning State of the operation. Possible values include: + "InProgress", "Succeeded", "Failed", "Canceled". + :vartype operation_state: str or ~azure.mgmt.appcontainers.models.SourceControlOperationState + :ivar repo_url: The repo url which will be integrated to ContainerApp. + :vartype repo_url: str + :ivar branch: The branch which will trigger the auto deployment. + :vartype branch: str + :ivar github_action_configuration: Container App Revision Template with all possible settings + and the + defaults if user did not provide them. The defaults are populated + as they were at the creation time. + :vartype github_action_configuration: + ~azure.mgmt.appcontainers.models.GithubActionConfiguration + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'operation_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'operation_state': {'key': 'properties.operationState', 'type': 'str'}, + 'repo_url': {'key': 'properties.repoUrl', 'type': 'str'}, + 'branch': {'key': 'properties.branch', 'type': 'str'}, + 'github_action_configuration': {'key': 'properties.githubActionConfiguration', 'type': 'GithubActionConfiguration'}, + } + + def __init__( + self, + *, + repo_url: Optional[str] = None, + branch: Optional[str] = None, + github_action_configuration: Optional["GithubActionConfiguration"] = None, + **kwargs + ): + """ + :keyword repo_url: The repo url which will be integrated to ContainerApp. + :paramtype repo_url: str + :keyword branch: The branch which will trigger the auto deployment. + :paramtype branch: str + :keyword github_action_configuration: Container App Revision Template with all possible + settings and the + defaults if user did not provide them. The defaults are populated + as they were at the creation time. + :paramtype github_action_configuration: + ~azure.mgmt.appcontainers.models.GithubActionConfiguration + """ + super(SourceControl, self).__init__(**kwargs) + self.operation_state = None + self.repo_url = repo_url + self.branch = branch + self.github_action_configuration = github_action_configuration + + +class SourceControlCollection(msrest.serialization.Model): + """SourceControl collection ARM resource. + + Variables are only populated by the server, and will be ignored when sending a request. + + All required parameters must be populated in order to send to Azure. + + :ivar value: Required. Collection of resources. + :vartype value: list[~azure.mgmt.appcontainers.models.SourceControl] + :ivar next_link: Link to next page of resources. + :vartype next_link: str + """ + + _validation = { + 'value': {'required': True}, + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[SourceControl]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: List["SourceControl"], + **kwargs + ): + """ + :keyword value: Required. Collection of resources. + :paramtype value: list[~azure.mgmt.appcontainers.models.SourceControl] + """ + super(SourceControlCollection, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class SystemData(msrest.serialization.Model): + """Metadata pertaining to creation and last modification of the resource. + + :ivar created_by: The identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource. Possible values include: + "User", "Application", "ManagedIdentity", "Key". + :vartype created_by_type: str or ~azure.mgmt.appcontainers.models.CreatedByType + :ivar created_at: The timestamp of resource creation (UTC). + :vartype created_at: ~datetime.datetime + :ivar last_modified_by: The identity that last modified the resource. + :vartype last_modified_by: str + :ivar last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :vartype last_modified_by_type: str or ~azure.mgmt.appcontainers.models.CreatedByType + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime + """ + + _attribute_map = { + 'created_by': {'key': 'createdBy', 'type': 'str'}, + 'created_by_type': {'key': 'createdByType', 'type': 'str'}, + 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, + 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, + 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, + 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, + } + + def __init__( + self, + *, + created_by: Optional[str] = None, + created_by_type: Optional[Union[str, "CreatedByType"]] = None, + created_at: Optional[datetime.datetime] = None, + last_modified_by: Optional[str] = None, + last_modified_by_type: Optional[Union[str, "CreatedByType"]] = None, + last_modified_at: Optional[datetime.datetime] = None, + **kwargs + ): + """ + :keyword created_by: The identity that created the resource. + :paramtype created_by: str + :keyword created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :paramtype created_by_type: str or ~azure.mgmt.appcontainers.models.CreatedByType + :keyword created_at: The timestamp of resource creation (UTC). + :paramtype created_at: ~datetime.datetime + :keyword last_modified_by: The identity that last modified the resource. + :paramtype last_modified_by: str + :keyword last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :paramtype last_modified_by_type: str or ~azure.mgmt.appcontainers.models.CreatedByType + :keyword last_modified_at: The timestamp of resource last modification (UTC). + :paramtype last_modified_at: ~datetime.datetime + """ + super(SystemData, self).__init__(**kwargs) + self.created_by = created_by + self.created_by_type = created_by_type + self.created_at = created_at + self.last_modified_by = last_modified_by + self.last_modified_by_type = last_modified_by_type + self.last_modified_at = last_modified_at + + +class Template(msrest.serialization.Model): + """Container App versioned application definition. +Defines the desired state of an immutable revision. +Any changes to this section Will result in a new revision being created. + + :ivar revision_suffix: User friendly suffix that is appended to the revision name. + :vartype revision_suffix: str + :ivar containers: List of container definitions for the Container App. + :vartype containers: list[~azure.mgmt.appcontainers.models.Container] + :ivar scale: Scaling properties for the Container App. + :vartype scale: ~azure.mgmt.appcontainers.models.Scale + :ivar volumes: List of volume definitions for the Container App. + :vartype volumes: list[~azure.mgmt.appcontainers.models.Volume] + """ + + _attribute_map = { + 'revision_suffix': {'key': 'revisionSuffix', 'type': 'str'}, + 'containers': {'key': 'containers', 'type': '[Container]'}, + 'scale': {'key': 'scale', 'type': 'Scale'}, + 'volumes': {'key': 'volumes', 'type': '[Volume]'}, + } + + def __init__( + self, + *, + revision_suffix: Optional[str] = None, + containers: Optional[List["Container"]] = None, + scale: Optional["Scale"] = None, + volumes: Optional[List["Volume"]] = None, + **kwargs + ): + """ + :keyword revision_suffix: User friendly suffix that is appended to the revision name. + :paramtype revision_suffix: str + :keyword containers: List of container definitions for the Container App. + :paramtype containers: list[~azure.mgmt.appcontainers.models.Container] + :keyword scale: Scaling properties for the Container App. + :paramtype scale: ~azure.mgmt.appcontainers.models.Scale + :keyword volumes: List of volume definitions for the Container App. + :paramtype volumes: list[~azure.mgmt.appcontainers.models.Volume] + """ + super(Template, self).__init__(**kwargs) + self.revision_suffix = revision_suffix + self.containers = containers + self.scale = scale + self.volumes = volumes + + +class TrafficWeight(msrest.serialization.Model): + """Traffic weight assigned to a revision. + + :ivar revision_name: Name of a revision. + :vartype revision_name: str + :ivar weight: Traffic weight assigned to a revision. + :vartype weight: int + :ivar latest_revision: Indicates that the traffic weight belongs to a latest stable revision. + :vartype latest_revision: bool + :ivar label: Associates a traffic label with a revision. + :vartype label: str + """ + + _attribute_map = { + 'revision_name': {'key': 'revisionName', 'type': 'str'}, + 'weight': {'key': 'weight', 'type': 'int'}, + 'latest_revision': {'key': 'latestRevision', 'type': 'bool'}, + 'label': {'key': 'label', 'type': 'str'}, + } + + def __init__( + self, + *, + revision_name: Optional[str] = None, + weight: Optional[int] = None, + latest_revision: Optional[bool] = False, + label: Optional[str] = None, + **kwargs + ): + """ + :keyword revision_name: Name of a revision. + :paramtype revision_name: str + :keyword weight: Traffic weight assigned to a revision. + :paramtype weight: int + :keyword latest_revision: Indicates that the traffic weight belongs to a latest stable + revision. + :paramtype latest_revision: bool + :keyword label: Associates a traffic label with a revision. + :paramtype label: str + """ + super(TrafficWeight, self).__init__(**kwargs) + self.revision_name = revision_name + self.weight = weight + self.latest_revision = latest_revision + self.label = label + + +class Twitter(msrest.serialization.Model): + """The configuration settings of the Twitter provider. + + :ivar enabled: :code:`false` if the Twitter provider should not be enabled despite + the set registration; otherwise, :code:`true`. + :vartype enabled: bool + :ivar registration: The configuration settings of the app registration for the Twitter + provider. + :vartype registration: ~azure.mgmt.appcontainers.models.TwitterRegistration + """ + + _attribute_map = { + 'enabled': {'key': 'enabled', 'type': 'bool'}, + 'registration': {'key': 'registration', 'type': 'TwitterRegistration'}, + } + + def __init__( + self, + *, + enabled: Optional[bool] = None, + registration: Optional["TwitterRegistration"] = None, + **kwargs + ): + """ + :keyword enabled: :code:`false` if the Twitter provider should not be enabled + despite the set registration; otherwise, :code:`true`. + :paramtype enabled: bool + :keyword registration: The configuration settings of the app registration for the Twitter + provider. + :paramtype registration: ~azure.mgmt.appcontainers.models.TwitterRegistration + """ + super(Twitter, self).__init__(**kwargs) + self.enabled = enabled + self.registration = registration + + +class TwitterRegistration(msrest.serialization.Model): + """The configuration settings of the app registration for the Twitter provider. + + :ivar consumer_key: The OAuth 1.0a consumer key of the Twitter application used for sign-in. + This setting is required for enabling Twitter Sign-In. + Twitter Sign-In documentation: https://dev.twitter.com/web/sign-in. + :vartype consumer_key: str + :ivar consumer_secret_setting_name: The app setting name that contains the OAuth 1.0a consumer + secret of the Twitter + application used for sign-in. + :vartype consumer_secret_setting_name: str + """ + + _attribute_map = { + 'consumer_key': {'key': 'consumerKey', 'type': 'str'}, + 'consumer_secret_setting_name': {'key': 'consumerSecretSettingName', 'type': 'str'}, + } + + def __init__( + self, + *, + consumer_key: Optional[str] = None, + consumer_secret_setting_name: Optional[str] = None, + **kwargs + ): + """ + :keyword consumer_key: The OAuth 1.0a consumer key of the Twitter application used for sign-in. + This setting is required for enabling Twitter Sign-In. + Twitter Sign-In documentation: https://dev.twitter.com/web/sign-in. + :paramtype consumer_key: str + :keyword consumer_secret_setting_name: The app setting name that contains the OAuth 1.0a + consumer secret of the Twitter + application used for sign-in. + :paramtype consumer_secret_setting_name: str + """ + super(TwitterRegistration, self).__init__(**kwargs) + self.consumer_key = consumer_key + self.consumer_secret_setting_name = consumer_secret_setting_name + + +class UserAssignedIdentity(msrest.serialization.Model): + """User assigned identity properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar principal_id: The principal ID of the assigned identity. + :vartype principal_id: str + :ivar client_id: The client ID of the assigned identity. + :vartype client_id: str + """ + + _validation = { + 'principal_id': {'readonly': True}, + 'client_id': {'readonly': True}, + } + + _attribute_map = { + 'principal_id': {'key': 'principalId', 'type': 'str'}, + 'client_id': {'key': 'clientId', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(UserAssignedIdentity, self).__init__(**kwargs) + self.principal_id = None + self.client_id = None + + +class VnetConfiguration(msrest.serialization.Model): + """Configuration properties for apps environment to join a Virtual Network. + + :ivar internal: Boolean indicating the environment only has an internal load balancer. These + environments do not have a public static IP resource, must provide ControlPlaneSubnetResourceId + and AppSubnetResourceId if enabling this property. + :vartype internal: bool + :ivar infrastructure_subnet_id: Resource ID of a subnet for infrastructure components. This + subnet must be in the same VNET as the subnet defined in runtimeSubnetId. Must not overlap with + any other provided IP ranges. + :vartype infrastructure_subnet_id: str + :ivar runtime_subnet_id: Resource ID of a subnet that Container App containers are injected + into. This subnet must be in the same VNET as the subnet defined in infrastructureSubnetId. + Must not overlap with any other provided IP ranges. + :vartype runtime_subnet_id: str + :ivar docker_bridge_cidr: CIDR notation IP range assigned to the Docker bridge, network. Must + not overlap with any other provided IP ranges. + :vartype docker_bridge_cidr: str + :ivar platform_reserved_cidr: IP range in CIDR notation that can be reserved for environment + infrastructure IP addresses. Must not overlap with any other provided IP ranges. + :vartype platform_reserved_cidr: str + :ivar platform_reserved_dns_ip: An IP address from the IP range defined by platformReservedCidr + that will be reserved for the internal DNS server. + :vartype platform_reserved_dns_ip: str + """ + + _attribute_map = { + 'internal': {'key': 'internal', 'type': 'bool'}, + 'infrastructure_subnet_id': {'key': 'infrastructureSubnetId', 'type': 'str'}, + 'runtime_subnet_id': {'key': 'runtimeSubnetId', 'type': 'str'}, + 'docker_bridge_cidr': {'key': 'dockerBridgeCidr', 'type': 'str'}, + 'platform_reserved_cidr': {'key': 'platformReservedCidr', 'type': 'str'}, + 'platform_reserved_dns_ip': {'key': 'platformReservedDnsIP', 'type': 'str'}, + } + + def __init__( + self, + *, + internal: Optional[bool] = None, + infrastructure_subnet_id: Optional[str] = None, + runtime_subnet_id: Optional[str] = None, + docker_bridge_cidr: Optional[str] = None, + platform_reserved_cidr: Optional[str] = None, + platform_reserved_dns_ip: Optional[str] = None, + **kwargs + ): + """ + :keyword internal: Boolean indicating the environment only has an internal load balancer. These + environments do not have a public static IP resource, must provide ControlPlaneSubnetResourceId + and AppSubnetResourceId if enabling this property. + :paramtype internal: bool + :keyword infrastructure_subnet_id: Resource ID of a subnet for infrastructure components. This + subnet must be in the same VNET as the subnet defined in runtimeSubnetId. Must not overlap with + any other provided IP ranges. + :paramtype infrastructure_subnet_id: str + :keyword runtime_subnet_id: Resource ID of a subnet that Container App containers are injected + into. This subnet must be in the same VNET as the subnet defined in infrastructureSubnetId. + Must not overlap with any other provided IP ranges. + :paramtype runtime_subnet_id: str + :keyword docker_bridge_cidr: CIDR notation IP range assigned to the Docker bridge, network. + Must not overlap with any other provided IP ranges. + :paramtype docker_bridge_cidr: str + :keyword platform_reserved_cidr: IP range in CIDR notation that can be reserved for environment + infrastructure IP addresses. Must not overlap with any other provided IP ranges. + :paramtype platform_reserved_cidr: str + :keyword platform_reserved_dns_ip: An IP address from the IP range defined by + platformReservedCidr that will be reserved for the internal DNS server. + :paramtype platform_reserved_dns_ip: str + """ + super(VnetConfiguration, self).__init__(**kwargs) + self.internal = internal + self.infrastructure_subnet_id = infrastructure_subnet_id + self.runtime_subnet_id = runtime_subnet_id + self.docker_bridge_cidr = docker_bridge_cidr + self.platform_reserved_cidr = platform_reserved_cidr + self.platform_reserved_dns_ip = platform_reserved_dns_ip + + +class Volume(msrest.serialization.Model): + """Volume definitions for the Container App. + + :ivar name: Volume name. + :vartype name: str + :ivar storage_type: Storage type for the volume. If not provided, use EmptyDir. Possible values + include: "AzureFile", "EmptyDir". + :vartype storage_type: str or ~azure.mgmt.appcontainers.models.StorageType + :ivar storage_name: Name of storage resource. No need to provide for EmptyDir. + :vartype storage_name: str + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'storage_type': {'key': 'storageType', 'type': 'str'}, + 'storage_name': {'key': 'storageName', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + storage_type: Optional[Union[str, "StorageType"]] = None, + storage_name: Optional[str] = None, + **kwargs + ): + """ + :keyword name: Volume name. + :paramtype name: str + :keyword storage_type: Storage type for the volume. If not provided, use EmptyDir. Possible + values include: "AzureFile", "EmptyDir". + :paramtype storage_type: str or ~azure.mgmt.appcontainers.models.StorageType + :keyword storage_name: Name of storage resource. No need to provide for EmptyDir. + :paramtype storage_name: str + """ + super(Volume, self).__init__(**kwargs) + self.name = name + self.storage_type = storage_type + self.storage_name = storage_name + + +class VolumeMount(msrest.serialization.Model): + """Volume mount for the Container App. + + :ivar volume_name: This must match the Name of a Volume. + :vartype volume_name: str + :ivar mount_path: Path within the container at which the volume should be mounted.Must not + contain ':'. + :vartype mount_path: str + """ + + _attribute_map = { + 'volume_name': {'key': 'volumeName', 'type': 'str'}, + 'mount_path': {'key': 'mountPath', 'type': 'str'}, + } + + def __init__( + self, + *, + volume_name: Optional[str] = None, + mount_path: Optional[str] = None, + **kwargs + ): + """ + :keyword volume_name: This must match the Name of a Volume. + :paramtype volume_name: str + :keyword mount_path: Path within the container at which the volume should be mounted.Must not + contain ':'. + :paramtype mount_path: str + """ + super(VolumeMount, self).__init__(**kwargs) + self.volume_name = volume_name + self.mount_path = mount_path diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/__init__.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/__init__.py new file mode 100644 index 000000000000..505be253220b --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/__init__.py @@ -0,0 +1,33 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from ._container_apps_auth_configs_operations import ContainerAppsAuthConfigsOperations +from ._container_apps_operations import ContainerAppsOperations +from ._container_apps_revisions_operations import ContainerAppsRevisionsOperations +from ._container_apps_revision_replicas_operations import ContainerAppsRevisionReplicasOperations +from ._dapr_components_operations import DaprComponentsOperations +from ._operations import Operations +from ._managed_environments_operations import ManagedEnvironmentsOperations +from ._certificates_operations import CertificatesOperations +from ._namespaces_operations import NamespacesOperations +from ._managed_environments_storages_operations import ManagedEnvironmentsStoragesOperations +from ._container_apps_source_controls_operations import ContainerAppsSourceControlsOperations + +__all__ = [ + 'ContainerAppsAuthConfigsOperations', + 'ContainerAppsOperations', + 'ContainerAppsRevisionsOperations', + 'ContainerAppsRevisionReplicasOperations', + 'DaprComponentsOperations', + 'Operations', + 'ManagedEnvironmentsOperations', + 'CertificatesOperations', + 'NamespacesOperations', + 'ManagedEnvironmentsStoragesOperations', + 'ContainerAppsSourceControlsOperations', +] diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_certificates_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_certificates_operations.py new file mode 100644 index 000000000000..71cc8a1cb8b3 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_certificates_operations.py @@ -0,0 +1,611 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + resource_group_name: str, + managed_environment_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{managedEnvironmentName}/certificates") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "managedEnvironmentName": _SERIALIZER.url("managed_environment_name", managed_environment_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + managed_environment_name: str, + name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{managedEnvironmentName}/certificates/{name}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "managedEnvironmentName": _SERIALIZER.url("managed_environment_name", managed_environment_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + subscription_id: str, + resource_group_name: str, + managed_environment_name: str, + name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{managedEnvironmentName}/certificates/{name}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "managedEnvironmentName": _SERIALIZER.url("managed_environment_name", managed_environment_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + subscription_id: str, + resource_group_name: str, + managed_environment_name: str, + name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{managedEnvironmentName}/certificates/{name}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "managedEnvironmentName": _SERIALIZER.url("managed_environment_name", managed_environment_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_update_request( + subscription_id: str, + resource_group_name: str, + managed_environment_name: str, + name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{managedEnvironmentName}/certificates/{name}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "managedEnvironmentName": _SERIALIZER.url("managed_environment_name", managed_environment_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + +class CertificatesOperations(object): + """CertificatesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appcontainers.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list( + self, + resource_group_name: str, + managed_environment_name: str, + **kwargs: Any + ) -> Iterable["_models.CertificateCollection"]: + """Get the Certificates in a given managed environment. + + Get the Certificates in a given managed environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param managed_environment_name: Name of the Managed Environment. + :type managed_environment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either CertificateCollection or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.CertificateCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.CertificateCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + managed_environment_name=managed_environment_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + managed_environment_name=managed_environment_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("CertificateCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{managedEnvironmentName}/certificates"} # type: ignore + + @distributed_trace + def get( + self, + resource_group_name: str, + managed_environment_name: str, + name: str, + **kwargs: Any + ) -> "_models.Certificate": + """Get the specified Certificate. + + Get the specified Certificate. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param managed_environment_name: Name of the Managed Environment. + :type managed_environment_name: str + :param name: Name of the Certificate. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Certificate, or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.Certificate + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Certificate"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + managed_environment_name=managed_environment_name, + name=name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Certificate', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{managedEnvironmentName}/certificates/{name}"} # type: ignore + + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + managed_environment_name: str, + name: str, + certificate_envelope: Optional["_models.Certificate"] = None, + **kwargs: Any + ) -> "_models.Certificate": + """Create or Update a Certificate. + + Create or Update a Certificate. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param managed_environment_name: Name of the Managed Environment. + :type managed_environment_name: str + :param name: Name of the Certificate. + :type name: str + :param certificate_envelope: Certificate to be created or updated. Default value is None. + :type certificate_envelope: ~azure.mgmt.appcontainers.models.Certificate + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Certificate, or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.Certificate + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Certificate"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + if certificate_envelope is not None: + _json = self._serialize.body(certificate_envelope, 'Certificate') + else: + _json = None + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + managed_environment_name=managed_environment_name, + name=name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Certificate', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{managedEnvironmentName}/certificates/{name}"} # type: ignore + + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + managed_environment_name: str, + name: str, + **kwargs: Any + ) -> None: + """Deletes the specified Certificate. + + Deletes the specified Certificate. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param managed_environment_name: Name of the Managed Environment. + :type managed_environment_name: str + :param name: Name of the Certificate. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + managed_environment_name=managed_environment_name, + name=name, + api_version=api_version, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{managedEnvironmentName}/certificates/{name}"} # type: ignore + + + @distributed_trace + def update( + self, + resource_group_name: str, + managed_environment_name: str, + name: str, + certificate_envelope: "_models.CertificatePatch", + **kwargs: Any + ) -> "_models.Certificate": + """Update properties of a certificate. + + Patches a certificate. Currently only patching of tags is supported. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param managed_environment_name: Name of the Managed Environment. + :type managed_environment_name: str + :param name: Name of the Certificate. + :type name: str + :param certificate_envelope: Properties of a certificate that need to be updated. + :type certificate_envelope: ~azure.mgmt.appcontainers.models.CertificatePatch + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Certificate, or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.Certificate + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Certificate"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(certificate_envelope, 'CertificatePatch') + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + managed_environment_name=managed_environment_name, + name=name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Certificate', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{managedEnvironmentName}/certificates/{name}"} # type: ignore + diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_auth_configs_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_auth_configs_operations.py new file mode 100644 index 000000000000..73894ff79e05 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_auth_configs_operations.py @@ -0,0 +1,490 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_container_app_request( + subscription_id: str, + resource_group_name: str, + container_app_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/authConfigs") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "containerAppName": _SERIALIZER.url("container_app_name", container_app_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + container_app_name: str, + name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/authConfigs/{name}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "containerAppName": _SERIALIZER.url("container_app_name", container_app_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + subscription_id: str, + resource_group_name: str, + container_app_name: str, + name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/authConfigs/{name}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "containerAppName": _SERIALIZER.url("container_app_name", container_app_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + subscription_id: str, + resource_group_name: str, + container_app_name: str, + name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/authConfigs/{name}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "containerAppName": _SERIALIZER.url("container_app_name", container_app_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + +class ContainerAppsAuthConfigsOperations(object): + """ContainerAppsAuthConfigsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appcontainers.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list_by_container_app( + self, + resource_group_name: str, + container_app_name: str, + **kwargs: Any + ) -> Iterable["_models.AuthConfigCollection"]: + """Get the Container App AuthConfigs in a given resource group. + + Get the Container App AuthConfigs in a given resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param container_app_name: Name of the Container App. + :type container_app_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AuthConfigCollection or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.AuthConfigCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.AuthConfigCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_container_app_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + container_app_name=container_app_name, + api_version=api_version, + template_url=self.list_by_container_app.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_container_app_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + container_app_name=container_app_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("AuthConfigCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_container_app.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/authConfigs"} # type: ignore + + @distributed_trace + def get( + self, + resource_group_name: str, + container_app_name: str, + name: str, + **kwargs: Any + ) -> "_models.AuthConfig": + """Get a AuthConfig of a Container App. + + Get a AuthConfig of a Container App. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param container_app_name: Name of the Container App. + :type container_app_name: str + :param name: Name of the Container App AuthConfig. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AuthConfig, or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.AuthConfig + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AuthConfig"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + container_app_name=container_app_name, + name=name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AuthConfig', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/authConfigs/{name}"} # type: ignore + + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + container_app_name: str, + name: str, + auth_config_envelope: "_models.AuthConfig", + **kwargs: Any + ) -> "_models.AuthConfig": + """Create or update the AuthConfig for a Container App. + + Description for Create or update the AuthConfig for a Container App. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param container_app_name: Name of the Container App. + :type container_app_name: str + :param name: Name of the Container App AuthConfig. + :type name: str + :param auth_config_envelope: Properties used to create a Container App AuthConfig. + :type auth_config_envelope: ~azure.mgmt.appcontainers.models.AuthConfig + :keyword callable cls: A custom type or function that will be passed the direct response + :return: AuthConfig, or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.AuthConfig + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.AuthConfig"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(auth_config_envelope, 'AuthConfig') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + container_app_name=container_app_name, + name=name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('AuthConfig', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/authConfigs/{name}"} # type: ignore + + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + container_app_name: str, + name: str, + **kwargs: Any + ) -> None: + """Delete a Container App AuthConfig. + + Description for Delete a Container App AuthConfig. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param container_app_name: Name of the Container App. + :type container_app_name: str + :param name: Name of the Container App AuthConfig. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + container_app_name=container_app_name, + name=name, + api_version=api_version, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/authConfigs/{name}"} # type: ignore + diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_operations.py new file mode 100644 index 000000000000..4a632b875a7a --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_operations.py @@ -0,0 +1,1047 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_subscription_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.App/containerApps") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{name}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "name": _SERIALIZER.url("name", name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{name}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "name": _SERIALIZER.url("name", name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{name}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "name": _SERIALIZER.url("name", name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{name}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "name": _SERIALIZER.url("name", name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_list_custom_host_name_analysis_request( + subscription_id: str, + resource_group_name: str, + container_app_name: str, + *, + custom_hostname: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/listCustomHostNameAnalysis") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "containerAppName": _SERIALIZER.url("container_app_name", container_app_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + if custom_hostname is not None: + _query_parameters['customHostname'] = _SERIALIZER.query("custom_hostname", custom_hostname, 'str') + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_secrets_request( + subscription_id: str, + resource_group_name: str, + name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{name}/listSecrets") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "name": _SERIALIZER.url("name", name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + +class ContainerAppsOperations(object): + """ContainerAppsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appcontainers.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list_by_subscription( + self, + **kwargs: Any + ) -> Iterable["_models.ContainerAppCollection"]: + """Get the Container Apps in a given subscription. + + Get the Container Apps in a given subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ContainerAppCollection or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.ContainerAppCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.ContainerAppCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ContainerAppCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.App/containerApps"} # type: ignore + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.ContainerAppCollection"]: + """Get the Container Apps in a given resource group. + + Get the Container Apps in a given resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ContainerAppCollection or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.ContainerAppCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.ContainerAppCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ContainerAppCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps"} # type: ignore + + @distributed_trace + def get( + self, + resource_group_name: str, + name: str, + **kwargs: Any + ) -> "_models.ContainerApp": + """Get the properties of a Container App. + + Get the properties of a Container App. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param name: Name of the Container App. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ContainerApp, or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.ContainerApp + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ContainerApp"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + name=name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ContainerApp', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{name}"} # type: ignore + + + def _create_or_update_initial( + self, + resource_group_name: str, + name: str, + container_app_envelope: "_models.ContainerApp", + **kwargs: Any + ) -> "_models.ContainerApp": + cls = kwargs.pop('cls', None) # type: ClsType["_models.ContainerApp"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(container_app_envelope, 'ContainerApp') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + name=name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ContainerApp', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ContainerApp', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{name}"} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + name: str, + container_app_envelope: "_models.ContainerApp", + **kwargs: Any + ) -> LROPoller["_models.ContainerApp"]: + """Create or update a Container App. + + Description for Create or update a Container App. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param name: Name of the Container App. + :type name: str + :param container_app_envelope: Properties used to create a container app. + :type container_app_envelope: ~azure.mgmt.appcontainers.models.ContainerApp + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ContainerApp or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.ContainerApp] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ContainerApp"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + name=name, + container_app_envelope=container_app_envelope, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('ContainerApp', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{name}"} # type: ignore + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + name=name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{name}"} # type: ignore + + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Delete a Container App. + + Description for Delete a Container App. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param name: Name of the Container App. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + name=name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{name}"} # type: ignore + + def _update_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + name: str, + container_app_envelope: "_models.ContainerApp", + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(container_app_envelope, 'ContainerApp') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + name=name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{name}"} # type: ignore + + + @distributed_trace + def begin_update( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + name: str, + container_app_envelope: "_models.ContainerApp", + **kwargs: Any + ) -> LROPoller[None]: + """Update properties of a Container App. + + Patches a Container App using JSON Merge Patch. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param name: Name of the Container App. + :type name: str + :param container_app_envelope: Properties of a Container App that need to be updated. + :type container_app_envelope: ~azure.mgmt.appcontainers.models.ContainerApp + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + name=name, + container_app_envelope=container_app_envelope, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{name}"} # type: ignore + + @distributed_trace + def list_custom_host_name_analysis( + self, + resource_group_name: str, + container_app_name: str, + custom_hostname: Optional[str] = None, + **kwargs: Any + ) -> "_models.CustomHostnameAnalysisResult": + """Analyzes a custom hostname for a Container App. + + Analyzes a custom hostname for a Container App. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param container_app_name: Name of the Container App. + :type container_app_name: str + :param custom_hostname: Custom hostname. Default value is None. + :type custom_hostname: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CustomHostnameAnalysisResult, or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.CustomHostnameAnalysisResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CustomHostnameAnalysisResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + + request = build_list_custom_host_name_analysis_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + container_app_name=container_app_name, + api_version=api_version, + custom_hostname=custom_hostname, + template_url=self.list_custom_host_name_analysis.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CustomHostnameAnalysisResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_custom_host_name_analysis.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/listCustomHostNameAnalysis"} # type: ignore + + + @distributed_trace + def list_secrets( + self, + resource_group_name: str, + name: str, + **kwargs: Any + ) -> "_models.SecretsCollection": + """List secrets for a container app. + + List secrets for a container app. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param name: Name of the Container App. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SecretsCollection, or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.SecretsCollection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SecretsCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + + request = build_list_secrets_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + name=name, + api_version=api_version, + template_url=self.list_secrets.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SecretsCollection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_secrets.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{name}/listSecrets"} # type: ignore + diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_revision_replicas_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_revision_replicas_operations.py new file mode 100644 index 000000000000..a086c086c347 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_revision_replicas_operations.py @@ -0,0 +1,259 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Optional, TypeVar + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_replica_request( + subscription_id: str, + resource_group_name: str, + container_app_name: str, + revision_name: str, + name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{revisionName}/replicas/{name}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "containerAppName": _SERIALIZER.url("container_app_name", container_app_name, 'str'), + "revisionName": _SERIALIZER.url("revision_name", revision_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_replicas_request( + subscription_id: str, + resource_group_name: str, + container_app_name: str, + revision_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{revisionName}/replicas") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "containerAppName": _SERIALIZER.url("container_app_name", container_app_name, 'str'), + "revisionName": _SERIALIZER.url("revision_name", revision_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + +class ContainerAppsRevisionReplicasOperations(object): + """ContainerAppsRevisionReplicasOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appcontainers.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def get_replica( + self, + resource_group_name: str, + container_app_name: str, + revision_name: str, + name: str, + **kwargs: Any + ) -> "_models.Replica": + """Get a replica for a Container App Revision. + + Get a replica for a Container App Revision. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param container_app_name: Name of the Container App. + :type container_app_name: str + :param revision_name: Name of the Container App Revision. + :type revision_name: str + :param name: Name of the Container App Revision Replica. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Replica, or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.Replica + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Replica"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + + request = build_get_replica_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + container_app_name=container_app_name, + revision_name=revision_name, + name=name, + api_version=api_version, + template_url=self.get_replica.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Replica', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_replica.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{revisionName}/replicas/{name}"} # type: ignore + + + @distributed_trace + def list_replicas( + self, + resource_group_name: str, + container_app_name: str, + revision_name: str, + **kwargs: Any + ) -> "_models.ReplicaCollection": + """List replicas for a Container App Revision. + + List replicas for a Container App Revision. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param container_app_name: Name of the Container App. + :type container_app_name: str + :param revision_name: Name of the Container App Revision. + :type revision_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ReplicaCollection, or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.ReplicaCollection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ReplicaCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + + request = build_list_replicas_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + container_app_name=container_app_name, + revision_name=revision_name, + api_version=api_version, + template_url=self.list_replicas.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ReplicaCollection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_replicas.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{revisionName}/replicas"} # type: ignore + diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_revisions_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_revisions_operations.py new file mode 100644 index 000000000000..0c1e98d9de88 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_revisions_operations.py @@ -0,0 +1,577 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_revisions_request( + subscription_id: str, + resource_group_name: str, + container_app_name: str, + *, + filter: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "containerAppName": _SERIALIZER.url("container_app_name", container_app_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if filter is not None: + _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_revision_request( + subscription_id: str, + resource_group_name: str, + container_app_name: str, + name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{name}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "containerAppName": _SERIALIZER.url("container_app_name", container_app_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_activate_revision_request( + subscription_id: str, + resource_group_name: str, + container_app_name: str, + name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{name}/activate") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "containerAppName": _SERIALIZER.url("container_app_name", container_app_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_deactivate_revision_request( + subscription_id: str, + resource_group_name: str, + container_app_name: str, + name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{name}/deactivate") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "containerAppName": _SERIALIZER.url("container_app_name", container_app_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_restart_revision_request( + subscription_id: str, + resource_group_name: str, + container_app_name: str, + name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{name}/restart") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "containerAppName": _SERIALIZER.url("container_app_name", container_app_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + +class ContainerAppsRevisionsOperations(object): + """ContainerAppsRevisionsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appcontainers.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list_revisions( + self, + resource_group_name: str, + container_app_name: str, + filter: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.RevisionCollection"]: + """Get the Revisions for a given Container App. + + Get the Revisions for a given Container App. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param container_app_name: Name of the Container App for which Revisions are needed. + :type container_app_name: str + :param filter: The filter to apply on the operation. Default value is None. + :type filter: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either RevisionCollection or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.RevisionCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.RevisionCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_revisions_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + container_app_name=container_app_name, + api_version=api_version, + filter=filter, + template_url=self.list_revisions.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_revisions_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + container_app_name=container_app_name, + api_version=api_version, + filter=filter, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("RevisionCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_revisions.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions"} # type: ignore + + @distributed_trace + def get_revision( + self, + resource_group_name: str, + container_app_name: str, + name: str, + **kwargs: Any + ) -> "_models.Revision": + """Get a revision of a Container App. + + Get a revision of a Container App. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param container_app_name: Name of the Container App. + :type container_app_name: str + :param name: Name of the Container App Revision. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: Revision, or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.Revision + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.Revision"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + + request = build_get_revision_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + container_app_name=container_app_name, + name=name, + api_version=api_version, + template_url=self.get_revision.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('Revision', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get_revision.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{name}"} # type: ignore + + + @distributed_trace + def activate_revision( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + container_app_name: str, + name: str, + **kwargs: Any + ) -> None: + """Activates a revision for a Container App. + + Activates a revision for a Container App. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param container_app_name: Name of the Container App. + :type container_app_name: str + :param name: Name of the Container App Revision. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + + request = build_activate_revision_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + container_app_name=container_app_name, + name=name, + api_version=api_version, + template_url=self.activate_revision.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + activate_revision.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{name}/activate"} # type: ignore + + + @distributed_trace + def deactivate_revision( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + container_app_name: str, + name: str, + **kwargs: Any + ) -> None: + """Deactivates a revision for a Container App. + + Deactivates a revision for a Container App. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param container_app_name: Name of the Container App. + :type container_app_name: str + :param name: Name of the Container App Revision. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + + request = build_deactivate_revision_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + container_app_name=container_app_name, + name=name, + api_version=api_version, + template_url=self.deactivate_revision.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + deactivate_revision.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{name}/deactivate"} # type: ignore + + + @distributed_trace + def restart_revision( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + container_app_name: str, + name: str, + **kwargs: Any + ) -> None: + """Restarts a revision for a Container App. + + Restarts a revision for a Container App. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param container_app_name: Name of the Container App. + :type container_app_name: str + :param name: Name of the Container App Revision. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + + request = build_restart_revision_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + container_app_name=container_app_name, + name=name, + api_version=api_version, + template_url=self.restart_revision.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + restart_revision.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/revisions/{name}/restart"} # type: ignore + diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_source_controls_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_source_controls_operations.py new file mode 100644 index 000000000000..1980b26a0969 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_container_apps_source_controls_operations.py @@ -0,0 +1,606 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_container_app_request( + subscription_id: str, + resource_group_name: str, + container_app_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/sourcecontrols") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "containerAppName": _SERIALIZER.url("container_app_name", container_app_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + container_app_name: str, + name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/sourcecontrols/{name}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "containerAppName": _SERIALIZER.url("container_app_name", container_app_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + container_app_name: str, + name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/sourcecontrols/{name}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "containerAppName": _SERIALIZER.url("container_app_name", container_app_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + container_app_name: str, + name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/sourcecontrols/{name}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "containerAppName": _SERIALIZER.url("container_app_name", container_app_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + +class ContainerAppsSourceControlsOperations(object): + """ContainerAppsSourceControlsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appcontainers.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list_by_container_app( + self, + resource_group_name: str, + container_app_name: str, + **kwargs: Any + ) -> Iterable["_models.SourceControlCollection"]: + """Get the Container App SourceControls in a given resource group. + + Get the Container App SourceControls in a given resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param container_app_name: Name of the Container App. + :type container_app_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either SourceControlCollection or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.SourceControlCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.SourceControlCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_container_app_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + container_app_name=container_app_name, + api_version=api_version, + template_url=self.list_by_container_app.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_container_app_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + container_app_name=container_app_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("SourceControlCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_container_app.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/sourcecontrols"} # type: ignore + + @distributed_trace + def get( + self, + resource_group_name: str, + container_app_name: str, + name: str, + **kwargs: Any + ) -> "_models.SourceControl": + """Get a SourceControl of a Container App. + + Get a SourceControl of a Container App. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param container_app_name: Name of the Container App. + :type container_app_name: str + :param name: Name of the Container App SourceControl. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: SourceControl, or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.SourceControl + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.SourceControl"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + container_app_name=container_app_name, + name=name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('SourceControl', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/sourcecontrols/{name}"} # type: ignore + + + def _create_or_update_initial( + self, + resource_group_name: str, + container_app_name: str, + name: str, + source_control_envelope: "_models.SourceControl", + **kwargs: Any + ) -> "_models.SourceControl": + cls = kwargs.pop('cls', None) # type: ClsType["_models.SourceControl"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(source_control_envelope, 'SourceControl') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + container_app_name=container_app_name, + name=name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('SourceControl', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('SourceControl', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/sourcecontrols/{name}"} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + container_app_name: str, + name: str, + source_control_envelope: "_models.SourceControl", + **kwargs: Any + ) -> LROPoller["_models.SourceControl"]: + """Create or update the SourceControl for a Container App. + + Description for Create or update the SourceControl for a Container App. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param container_app_name: Name of the Container App. + :type container_app_name: str + :param name: Name of the Container App SourceControl. + :type name: str + :param source_control_envelope: Properties used to create a Container App SourceControl. + :type source_control_envelope: ~azure.mgmt.appcontainers.models.SourceControl + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either SourceControl or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.SourceControl] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.SourceControl"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + name=name, + source_control_envelope=source_control_envelope, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('SourceControl', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/sourcecontrols/{name}"} # type: ignore + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + container_app_name: str, + name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + container_app_name=container_app_name, + name=name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/sourcecontrols/{name}"} # type: ignore + + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + container_app_name: str, + name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Delete a Container App SourceControl. + + Description for Delete a Container App SourceControl. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param container_app_name: Name of the Container App. + :type container_app_name: str + :param name: Name of the Container App SourceControl. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + container_app_name=container_app_name, + name=name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/containerApps/{containerAppName}/sourcecontrols/{name}"} # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_dapr_components_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_dapr_components_operations.py new file mode 100644 index 000000000000..19927a386a1f --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_dapr_components_operations.py @@ -0,0 +1,593 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + resource_group_name: str, + environment_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "environmentName": _SERIALIZER.url("environment_name", environment_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + environment_name: str, + name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents/{name}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "environmentName": _SERIALIZER.url("environment_name", environment_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + subscription_id: str, + resource_group_name: str, + environment_name: str, + name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents/{name}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "environmentName": _SERIALIZER.url("environment_name", environment_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + subscription_id: str, + resource_group_name: str, + environment_name: str, + name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents/{name}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "environmentName": _SERIALIZER.url("environment_name", environment_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_secrets_request( + subscription_id: str, + resource_group_name: str, + environment_name: str, + name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents/{name}/listSecrets") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "environmentName": _SERIALIZER.url("environment_name", environment_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + +class DaprComponentsOperations(object): + """DaprComponentsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appcontainers.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list( + self, + resource_group_name: str, + environment_name: str, + **kwargs: Any + ) -> Iterable["_models.DaprComponentsCollection"]: + """Get the Dapr Components for a managed environment. + + Get the Dapr Components for a managed environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. + :type environment_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either DaprComponentsCollection or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.DaprComponentsCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.DaprComponentsCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + environment_name=environment_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + environment_name=environment_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("DaprComponentsCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents"} # type: ignore + + @distributed_trace + def get( + self, + resource_group_name: str, + environment_name: str, + name: str, + **kwargs: Any + ) -> "_models.DaprComponent": + """Get a dapr component. + + Get a dapr component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. + :type environment_name: str + :param name: Name of the Dapr Component. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DaprComponent, or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.DaprComponent + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DaprComponent"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DaprComponent', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents/{name}"} # type: ignore + + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + environment_name: str, + name: str, + dapr_component_envelope: "_models.DaprComponent", + **kwargs: Any + ) -> "_models.DaprComponent": + """Creates or updates a Dapr Component. + + Creates or updates a Dapr Component in a Managed Environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. + :type environment_name: str + :param name: Name of the Dapr Component. + :type name: str + :param dapr_component_envelope: Configuration details of the Dapr Component. + :type dapr_component_envelope: ~azure.mgmt.appcontainers.models.DaprComponent + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DaprComponent, or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.DaprComponent + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DaprComponent"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(dapr_component_envelope, 'DaprComponent') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DaprComponent', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents/{name}"} # type: ignore + + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + environment_name: str, + name: str, + **kwargs: Any + ) -> None: + """Delete a Dapr Component. + + Delete a Dapr Component from a Managed Environment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. + :type environment_name: str + :param name: Name of the Dapr Component. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + api_version=api_version, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents/{name}"} # type: ignore + + + @distributed_trace + def list_secrets( + self, + resource_group_name: str, + environment_name: str, + name: str, + **kwargs: Any + ) -> "_models.DaprSecretsCollection": + """List secrets for a dapr component. + + List secrets for a dapr component. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param environment_name: Name of the Managed Environment. + :type environment_name: str + :param name: Name of the Dapr Component. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: DaprSecretsCollection, or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.DaprSecretsCollection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.DaprSecretsCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + + request = build_list_secrets_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + environment_name=environment_name, + name=name, + api_version=api_version, + template_url=self.list_secrets.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('DaprSecretsCollection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list_secrets.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{environmentName}/daprComponents/{name}/listSecrets"} # type: ignore + diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environments_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environments_operations.py new file mode 100644 index 000000000000..9c5f63340d6d --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environments_operations.py @@ -0,0 +1,847 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_by_subscription_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.App/managedEnvironments") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + subscription_id: str, + resource_group_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{name}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "name": _SERIALIZER.url("name", name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{name}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "name": _SERIALIZER.url("name", name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{name}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "name": _SERIALIZER.url("name", name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{name}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "name": _SERIALIZER.url("name", name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + +class ManagedEnvironmentsOperations(object): + """ManagedEnvironmentsOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appcontainers.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list_by_subscription( + self, + **kwargs: Any + ) -> Iterable["_models.ManagedEnvironmentsCollection"]: + """Get all Environments for a subscription. + + Get all Managed Environments for a subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ManagedEnvironmentsCollection or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.ManagedEnvironmentsCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedEnvironmentsCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_subscription.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ManagedEnvironmentsCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.App/managedEnvironments"} # type: ignore + + @distributed_trace + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.ManagedEnvironmentsCollection"]: + """Get all the Environments in a resource group. + + Get all the Managed Environments in a resource group. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ManagedEnvironmentsCollection or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.ManagedEnvironmentsCollection] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedEnvironmentsCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_by_resource_group_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("ManagedEnvironmentsCollection", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments"} # type: ignore + + @distributed_trace + def get( + self, + resource_group_name: str, + name: str, + **kwargs: Any + ) -> "_models.ManagedEnvironment": + """Get the properties of a Managed Environment. + + Get the properties of a Managed Environment used to host container apps. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param name: Name of the Environment. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedEnvironment, or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.ManagedEnvironment + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedEnvironment"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + name=name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ManagedEnvironment', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{name}"} # type: ignore + + + def _create_or_update_initial( + self, + resource_group_name: str, + name: str, + environment_envelope: "_models.ManagedEnvironment", + **kwargs: Any + ) -> "_models.ManagedEnvironment": + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedEnvironment"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(environment_envelope, 'ManagedEnvironment') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + name=name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 201]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ManagedEnvironment', pipeline_response) + + if response.status_code == 201: + deserialized = self._deserialize('ManagedEnvironment', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{name}"} # type: ignore + + + @distributed_trace + def begin_create_or_update( + self, + resource_group_name: str, + name: str, + environment_envelope: "_models.ManagedEnvironment", + **kwargs: Any + ) -> LROPoller["_models.ManagedEnvironment"]: + """Creates or updates a Managed Environment. + + Creates or updates a Managed Environment used to host container apps. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param name: Name of the Environment. + :type name: str + :param environment_envelope: Configuration details of the Environment. + :type environment_envelope: ~azure.mgmt.appcontainers.models.ManagedEnvironment + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedEnvironment or the result of + cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.appcontainers.models.ManagedEnvironment] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedEnvironment"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + name=name, + environment_envelope=environment_envelope, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + response = pipeline_response.http_response + deserialized = self._deserialize('ManagedEnvironment', pipeline_response) + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{name}"} # type: ignore + + def _delete_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + name: str, + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + name=name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{name}"} # type: ignore + + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + name: str, + **kwargs: Any + ) -> LROPoller[None]: + """Delete a Managed Environment. + + Delete a Managed Environment if it does not have any container apps. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param name: Name of the Environment. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + name=name, + api_version=api_version, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{name}"} # type: ignore + + def _update_initial( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + name: str, + environment_envelope: "_models.ManagedEnvironment", + **kwargs: Any + ) -> None: + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(environment_envelope, 'ManagedEnvironment') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + name=name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{name}"} # type: ignore + + + @distributed_trace + def begin_update( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + name: str, + environment_envelope: "_models.ManagedEnvironment", + **kwargs: Any + ) -> LROPoller[None]: + """Update Managed Environment's properties. + + Patches a Managed Environment using JSON Merge Patch. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param name: Name of the Environment. + :type name: str + :param environment_envelope: Configuration details of the Environment. + :type environment_envelope: ~azure.mgmt.appcontainers.models.ManagedEnvironment + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._update_initial( + resource_group_name=resource_group_name, + name=name, + environment_envelope=environment_envelope, + api_version=api_version, + content_type=content_type, + cls=lambda x,y,z: x, + **kwargs + ) + kwargs.pop('error_map', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{name}"} # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environments_storages_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environments_storages_operations.py new file mode 100644 index 000000000000..1cbf9eba9bf4 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_managed_environments_storages_operations.py @@ -0,0 +1,465 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Optional, TypeVar + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + resource_group_name: str, + env_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{envName}/storages") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "envName": _SERIALIZER.url("env_name", env_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + env_name: str, + name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{envName}/storages/{name}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "envName": _SERIALIZER.url("env_name", env_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + subscription_id: str, + resource_group_name: str, + env_name: str, + name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{envName}/storages/{name}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "envName": _SERIALIZER.url("env_name", env_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + subscription_id: str, + resource_group_name: str, + env_name: str, + name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{envName}/storages/{name}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "envName": _SERIALIZER.url("env_name", env_name, 'str'), + "name": _SERIALIZER.url("name", name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + +class ManagedEnvironmentsStoragesOperations(object): + """ManagedEnvironmentsStoragesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appcontainers.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list( + self, + resource_group_name: str, + env_name: str, + **kwargs: Any + ) -> "_models.ManagedEnvironmentStoragesCollection": + """Get all storages for a managedEnvironment. + + Get all storages for a managedEnvironment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param env_name: Name of the Environment. + :type env_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedEnvironmentStoragesCollection, or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.ManagedEnvironmentStoragesCollection + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedEnvironmentStoragesCollection"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + env_name=env_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ManagedEnvironmentStoragesCollection', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{envName}/storages"} # type: ignore + + + @distributed_trace + def get( + self, + resource_group_name: str, + env_name: str, + name: str, + **kwargs: Any + ) -> "_models.ManagedEnvironmentStorage": + """Get storage for a managedEnvironment. + + Get storage for a managedEnvironment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param env_name: Name of the Environment. + :type env_name: str + :param name: Name of the storage. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedEnvironmentStorage, or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.ManagedEnvironmentStorage + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedEnvironmentStorage"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + env_name=env_name, + name=name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ManagedEnvironmentStorage', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{envName}/storages/{name}"} # type: ignore + + + @distributed_trace + def create_or_update( + self, + resource_group_name: str, + env_name: str, + name: str, + storage_envelope: "_models.ManagedEnvironmentStorage", + **kwargs: Any + ) -> "_models.ManagedEnvironmentStorage": + """Create or update storage for a managedEnvironment. + + Create or update storage for a managedEnvironment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param env_name: Name of the Environment. + :type env_name: str + :param name: Name of the storage. + :type name: str + :param storage_envelope: Configuration details of storage. + :type storage_envelope: ~azure.mgmt.appcontainers.models.ManagedEnvironmentStorage + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedEnvironmentStorage, or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.ManagedEnvironmentStorage + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedEnvironmentStorage"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(storage_envelope, 'ManagedEnvironmentStorage') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + env_name=env_name, + name=name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ManagedEnvironmentStorage', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{envName}/storages/{name}"} # type: ignore + + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements + self, + resource_group_name: str, + env_name: str, + name: str, + **kwargs: Any + ) -> None: + """Delete storage for a managedEnvironment. + + Delete storage for a managedEnvironment. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param env_name: Name of the Environment. + :type env_name: str + :param name: Name of the storage. + :type name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: None, or the result of cls(response) + :rtype: None + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType[None] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + env_name=env_name, + name=name, + api_version=api_version, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{envName}/storages/{name}"} # type: ignore + diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_namespaces_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_namespaces_operations.py new file mode 100644 index 000000000000..0c56116c5705 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_namespaces_operations.py @@ -0,0 +1,161 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Optional, TypeVar + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_check_name_availability_request( + subscription_id: str, + resource_group_name: str, + managed_environment_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{managedEnvironmentName}/checkNameAvailability") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', min_length=1), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', max_length=90, min_length=1), + "managedEnvironmentName": _SERIALIZER.url("managed_environment_name", managed_environment_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + +class NamespacesOperations(object): + """NamespacesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appcontainers.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def check_name_availability( + self, + resource_group_name: str, + managed_environment_name: str, + check_name_availability_request: "_models.CheckNameAvailabilityRequest", + **kwargs: Any + ) -> "_models.CheckNameAvailabilityResponse": + """Checks the resource name availability. + + Checks if resource name is available. + + :param resource_group_name: The name of the resource group. The name is case insensitive. + :type resource_group_name: str + :param managed_environment_name: Name of the Managed Environment. + :type managed_environment_name: str + :param check_name_availability_request: The check name availability request. + :type check_name_availability_request: + ~azure.mgmt.appcontainers.models.CheckNameAvailabilityRequest + :keyword callable cls: A custom type or function that will be passed the direct response + :return: CheckNameAvailabilityResponse, or the result of cls(response) + :rtype: ~azure.mgmt.appcontainers.models.CheckNameAvailabilityResponse + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.CheckNameAvailabilityResponse"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(check_name_availability_request, 'CheckNameAvailabilityRequest') + + request = build_check_name_availability_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + managed_environment_name=managed_environment_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.check_name_availability.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('CheckNameAvailabilityResponse', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + check_name_availability.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.App/managedEnvironments/{managedEnvironmentName}/checkNameAvailability"} # type: ignore + diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_operations.py b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_operations.py new file mode 100644 index 000000000000..d134b642c4d1 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/operations/_operations.py @@ -0,0 +1,144 @@ +# pylint: disable=too-many-lines +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models +from .._vendor import _convert_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/providers/Microsoft.App/operations") + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + +class Operations(object): + """Operations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~azure.mgmt.appcontainers.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + @distributed_trace + def list( + self, + **kwargs: Any + ) -> Iterable["_models.AvailableOperations"]: + """Lists all of the available RP operations. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either AvailableOperations or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.appcontainers.models.AvailableOperations] + :raises: ~azure.core.exceptions.HttpResponseError + """ + api_version = kwargs.pop('api_version', "2022-03-01") # type: str + + cls = kwargs.pop('cls', None) # type: ClsType["_models.AvailableOperations"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + def prepare_request(next_link=None): + if not next_link: + + request = build_list_request( + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize("AvailableOperations", pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.DefaultErrorResponse, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': "/providers/Microsoft.App/operations"} # type: ignore diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/py.typed b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/azure/mgmt/appcontainers/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/sdk_packaging.toml b/sdk/appcontainers/azure-mgmt-appcontainers/sdk_packaging.toml new file mode 100644 index 000000000000..bca0ab2bc084 --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/sdk_packaging.toml @@ -0,0 +1,9 @@ +[packaging] +package_name = "azure-mgmt-appcontainers" +package_nspkg = "azure-mgmt-nspkg" +package_pprint_name = "Appcontainers Management" +package_doc_id = "" +is_stable = false +is_arm = true +need_msrestazure = false +need_azuremgmtcore = true diff --git a/sdk/appcontainers/azure-mgmt-appcontainers/setup.py b/sdk/appcontainers/azure-mgmt-appcontainers/setup.py new file mode 100644 index 000000000000..5d4fd426bf1e --- /dev/null +++ b/sdk/appcontainers/azure-mgmt-appcontainers/setup.py @@ -0,0 +1,74 @@ +#!/usr/bin/env python + +#------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +#-------------------------------------------------------------------------- + +import re +import os.path +from io import open +from setuptools import find_packages, setup + +# Change the PACKAGE_NAME only to change folder and different name +PACKAGE_NAME = "azure-mgmt-appcontainers" +PACKAGE_PPRINT_NAME = "Appcontainers Management" + +# a-b-c => a/b/c +package_folder_path = PACKAGE_NAME.replace('-', '/') +# a-b-c => a.b.c +namespace_name = PACKAGE_NAME.replace('-', '.') + +# Version extraction inspired from 'requests' +with open(os.path.join(package_folder_path, 'version.py') + if os.path.exists(os.path.join(package_folder_path, 'version.py')) + else os.path.join(package_folder_path, '_version.py'), 'r') as fd: + version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', + fd.read(), re.MULTILINE).group(1) + +if not version: + raise RuntimeError('Cannot find version information') + +with open('README.md', encoding='utf-8') as f: + readme = f.read() +with open('CHANGELOG.md', encoding='utf-8') as f: + changelog = f.read() + +setup( + name=PACKAGE_NAME, + version=version, + description='Microsoft Azure {} Client Library for Python'.format(PACKAGE_PPRINT_NAME), + long_description=readme + '\n\n' + changelog, + long_description_content_type='text/markdown', + license='MIT License', + author='Microsoft Corporation', + author_email='azpysdkhelp@microsoft.com', + url='https://github.com/Azure/azure-sdk-for-python', + keywords="azure, azure sdk", # update with search keywords relevant to the azure service / product + classifiers=[ + 'Development Status :: 4 - Beta', + 'Programming Language :: Python', + 'Programming Language :: Python :: 3 :: Only', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: 3.9', + 'Programming Language :: Python :: 3.10', + 'License :: OSI Approved :: MIT License', + ], + zip_safe=False, + packages=find_packages(exclude=[ + 'tests', + # Exclude packages that will be covered by PEP420 or nspkg + 'azure', + 'azure.mgmt', + ]), + install_requires=[ + 'msrest>=0.6.21', + 'azure-common~=1.1', + 'azure-mgmt-core>=1.3.0,<2.0.0', + ], + python_requires=">=3.6" +) diff --git a/sdk/appcontainers/ci.yml b/sdk/appcontainers/ci.yml new file mode 100644 index 000000000000..8a0095edb46c --- /dev/null +++ b/sdk/appcontainers/ci.yml @@ -0,0 +1,33 @@ +# DO NOT EDIT THIS FILE +# This file is generated automatically and any changes will be lost. + +trigger: + branches: + include: + - main + - hotfix/* + - release/* + - restapi* + paths: + include: + - sdk/appcontainers/ + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + - restapi* + paths: + include: + - sdk/appcontainers/ + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: appcontainers + Artifacts: + - name: azure-mgmt-appcontainers + safeName: azuremgmtappcontainers diff --git a/sdk/chaos/azure-mgmt-chaos/CHANGELOG.md b/sdk/chaos/azure-mgmt-chaos/CHANGELOG.md index 28ff808de1ea..bca0d1034ddf 100644 --- a/sdk/chaos/azure-mgmt-chaos/CHANGELOG.md +++ b/sdk/chaos/azure-mgmt-chaos/CHANGELOG.md @@ -1,5 +1,12 @@ # Release History +## 1.0.0b3 (2022-05-07) + +**Features** + + - Model ActionStatus has a new parameter end_time + - Model ActionStatus has a new parameter start_time + ## 1.0.0b2 (2021-10-25) **Features** diff --git a/sdk/chaos/azure-mgmt-chaos/_meta.json b/sdk/chaos/azure-mgmt-chaos/_meta.json index fa16ba4a6c48..24b79e1f60fd 100644 --- a/sdk/chaos/azure-mgmt-chaos/_meta.json +++ b/sdk/chaos/azure-mgmt-chaos/_meta.json @@ -1,11 +1,11 @@ { - "autorest": "3.4.5", + "autorest": "3.7.2", "use": [ - "@autorest/python@5.8.4", - "@autorest/modelerfour@4.19.2" + "@autorest/python@5.13.0", + "@autorest/modelerfour@4.19.3" ], - "commit": "1e00e8d52c5da01410e898db01c4954c7bd29ba5", + "commit": "27428c65baa3593d019f7f77744fd122f06747ec", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest_command": "autorest specification/chaos/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --track2 --use=@autorest/python@5.8.4 --use=@autorest/modelerfour@4.19.2 --version=3.4.5", + "autorest_command": "autorest specification/chaos/resource-manager/readme.md --multiapi --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --python3-only --use=@autorest/python@5.13.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2", "readme": "specification/chaos/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/__init__.py b/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/__init__.py index fa94e40fc783..9efa2d42a5bd 100644 --- a/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/__init__.py +++ b/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['ChaosManagementClient'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/_chaos_management_client.py b/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/_chaos_management_client.py index c99e87311295..7ce1e3f9074f 100644 --- a/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/_chaos_management_client.py +++ b/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/_chaos_management_client.py @@ -6,99 +6,97 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from copy import deepcopy +from typing import Any, TYPE_CHECKING -from azure.mgmt.core import ARMPipelineClient from msrest import Deserializer, Serializer -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - - from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.mgmt.core import ARMPipelineClient -from ._configuration import ChaosManagementClientConfiguration -from .operations import CapabilitiesOperations -from .operations import ExperimentsOperations -from .operations import Operations -from .operations import TargetsOperations -from .operations import TargetTypesOperations -from .operations import CapabilityTypesOperations from . import models +from ._configuration import ChaosManagementClientConfiguration +from .operations import CapabilitiesOperations, CapabilityTypesOperations, ExperimentsOperations, Operations, TargetTypesOperations, TargetsOperations +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential -class ChaosManagementClient(object): +class ChaosManagementClient: """Chaos Management Client. :ivar capabilities: CapabilitiesOperations operations - :vartype capabilities: chaos_management_client.operations.CapabilitiesOperations + :vartype capabilities: azure.mgmt.chaos.operations.CapabilitiesOperations :ivar experiments: ExperimentsOperations operations - :vartype experiments: chaos_management_client.operations.ExperimentsOperations + :vartype experiments: azure.mgmt.chaos.operations.ExperimentsOperations :ivar operations: Operations operations - :vartype operations: chaos_management_client.operations.Operations + :vartype operations: azure.mgmt.chaos.operations.Operations :ivar targets: TargetsOperations operations - :vartype targets: chaos_management_client.operations.TargetsOperations + :vartype targets: azure.mgmt.chaos.operations.TargetsOperations :ivar target_types: TargetTypesOperations operations - :vartype target_types: chaos_management_client.operations.TargetTypesOperations + :vartype target_types: azure.mgmt.chaos.operations.TargetTypesOperations :ivar capability_types: CapabilityTypesOperations operations - :vartype capability_types: chaos_management_client.operations.CapabilityTypesOperations + :vartype capability_types: azure.mgmt.chaos.operations.CapabilityTypesOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: GUID that represents an Azure subscription ID. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is "https://management.azure.com". + :type base_url: str + :keyword api_version: Api Version. Default value is "2021-09-15-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - base_url=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = ChaosManagementClientConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = ChaosManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.capabilities = CapabilitiesOperations(self._client, self._config, self._serialize, self._deserialize) + self.experiments = ExperimentsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.targets = TargetsOperations(self._client, self._config, self._serialize, self._deserialize) + self.target_types = TargetTypesOperations(self._client, self._config, self._serialize, self._deserialize) + self.capability_types = CapabilityTypesOperations(self._client, self._config, self._serialize, self._deserialize) + - self.capabilities = CapabilitiesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.experiments = ExperimentsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.targets = TargetsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.target_types = TargetTypesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.capability_types = CapabilityTypesOperations( - self._client, self._config, self._serialize, self._deserialize) - - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> HttpResponse: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.HttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) def close(self): # type: () -> None diff --git a/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/_configuration.py b/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/_configuration.py index 3532b84344c0..8a4121878979 100644 --- a/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/_configuration.py +++ b/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/_configuration.py @@ -6,22 +6,20 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential -class ChaosManagementClientConfiguration(Configuration): +class ChaosManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for ChaosManagementClient. Note that all parameters used to create this instance are saved as instance @@ -31,24 +29,28 @@ class ChaosManagementClientConfiguration(Configuration): :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: GUID that represents an Azure subscription ID. :type subscription_id: str + :keyword api_version: Api Version. Default value is "2021-09-15-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(ChaosManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2021-09-15-preview") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(ChaosManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id - self.api_version = "2021-09-15-preview" + self.api_version = api_version self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-chaos/{}'.format(VERSION)) self._configure(**kwargs) @@ -68,4 +70,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/_metadata.json b/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/_metadata.json index 65cab6b6eb30..4cf648a7cc47 100644 --- a/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/_metadata.json +++ b/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/_metadata.json @@ -5,13 +5,13 @@ "name": "ChaosManagementClient", "filename": "_chaos_management_client", "description": "Chaos Management Client.", - "base_url": "\u0027https://management.azure.com\u0027", - "custom_base_url": null, + "host_value": "\"https://management.azure.com\"", + "parameterized_host_template": null, "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ChaosManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ChaosManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ChaosManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ChaosManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=None, # type: Optional[str]", + "signature": "base_url=\"https://management.azure.com\", # type: str", "description": "Service URL", "docstring_type": "str", "required": false @@ -74,7 +74,7 @@ "required": false }, "base_url": { - "signature": "base_url: Optional[str] = None,", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -91,11 +91,10 @@ "config": { "credential": true, "credential_scopes": ["https://management.azure.com/.default"], - "credential_default_policy_type": "BearerTokenCredentialPolicy", - "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { "capabilities": "CapabilitiesOperations", diff --git a/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/_patch.py b/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/_vendor.py b/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/_version.py b/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/_version.py index dfa6ee022f15..20971492f129 100644 --- a/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/_version.py +++ b/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.0.0b2" +VERSION = "1.0.0b3" diff --git a/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/aio/__init__.py b/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/aio/__init__.py index c08df3c5b2e1..aa6d2669b789 100644 --- a/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/aio/__init__.py +++ b/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/aio/__init__.py @@ -8,3 +8,8 @@ from ._chaos_management_client import ChaosManagementClient __all__ = ['ChaosManagementClient'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/aio/_chaos_management_client.py b/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/aio/_chaos_management_client.py index d57076521db6..71ff18f28063 100644 --- a/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/aio/_chaos_management_client.py +++ b/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/aio/_chaos_management_client.py @@ -6,95 +6,97 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest -from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient -from ._configuration import ChaosManagementClientConfiguration -from .operations import CapabilitiesOperations -from .operations import ExperimentsOperations -from .operations import Operations -from .operations import TargetsOperations -from .operations import TargetTypesOperations -from .operations import CapabilityTypesOperations from .. import models +from ._configuration import ChaosManagementClientConfiguration +from .operations import CapabilitiesOperations, CapabilityTypesOperations, ExperimentsOperations, Operations, TargetTypesOperations, TargetsOperations +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential -class ChaosManagementClient(object): +class ChaosManagementClient: """Chaos Management Client. :ivar capabilities: CapabilitiesOperations operations - :vartype capabilities: chaos_management_client.aio.operations.CapabilitiesOperations + :vartype capabilities: azure.mgmt.chaos.aio.operations.CapabilitiesOperations :ivar experiments: ExperimentsOperations operations - :vartype experiments: chaos_management_client.aio.operations.ExperimentsOperations + :vartype experiments: azure.mgmt.chaos.aio.operations.ExperimentsOperations :ivar operations: Operations operations - :vartype operations: chaos_management_client.aio.operations.Operations + :vartype operations: azure.mgmt.chaos.aio.operations.Operations :ivar targets: TargetsOperations operations - :vartype targets: chaos_management_client.aio.operations.TargetsOperations + :vartype targets: azure.mgmt.chaos.aio.operations.TargetsOperations :ivar target_types: TargetTypesOperations operations - :vartype target_types: chaos_management_client.aio.operations.TargetTypesOperations + :vartype target_types: azure.mgmt.chaos.aio.operations.TargetTypesOperations :ivar capability_types: CapabilityTypesOperations operations - :vartype capability_types: chaos_management_client.aio.operations.CapabilityTypesOperations + :vartype capability_types: azure.mgmt.chaos.aio.operations.CapabilityTypesOperations :param credential: Credential needed for the client to connect to Azure. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: GUID that represents an Azure subscription ID. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is "https://management.azure.com". + :type base_url: str + :keyword api_version: Api Version. Default value is "2021-09-15-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, - base_url: Optional[str] = None, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = ChaosManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = ChaosManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.capabilities = CapabilitiesOperations(self._client, self._config, self._serialize, self._deserialize) + self.experiments = ExperimentsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.targets = TargetsOperations(self._client, self._config, self._serialize, self._deserialize) + self.target_types = TargetTypesOperations(self._client, self._config, self._serialize, self._deserialize) + self.capability_types = CapabilityTypesOperations(self._client, self._config, self._serialize, self._deserialize) - self.capabilities = CapabilitiesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.experiments = ExperimentsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.targets = TargetsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.target_types = TargetTypesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.capability_types = CapabilityTypesOperations( - self._client, self._config, self._serialize, self._deserialize) - - async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.AsyncHttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) async def close(self) -> None: await self._client.close() diff --git a/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/aio/_configuration.py b/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/aio/_configuration.py index 9f1f9f8c197a..025b82620c11 100644 --- a/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/aio/_configuration.py +++ b/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/aio/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION @@ -19,7 +19,7 @@ from azure.core.credentials_async import AsyncTokenCredential -class ChaosManagementClientConfiguration(Configuration): +class ChaosManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for ChaosManagementClient. Note that all parameters used to create this instance are saved as instance @@ -29,6 +29,9 @@ class ChaosManagementClientConfiguration(Configuration): :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: GUID that represents an Azure subscription ID. :type subscription_id: str + :keyword api_version: Api Version. Default value is "2021-09-15-preview". Note that overriding + this default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -37,15 +40,17 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(ChaosManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2021-09-15-preview") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(ChaosManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id - self.api_version = "2021-09-15-preview" + self.api_version = api_version self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-chaos/{}'.format(VERSION)) self._configure(**kwargs) @@ -64,4 +69,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/aio/_patch.py b/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/aio/operations/_capabilities_operations.py b/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/aio/operations/_capabilities_operations.py index 971f6533087b..7ab30744ee85 100644 --- a/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/aio/operations/_capabilities_operations.py +++ b/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/aio/operations/_capabilities_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._capabilities_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -26,7 +30,7 @@ class CapabilitiesOperations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~chaos_management_client.models + :type models: ~azure.mgmt.chaos.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -41,6 +45,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -63,53 +68,59 @@ def list( :type parent_resource_name: str :param target_name: String that represents a Target resource name. :type target_name: str - :param continuation_token_parameter: String that sets the continuation token. + :param continuation_token_parameter: String that sets the continuation token. Default value is + None. :type continuation_token_parameter: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either CapabilityListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~chaos_management_client.models.CapabilityListResult] + :return: An iterator like instance of either CapabilityListResult or the result of + cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.chaos.models.CapabilityListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-15-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.CapabilityListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-15-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.\(\)]*[a-zA-Z0-9_\-\(\)]$'), - 'parentProviderNamespace': self._serialize.url("parent_provider_namespace", parent_provider_namespace, 'str', pattern=r'^[a-zA-Z0-9]+\.[a-zA-Z0-9]+$'), - 'parentResourceType': self._serialize.url("parent_resource_type", parent_resource_type, 'str', pattern=r'^[a-zA-Z0-9_\-\.]+$'), - 'parentResourceName': self._serialize.url("parent_resource_name", parent_resource_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.]+$'), - 'targetName': self._serialize.url("target_name", target_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.]+$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if continuation_token_parameter is not None: - query_parameters['continuationToken'] = self._serialize.query("continuation_token_parameter", continuation_token_parameter, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + parent_provider_namespace=parent_provider_namespace, + parent_resource_type=parent_resource_type, + parent_resource_name=parent_resource_name, + target_name=target_name, + api_version=api_version, + continuation_token_parameter=continuation_token_parameter, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + parent_provider_namespace=parent_provider_namespace, + parent_resource_type=parent_resource_type, + parent_resource_name=parent_resource_name, + target_name=target_name, + api_version=api_version, + continuation_token_parameter=continuation_token_parameter, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('CapabilityListResult', pipeline_response) + deserialized = self._deserialize("CapabilityListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -118,21 +129,27 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{parentProviderNamespace}/{parentResourceType}/{parentResourceName}/providers/Microsoft.Chaos/targets/{targetName}/capabilities'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{parentProviderNamespace}/{parentResourceType}/{parentResourceName}/providers/Microsoft.Chaos/targets/{targetName}/capabilities"} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -159,7 +176,7 @@ async def get( :type capability_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: Capability, or the result of cls(response) - :rtype: ~chaos_management_client.models.Capability + :rtype: ~azure.mgmt.chaos.models.Capability :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.Capability"] @@ -167,37 +184,34 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-15-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.\(\)]*[a-zA-Z0-9_\-\(\)]$'), - 'parentProviderNamespace': self._serialize.url("parent_provider_namespace", parent_provider_namespace, 'str', pattern=r'^[a-zA-Z0-9]+\.[a-zA-Z0-9]+$'), - 'parentResourceType': self._serialize.url("parent_resource_type", parent_resource_type, 'str', pattern=r'^[a-zA-Z0-9_\-\.]+$'), - 'parentResourceName': self._serialize.url("parent_resource_name", parent_resource_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.]+$'), - 'targetName': self._serialize.url("target_name", target_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.]+$'), - 'capabilityName': self._serialize.url("capability_name", capability_name, 'str', pattern=r'^[a-zA-Z0-9\-\.]+-\d\.\d$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2021-09-15-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + parent_provider_namespace=parent_provider_namespace, + parent_resource_type=parent_resource_type, + parent_resource_name=parent_resource_name, + target_name=target_name, + capability_name=capability_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Capability', pipeline_response) @@ -206,9 +220,12 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{parentProviderNamespace}/{parentResourceType}/{parentResourceName}/providers/Microsoft.Chaos/targets/{targetName}/capabilities/{capabilityName}'} # type: ignore - async def delete( + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{parentProviderNamespace}/{parentResourceType}/{parentResourceName}/providers/Microsoft.Chaos/targets/{targetName}/capabilities/{capabilityName}"} # type: ignore + + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, parent_provider_namespace: str, @@ -242,44 +259,43 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-15-preview" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.\(\)]*[a-zA-Z0-9_\-\(\)]$'), - 'parentProviderNamespace': self._serialize.url("parent_provider_namespace", parent_provider_namespace, 'str', pattern=r'^[a-zA-Z0-9]+\.[a-zA-Z0-9]+$'), - 'parentResourceType': self._serialize.url("parent_resource_type", parent_resource_type, 'str', pattern=r'^[a-zA-Z0-9_\-\.]+$'), - 'parentResourceName': self._serialize.url("parent_resource_name", parent_resource_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.]+$'), - 'targetName': self._serialize.url("target_name", target_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.]+$'), - 'capabilityName': self._serialize.url("capability_name", capability_name, 'str', pattern=r'^[a-zA-Z0-9\-\.]+-\d\.\d$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2021-09-15-preview") # type: str + + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + parent_provider_namespace=parent_provider_namespace, + parent_resource_type=parent_resource_type, + parent_resource_name=parent_resource_name, + target_name=target_name, + capability_name=capability_name, + api_version=api_version, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{parentProviderNamespace}/{parentResourceType}/{parentResourceName}/providers/Microsoft.Chaos/targets/{targetName}/capabilities/{capabilityName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{parentProviderNamespace}/{parentResourceType}/{parentResourceName}/providers/Microsoft.Chaos/targets/{targetName}/capabilities/{capabilityName}"} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -306,10 +322,10 @@ async def create_or_update( :param capability_name: String that represents a Capability resource name. :type capability_name: str :param capability: Capability resource to be created or updated. - :type capability: ~chaos_management_client.models.Capability + :type capability: ~azure.mgmt.chaos.models.Capability :keyword callable cls: A custom type or function that will be passed the direct response :return: Capability, or the result of cls(response) - :rtype: ~chaos_management_client.models.Capability + :rtype: ~azure.mgmt.chaos.models.Capability :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.Capability"] @@ -317,42 +333,38 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-15-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.\(\)]*[a-zA-Z0-9_\-\(\)]$'), - 'parentProviderNamespace': self._serialize.url("parent_provider_namespace", parent_provider_namespace, 'str', pattern=r'^[a-zA-Z0-9]+\.[a-zA-Z0-9]+$'), - 'parentResourceType': self._serialize.url("parent_resource_type", parent_resource_type, 'str', pattern=r'^[a-zA-Z0-9_\-\.]+$'), - 'parentResourceName': self._serialize.url("parent_resource_name", parent_resource_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.]+$'), - 'targetName': self._serialize.url("target_name", target_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.]+$'), - 'capabilityName': self._serialize.url("capability_name", capability_name, 'str', pattern=r'^[a-zA-Z0-9\-\.]+-\d\.\d$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(capability, 'Capability') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-09-15-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(capability, 'Capability') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + parent_provider_namespace=parent_provider_namespace, + parent_resource_type=parent_resource_type, + parent_resource_name=parent_resource_name, + target_name=target_name, + capability_name=capability_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Capability', pipeline_response) @@ -361,4 +373,6 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{parentProviderNamespace}/{parentResourceType}/{parentResourceName}/providers/Microsoft.Chaos/targets/{targetName}/capabilities/{capabilityName}'} # type: ignore + + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{parentProviderNamespace}/{parentResourceType}/{parentResourceName}/providers/Microsoft.Chaos/targets/{targetName}/capabilities/{capabilityName}"} # type: ignore + diff --git a/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/aio/operations/_capability_types_operations.py b/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/aio/operations/_capability_types_operations.py index cb46f619b5b7..bb407c3ee4f4 100644 --- a/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/aio/operations/_capability_types_operations.py +++ b/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/aio/operations/_capability_types_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._capability_types_operations import build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -26,7 +30,7 @@ class CapabilityTypesOperations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~chaos_management_client.models + :type models: ~azure.mgmt.chaos.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -41,6 +45,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, location_name: str, @@ -54,50 +59,54 @@ def list( :type location_name: str :param target_type_name: String that represents a Target Type resource name. :type target_type_name: str - :param continuation_token_parameter: String that sets the continuation token. + :param continuation_token_parameter: String that sets the continuation token. Default value is + None. :type continuation_token_parameter: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either CapabilityTypeListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~chaos_management_client.models.CapabilityTypeListResult] + :return: An iterator like instance of either CapabilityTypeListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.chaos.models.CapabilityTypeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-15-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.CapabilityTypeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-15-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$'), - 'locationName': self._serialize.url("location_name", location_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.]+$'), - 'targetTypeName': self._serialize.url("target_type_name", target_type_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.]+$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if continuation_token_parameter is not None: - query_parameters['continuationToken'] = self._serialize.query("continuation_token_parameter", continuation_token_parameter, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + location_name=location_name, + target_type_name=target_type_name, + api_version=api_version, + continuation_token_parameter=continuation_token_parameter, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + location_name=location_name, + target_type_name=target_type_name, + api_version=api_version, + continuation_token_parameter=continuation_token_parameter, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('CapabilityTypeListResult', pipeline_response) + deserialized = self._deserialize("CapabilityTypeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -106,21 +115,27 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Chaos/locations/{locationName}/targetTypes/{targetTypeName}/capabilityTypes'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Chaos/locations/{locationName}/targetTypes/{targetTypeName}/capabilityTypes"} # type: ignore + @distributed_trace_async async def get( self, location_name: str, @@ -138,7 +153,7 @@ async def get( :type capability_type_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: CapabilityType, or the result of cls(response) - :rtype: ~chaos_management_client.models.CapabilityType + :rtype: ~azure.mgmt.chaos.models.CapabilityType :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.CapabilityType"] @@ -146,34 +161,31 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-15-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$'), - 'locationName': self._serialize.url("location_name", location_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.]+$'), - 'targetTypeName': self._serialize.url("target_type_name", target_type_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.]+$'), - 'capabilityTypeName': self._serialize.url("capability_type_name", capability_type_name, 'str', pattern=r'^[a-zA-Z0-9\-\.]+-\d\.\d$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2021-09-15-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + location_name=location_name, + target_type_name=target_type_name, + capability_type_name=capability_type_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CapabilityType', pipeline_response) @@ -182,4 +194,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Chaos/locations/{locationName}/targetTypes/{targetTypeName}/capabilityTypes/{capabilityTypeName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Chaos/locations/{locationName}/targetTypes/{targetTypeName}/capabilityTypes/{capabilityTypeName}"} # type: ignore + diff --git a/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/aio/operations/_experiments_operations.py b/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/aio/operations/_experiments_operations.py index 90612e3f41f0..813032511c68 100644 --- a/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/aio/operations/_experiments_operations.py +++ b/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/aio/operations/_experiments_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,19 +6,22 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar, Union from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._experiments_operations import build_cancel_request_initial, build_create_or_update_request_initial, build_delete_request, build_get_execution_details_request, build_get_request, build_get_status_request, build_list_all_request, build_list_all_statuses_request, build_list_execution_details_request, build_list_request, build_start_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -28,7 +32,7 @@ class ExperimentsOperations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~chaos_management_client.models + :type models: ~azure.mgmt.chaos.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -43,6 +47,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_all( self, running: Optional[bool] = None, @@ -52,52 +57,54 @@ def list_all( """Get a list of Experiment resources in a subscription. :param running: Optional value that indicates whether to filter results based on if the - Experiment is currently running. If null, then the results will not be filtered. + Experiment is currently running. If null, then the results will not be filtered. Default value + is None. :type running: bool - :param continuation_token_parameter: String that sets the continuation token. + :param continuation_token_parameter: String that sets the continuation token. Default value is + None. :type continuation_token_parameter: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ExperimentListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~chaos_management_client.models.ExperimentListResult] + :return: An iterator like instance of either ExperimentListResult or the result of + cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.chaos.models.ExperimentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-15-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ExperimentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-15-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_all.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if running is not None: - query_parameters['running'] = self._serialize.query("running", running, 'bool') - if continuation_token_parameter is not None: - query_parameters['continuationToken'] = self._serialize.query("continuation_token_parameter", continuation_token_parameter, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + running=running, + continuation_token_parameter=continuation_token_parameter, + template_url=self.list_all.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + running=running, + continuation_token_parameter=continuation_token_parameter, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ExperimentListResult', pipeline_response) + deserialized = self._deserialize("ExperimentListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -106,21 +113,27 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list_all.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Chaos/experiments'} # type: ignore + list_all.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Chaos/experiments"} # type: ignore + @distributed_trace def list( self, resource_group_name: str, @@ -133,53 +146,56 @@ def list( :param resource_group_name: String that represents an Azure resource group. :type resource_group_name: str :param running: Optional value that indicates whether to filter results based on if the - Experiment is currently running. If null, then the results will not be filtered. + Experiment is currently running. If null, then the results will not be filtered. Default value + is None. :type running: bool - :param continuation_token_parameter: String that sets the continuation token. + :param continuation_token_parameter: String that sets the continuation token. Default value is + None. :type continuation_token_parameter: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ExperimentListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~chaos_management_client.models.ExperimentListResult] + :return: An iterator like instance of either ExperimentListResult or the result of + cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.chaos.models.ExperimentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-15-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ExperimentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-15-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.\(\)]*[a-zA-Z0-9_\-\(\)]$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if running is not None: - query_parameters['running'] = self._serialize.query("running", running, 'bool') - if continuation_token_parameter is not None: - query_parameters['continuationToken'] = self._serialize.query("continuation_token_parameter", continuation_token_parameter, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + running=running, + continuation_token_parameter=continuation_token_parameter, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + running=running, + continuation_token_parameter=continuation_token_parameter, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ExperimentListResult', pipeline_response) + deserialized = self._deserialize("ExperimentListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -188,22 +204,28 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments"} # type: ignore - async def delete( + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, experiment_name: str, @@ -225,40 +247,39 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-15-preview" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.\(\)]*[a-zA-Z0-9_\-\(\)]$'), - 'experimentName': self._serialize.url("experiment_name", experiment_name, 'str', min_length=1, pattern=r'^[a-zA-Z0-9_\-\.]+$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2021-09-15-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + experiment_name=experiment_name, + api_version=api_version, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}"} # type: ignore + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -273,7 +294,7 @@ async def get( :type experiment_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: Experiment, or the result of cls(response) - :rtype: ~chaos_management_client.models.Experiment + :rtype: ~azure.mgmt.chaos.models.Experiment :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.Experiment"] @@ -281,33 +302,30 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-15-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.\(\)]*[a-zA-Z0-9_\-\(\)]$'), - 'experimentName': self._serialize.url("experiment_name", experiment_name, 'str', min_length=1, pattern=r'^[a-zA-Z0-9_\-\.]+$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2021-09-15-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + experiment_name=experiment_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Experiment', pipeline_response) @@ -316,7 +334,9 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}"} # type: ignore + async def _create_or_update_initial( self, @@ -330,39 +350,34 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-15-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.\(\)]*[a-zA-Z0-9_\-\(\)]$'), - 'experimentName': self._serialize.url("experiment_name", experiment_name, 'str', min_length=1, pattern=r'^[a-zA-Z0-9_\-\.]+$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(experiment, 'Experiment') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-09-15-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(experiment, 'Experiment') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + experiment_name=experiment_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = self._deserialize('Experiment', pipeline_response) @@ -370,8 +385,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}"} # type: ignore + + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -386,17 +404,22 @@ async def begin_create_or_update( :param experiment_name: String that represents a Experiment resource name. :type experiment_name: str :param experiment: Experiment resource to be created or updated. - :type experiment: ~chaos_management_client.models.Experiment + :type experiment: ~azure.mgmt.chaos.models.Experiment :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Experiment or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~chaos_management_client.models.Experiment] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Experiment or the result of + cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.chaos.models.Experiment] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-15-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Experiment"] lro_delay = kwargs.pop( @@ -409,27 +432,22 @@ async def begin_create_or_update( resource_group_name=resource_group_name, experiment_name=experiment_name, experiment=experiment, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Experiment', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.\(\)]*[a-zA-Z0-9_\-\(\)]$'), - 'experimentName': self._serialize.url("experiment_name", experiment_name, 'str', min_length=1, pattern=r'^[a-zA-Z0-9_\-\.]+$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'original-uri'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'original-uri'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -439,9 +457,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}"} # type: ignore async def _cancel_initial( self, @@ -454,34 +472,30 @@ async def _cancel_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-15-preview" - accept = "application/json" - - # Construct URL - url = self._cancel_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.\(\)]*[a-zA-Z0-9_\-\(\)]$'), - 'experimentName': self._serialize.url("experiment_name", experiment_name, 'str', min_length=1, pattern=r'^[a-zA-Z0-9_\-\.]+$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2021-09-15-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_cancel_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + experiment_name=experiment_name, + api_version=api_version, + template_url=self._cancel_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = self._deserialize('ExperimentCancelOperationResult', pipeline_response) @@ -489,8 +503,11 @@ async def _cancel_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _cancel_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/cancel'} # type: ignore + _cancel_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/cancel"} # type: ignore + + + @distributed_trace_async async def begin_cancel( self, resource_group_name: str, @@ -505,14 +522,19 @@ async def begin_cancel( :type experiment_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ExperimentCancelOperationResult or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~chaos_management_client.models.ExperimentCancelOperationResult] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ExperimentCancelOperationResult or + the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.chaos.models.ExperimentCancelOperationResult] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-15-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ExperimentCancelOperationResult"] lro_delay = kwargs.pop( @@ -524,27 +546,21 @@ async def begin_cancel( raw_result = await self._cancel_initial( resource_group_name=resource_group_name, experiment_name=experiment_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ExperimentCancelOperationResult', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.\(\)]*[a-zA-Z0-9_\-\(\)]$'), - 'experimentName': self._serialize.url("experiment_name", experiment_name, 'str', min_length=1, pattern=r'^[a-zA-Z0-9_\-\.]+$'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'original-uri'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'original-uri'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -554,10 +570,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_cancel.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/cancel'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_cancel.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/cancel"} # type: ignore + + @distributed_trace_async async def start( self, resource_group_name: str, @@ -572,7 +589,7 @@ async def start( :type experiment_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ExperimentStartOperationResult, or the result of cls(response) - :rtype: ~chaos_management_client.models.ExperimentStartOperationResult + :rtype: ~azure.mgmt.chaos.models.ExperimentStartOperationResult :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ExperimentStartOperationResult"] @@ -580,33 +597,30 @@ async def start( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-15-preview" - accept = "application/json" - - # Construct URL - url = self.start.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.\(\)]*[a-zA-Z0-9_\-\(\)]$'), - 'experimentName': self._serialize.url("experiment_name", experiment_name, 'str', min_length=1, pattern=r'^[a-zA-Z0-9_\-\.]+$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2021-09-15-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_start_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + experiment_name=experiment_name, + api_version=api_version, + template_url=self.start.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ExperimentStartOperationResult', pipeline_response) @@ -615,8 +629,11 @@ async def start( return cls(pipeline_response, deserialized, {}) return deserialized - start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/start'} # type: ignore + start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/start"} # type: ignore + + + @distributed_trace def list_all_statuses( self, resource_group_name: str, @@ -630,45 +647,48 @@ def list_all_statuses( :param experiment_name: String that represents a Experiment resource name. :type experiment_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ExperimentStatusListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~chaos_management_client.models.ExperimentStatusListResult] + :return: An iterator like instance of either ExperimentStatusListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.chaos.models.ExperimentStatusListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-15-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ExperimentStatusListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-15-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_all_statuses.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.\(\)]*[a-zA-Z0-9_\-\(\)]$'), - 'experimentName': self._serialize.url("experiment_name", experiment_name, 'str', min_length=1, pattern=r'^[a-zA-Z0-9_\-\.]+$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_all_statuses_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + experiment_name=experiment_name, + api_version=api_version, + template_url=self.list_all_statuses.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_all_statuses_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + experiment_name=experiment_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ExperimentStatusListResult', pipeline_response) + deserialized = self._deserialize("ExperimentStatusListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -677,21 +697,27 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list_all_statuses.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/statuses'} # type: ignore + list_all_statuses.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/statuses"} # type: ignore + @distributed_trace_async async def get_status( self, resource_group_name: str, @@ -709,7 +735,7 @@ async def get_status( :type status_id: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ExperimentStatus, or the result of cls(response) - :rtype: ~chaos_management_client.models.ExperimentStatus + :rtype: ~azure.mgmt.chaos.models.ExperimentStatus :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ExperimentStatus"] @@ -717,34 +743,31 @@ async def get_status( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-15-preview" - accept = "application/json" - - # Construct URL - url = self.get_status.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.\(\)]*[a-zA-Z0-9_\-\(\)]$'), - 'experimentName': self._serialize.url("experiment_name", experiment_name, 'str', min_length=1, pattern=r'^[a-zA-Z0-9_\-\.]+$'), - 'statusId': self._serialize.url("status_id", status_id, 'str', pattern=r'^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2021-09-15-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_status_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + experiment_name=experiment_name, + status_id=status_id, + api_version=api_version, + template_url=self.get_status.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ExperimentStatus', pipeline_response) @@ -753,8 +776,11 @@ async def get_status( return cls(pipeline_response, deserialized, {}) return deserialized - get_status.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/statuses/{statusId}'} # type: ignore + get_status.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/statuses/{statusId}"} # type: ignore + + + @distributed_trace def list_execution_details( self, resource_group_name: str, @@ -768,45 +794,48 @@ def list_execution_details( :param experiment_name: String that represents a Experiment resource name. :type experiment_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ExperimentExecutionDetailsListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~chaos_management_client.models.ExperimentExecutionDetailsListResult] + :return: An iterator like instance of either ExperimentExecutionDetailsListResult or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.chaos.models.ExperimentExecutionDetailsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-15-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ExperimentExecutionDetailsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-15-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_execution_details.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.\(\)]*[a-zA-Z0-9_\-\(\)]$'), - 'experimentName': self._serialize.url("experiment_name", experiment_name, 'str', min_length=1, pattern=r'^[a-zA-Z0-9_\-\.]+$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_execution_details_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + experiment_name=experiment_name, + api_version=api_version, + template_url=self.list_execution_details.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_execution_details_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + experiment_name=experiment_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('ExperimentExecutionDetailsListResult', pipeline_response) + deserialized = self._deserialize("ExperimentExecutionDetailsListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -815,21 +844,27 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list_execution_details.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/executionDetails'} # type: ignore + list_execution_details.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/executionDetails"} # type: ignore + @distributed_trace_async async def get_execution_details( self, resource_group_name: str, @@ -847,7 +882,7 @@ async def get_execution_details( :type execution_details_id: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ExperimentExecutionDetails, or the result of cls(response) - :rtype: ~chaos_management_client.models.ExperimentExecutionDetails + :rtype: ~azure.mgmt.chaos.models.ExperimentExecutionDetails :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ExperimentExecutionDetails"] @@ -855,34 +890,31 @@ async def get_execution_details( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-15-preview" - accept = "application/json" - - # Construct URL - url = self.get_execution_details.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.\(\)]*[a-zA-Z0-9_\-\(\)]$'), - 'experimentName': self._serialize.url("experiment_name", experiment_name, 'str', min_length=1, pattern=r'^[a-zA-Z0-9_\-\.]+$'), - 'executionDetailsId': self._serialize.url("execution_details_id", execution_details_id, 'str', pattern=r'^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2021-09-15-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_execution_details_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + experiment_name=experiment_name, + execution_details_id=execution_details_id, + api_version=api_version, + template_url=self.get_execution_details.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ExperimentExecutionDetails', pipeline_response) @@ -891,4 +923,6 @@ async def get_execution_details( return cls(pipeline_response, deserialized, {}) return deserialized - get_execution_details.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/executionDetails/{executionDetailsId}'} # type: ignore + + get_execution_details.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/executionDetails/{executionDetailsId}"} # type: ignore + diff --git a/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/aio/operations/_operations.py b/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/aio/operations/_operations.py index 7ba98d047556..1b8e9d3e3907 100644 --- a/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/aio/operations/_operations.py +++ b/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/aio/operations/_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._operations import build_list_all_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -26,7 +29,7 @@ class Operations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~chaos_management_client.models + :type models: ~azure.mgmt.chaos.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -41,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_all( self, **kwargs: Any @@ -49,38 +53,39 @@ def list_all( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~chaos_management_client.models.OperationListResult] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.chaos.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-15-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-15-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_all.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_all_request( + api_version=api_version, + template_url=self.list_all.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_all_request( + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('OperationListResult', pipeline_response) + deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -89,17 +94,22 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list_all.metadata = {'url': '/providers/Microsoft.Chaos/operations'} # type: ignore + list_all.metadata = {'url': "/providers/Microsoft.Chaos/operations"} # type: ignore diff --git a/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/aio/operations/_target_types_operations.py b/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/aio/operations/_target_types_operations.py index dfec4596a7d6..bfe4be53aaf9 100644 --- a/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/aio/operations/_target_types_operations.py +++ b/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/aio/operations/_target_types_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._target_types_operations import build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -26,7 +30,7 @@ class TargetTypesOperations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~chaos_management_client.models + :type models: ~azure.mgmt.chaos.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -41,6 +45,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, location_name: str, @@ -51,49 +56,51 @@ def list( :param location_name: String that represents a Location resource name. :type location_name: str - :param continuation_token_parameter: String that sets the continuation token. + :param continuation_token_parameter: String that sets the continuation token. Default value is + None. :type continuation_token_parameter: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either TargetTypeListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~chaos_management_client.models.TargetTypeListResult] + :return: An iterator like instance of either TargetTypeListResult or the result of + cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.chaos.models.TargetTypeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-15-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.TargetTypeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-15-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$'), - 'locationName': self._serialize.url("location_name", location_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.]+$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if continuation_token_parameter is not None: - query_parameters['continuationToken'] = self._serialize.query("continuation_token_parameter", continuation_token_parameter, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + location_name=location_name, + api_version=api_version, + continuation_token_parameter=continuation_token_parameter, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + location_name=location_name, + api_version=api_version, + continuation_token_parameter=continuation_token_parameter, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('TargetTypeListResult', pipeline_response) + deserialized = self._deserialize("TargetTypeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -102,21 +109,27 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Chaos/locations/{locationName}/targetTypes'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Chaos/locations/{locationName}/targetTypes"} # type: ignore + @distributed_trace_async async def get( self, location_name: str, @@ -131,7 +144,7 @@ async def get( :type target_type_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: TargetType, or the result of cls(response) - :rtype: ~chaos_management_client.models.TargetType + :rtype: ~azure.mgmt.chaos.models.TargetType :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.TargetType"] @@ -139,33 +152,30 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-15-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$'), - 'locationName': self._serialize.url("location_name", location_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.]+$'), - 'targetTypeName': self._serialize.url("target_type_name", target_type_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.]+$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2021-09-15-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + location_name=location_name, + target_type_name=target_type_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('TargetType', pipeline_response) @@ -174,4 +184,6 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Chaos/locations/{locationName}/targetTypes/{targetTypeName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Chaos/locations/{locationName}/targetTypes/{targetTypeName}"} # type: ignore + diff --git a/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/aio/operations/_targets_operations.py b/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/aio/operations/_targets_operations.py index e1c62155cff8..f2d27801c1ae 100644 --- a/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/aio/operations/_targets_operations.py +++ b/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/aio/operations/_targets_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._targets_operations import build_create_or_update_request, build_delete_request, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -26,7 +30,7 @@ class TargetsOperations: instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~chaos_management_client.models + :type models: ~azure.mgmt.chaos.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -41,6 +45,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, resource_group_name: str, @@ -60,52 +65,56 @@ def list( :type parent_resource_type: str :param parent_resource_name: String that represents a resource name. :type parent_resource_name: str - :param continuation_token_parameter: String that sets the continuation token. + :param continuation_token_parameter: String that sets the continuation token. Default value is + None. :type continuation_token_parameter: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either TargetListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~chaos_management_client.models.TargetListResult] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.chaos.models.TargetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-15-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.TargetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-15-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.\(\)]*[a-zA-Z0-9_\-\(\)]$'), - 'parentProviderNamespace': self._serialize.url("parent_provider_namespace", parent_provider_namespace, 'str', pattern=r'^[a-zA-Z0-9]+\.[a-zA-Z0-9]+$'), - 'parentResourceType': self._serialize.url("parent_resource_type", parent_resource_type, 'str', pattern=r'^[a-zA-Z0-9_\-\.]+$'), - 'parentResourceName': self._serialize.url("parent_resource_name", parent_resource_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.]+$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if continuation_token_parameter is not None: - query_parameters['continuationToken'] = self._serialize.query("continuation_token_parameter", continuation_token_parameter, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + parent_provider_namespace=parent_provider_namespace, + parent_resource_type=parent_resource_type, + parent_resource_name=parent_resource_name, + api_version=api_version, + continuation_token_parameter=continuation_token_parameter, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + parent_provider_namespace=parent_provider_namespace, + parent_resource_type=parent_resource_type, + parent_resource_name=parent_resource_name, + api_version=api_version, + continuation_token_parameter=continuation_token_parameter, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('TargetListResult', pipeline_response) + deserialized = self._deserialize("TargetListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -114,21 +123,27 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{parentProviderNamespace}/{parentResourceType}/{parentResourceName}/providers/Microsoft.Chaos/targets'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{parentProviderNamespace}/{parentResourceType}/{parentResourceName}/providers/Microsoft.Chaos/targets"} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, @@ -152,7 +167,7 @@ async def get( :type target_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: Target, or the result of cls(response) - :rtype: ~chaos_management_client.models.Target + :rtype: ~azure.mgmt.chaos.models.Target :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.Target"] @@ -160,36 +175,33 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-15-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.\(\)]*[a-zA-Z0-9_\-\(\)]$'), - 'parentProviderNamespace': self._serialize.url("parent_provider_namespace", parent_provider_namespace, 'str', pattern=r'^[a-zA-Z0-9]+\.[a-zA-Z0-9]+$'), - 'parentResourceType': self._serialize.url("parent_resource_type", parent_resource_type, 'str', pattern=r'^[a-zA-Z0-9_\-\.]+$'), - 'parentResourceName': self._serialize.url("parent_resource_name", parent_resource_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.]+$'), - 'targetName': self._serialize.url("target_name", target_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.]+$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2021-09-15-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + parent_provider_namespace=parent_provider_namespace, + parent_resource_type=parent_resource_type, + parent_resource_name=parent_resource_name, + target_name=target_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Target', pipeline_response) @@ -198,9 +210,12 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{parentProviderNamespace}/{parentResourceType}/{parentResourceName}/providers/Microsoft.Chaos/targets/{targetName}'} # type: ignore - async def delete( + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{parentProviderNamespace}/{parentResourceType}/{parentResourceName}/providers/Microsoft.Chaos/targets/{targetName}"} # type: ignore + + + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, parent_provider_namespace: str, @@ -231,43 +246,42 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-15-preview" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.\(\)]*[a-zA-Z0-9_\-\(\)]$'), - 'parentProviderNamespace': self._serialize.url("parent_provider_namespace", parent_provider_namespace, 'str', pattern=r'^[a-zA-Z0-9]+\.[a-zA-Z0-9]+$'), - 'parentResourceType': self._serialize.url("parent_resource_type", parent_resource_type, 'str', pattern=r'^[a-zA-Z0-9_\-\.]+$'), - 'parentResourceName': self._serialize.url("parent_resource_name", parent_resource_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.]+$'), - 'targetName': self._serialize.url("target_name", target_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.]+$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2021-09-15-preview") # type: str + + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + parent_provider_namespace=parent_provider_namespace, + parent_resource_type=parent_resource_type, + parent_resource_name=parent_resource_name, + target_name=target_name, + api_version=api_version, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{parentProviderNamespace}/{parentResourceType}/{parentResourceName}/providers/Microsoft.Chaos/targets/{targetName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{parentProviderNamespace}/{parentResourceType}/{parentResourceName}/providers/Microsoft.Chaos/targets/{targetName}"} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -291,10 +305,10 @@ async def create_or_update( :param target_name: String that represents a Target resource name. :type target_name: str :param target: Target resource to be created or updated. - :type target: ~chaos_management_client.models.Target + :type target: ~azure.mgmt.chaos.models.Target :keyword callable cls: A custom type or function that will be passed the direct response :return: Target, or the result of cls(response) - :rtype: ~chaos_management_client.models.Target + :rtype: ~azure.mgmt.chaos.models.Target :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.Target"] @@ -302,41 +316,37 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-15-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.\(\)]*[a-zA-Z0-9_\-\(\)]$'), - 'parentProviderNamespace': self._serialize.url("parent_provider_namespace", parent_provider_namespace, 'str', pattern=r'^[a-zA-Z0-9]+\.[a-zA-Z0-9]+$'), - 'parentResourceType': self._serialize.url("parent_resource_type", parent_resource_type, 'str', pattern=r'^[a-zA-Z0-9_\-\.]+$'), - 'parentResourceName': self._serialize.url("parent_resource_name", parent_resource_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.]+$'), - 'targetName': self._serialize.url("target_name", target_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.]+$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(target, 'Target') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-09-15-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(target, 'Target') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + parent_provider_namespace=parent_provider_namespace, + parent_resource_type=parent_resource_type, + parent_resource_name=parent_resource_name, + target_name=target_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Target', pipeline_response) @@ -345,4 +355,6 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{parentProviderNamespace}/{parentResourceType}/{parentResourceName}/providers/Microsoft.Chaos/targets/{targetName}'} # type: ignore + + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{parentProviderNamespace}/{parentResourceType}/{parentResourceName}/providers/Microsoft.Chaos/targets/{targetName}"} # type: ignore + diff --git a/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/models/__init__.py b/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/models/__init__.py index d348640005ea..e6553f68b233 100644 --- a/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/models/__init__.py +++ b/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/models/__init__.py @@ -6,90 +6,48 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import Action - from ._models_py3 import ActionStatus - from ._models_py3 import Branch - from ._models_py3 import BranchStatus - from ._models_py3 import Capability - from ._models_py3 import CapabilityListResult - from ._models_py3 import CapabilityType - from ._models_py3 import CapabilityTypeListResult - from ._models_py3 import ContinuousAction - from ._models_py3 import DelayAction - from ._models_py3 import DiscreteAction - from ._models_py3 import ErrorAdditionalInfo - from ._models_py3 import ErrorDetail - from ._models_py3 import ErrorResponse - from ._models_py3 import Experiment - from ._models_py3 import ExperimentCancelOperationResult - from ._models_py3 import ExperimentExecutionActionTargetDetailsError - from ._models_py3 import ExperimentExecutionActionTargetDetailsProperties - from ._models_py3 import ExperimentExecutionDetails - from ._models_py3 import ExperimentExecutionDetailsListResult - from ._models_py3 import ExperimentExecutionDetailsPropertiesRunInformation - from ._models_py3 import ExperimentListResult - from ._models_py3 import ExperimentStartOperationResult - from ._models_py3 import ExperimentStatus - from ._models_py3 import ExperimentStatusListResult - from ._models_py3 import KeyValuePair - from ._models_py3 import Operation - from ._models_py3 import OperationDisplay - from ._models_py3 import OperationListResult - from ._models_py3 import Resource - from ._models_py3 import ResourceIdentity - from ._models_py3 import Selector - from ._models_py3 import Step - from ._models_py3 import StepStatus - from ._models_py3 import SystemData - from ._models_py3 import Target - from ._models_py3 import TargetListResult - from ._models_py3 import TargetReference - from ._models_py3 import TargetType - from ._models_py3 import TargetTypeListResult - from ._models_py3 import TrackedResource -except (SyntaxError, ImportError): - from ._models import Action # type: ignore - from ._models import ActionStatus # type: ignore - from ._models import Branch # type: ignore - from ._models import BranchStatus # type: ignore - from ._models import Capability # type: ignore - from ._models import CapabilityListResult # type: ignore - from ._models import CapabilityType # type: ignore - from ._models import CapabilityTypeListResult # type: ignore - from ._models import ContinuousAction # type: ignore - from ._models import DelayAction # type: ignore - from ._models import DiscreteAction # type: ignore - from ._models import ErrorAdditionalInfo # type: ignore - from ._models import ErrorDetail # type: ignore - from ._models import ErrorResponse # type: ignore - from ._models import Experiment # type: ignore - from ._models import ExperimentCancelOperationResult # type: ignore - from ._models import ExperimentExecutionActionTargetDetailsError # type: ignore - from ._models import ExperimentExecutionActionTargetDetailsProperties # type: ignore - from ._models import ExperimentExecutionDetails # type: ignore - from ._models import ExperimentExecutionDetailsListResult # type: ignore - from ._models import ExperimentExecutionDetailsPropertiesRunInformation # type: ignore - from ._models import ExperimentListResult # type: ignore - from ._models import ExperimentStartOperationResult # type: ignore - from ._models import ExperimentStatus # type: ignore - from ._models import ExperimentStatusListResult # type: ignore - from ._models import KeyValuePair # type: ignore - from ._models import Operation # type: ignore - from ._models import OperationDisplay # type: ignore - from ._models import OperationListResult # type: ignore - from ._models import Resource # type: ignore - from ._models import ResourceIdentity # type: ignore - from ._models import Selector # type: ignore - from ._models import Step # type: ignore - from ._models import StepStatus # type: ignore - from ._models import SystemData # type: ignore - from ._models import Target # type: ignore - from ._models import TargetListResult # type: ignore - from ._models import TargetReference # type: ignore - from ._models import TargetType # type: ignore - from ._models import TargetTypeListResult # type: ignore - from ._models import TrackedResource # type: ignore +from ._models_py3 import Action +from ._models_py3 import ActionStatus +from ._models_py3 import Branch +from ._models_py3 import BranchStatus +from ._models_py3 import Capability +from ._models_py3 import CapabilityListResult +from ._models_py3 import CapabilityType +from ._models_py3 import CapabilityTypeListResult +from ._models_py3 import ContinuousAction +from ._models_py3 import DelayAction +from ._models_py3 import DiscreteAction +from ._models_py3 import ErrorAdditionalInfo +from ._models_py3 import ErrorDetail +from ._models_py3 import ErrorResponse +from ._models_py3 import Experiment +from ._models_py3 import ExperimentCancelOperationResult +from ._models_py3 import ExperimentExecutionActionTargetDetailsError +from ._models_py3 import ExperimentExecutionActionTargetDetailsProperties +from ._models_py3 import ExperimentExecutionDetails +from ._models_py3 import ExperimentExecutionDetailsListResult +from ._models_py3 import ExperimentExecutionDetailsPropertiesRunInformation +from ._models_py3 import ExperimentListResult +from ._models_py3 import ExperimentStartOperationResult +from ._models_py3 import ExperimentStatus +from ._models_py3 import ExperimentStatusListResult +from ._models_py3 import KeyValuePair +from ._models_py3 import Operation +from ._models_py3 import OperationDisplay +from ._models_py3 import OperationListResult +from ._models_py3 import Resource +from ._models_py3 import ResourceIdentity +from ._models_py3 import Selector +from ._models_py3 import Step +from ._models_py3 import StepStatus +from ._models_py3 import SystemData +from ._models_py3 import Target +from ._models_py3 import TargetListResult +from ._models_py3 import TargetReference +from ._models_py3 import TargetType +from ._models_py3 import TargetTypeListResult +from ._models_py3 import TrackedResource + from ._chaos_management_client_enums import ( ActionType, diff --git a/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/models/_chaos_management_client_enums.py b/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/models/_chaos_management_client_enums.py index 49b325c52be4..9eafe7c9fb27 100644 --- a/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/models/_chaos_management_client_enums.py +++ b/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/models/_chaos_management_client_enums.py @@ -6,33 +6,18 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class ActionType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ActionType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. """ INTERNAL = "Internal" -class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class CreatedByType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of identity that created the resource. """ @@ -41,7 +26,7 @@ class CreatedByType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): MANAGED_IDENTITY = "ManagedIdentity" KEY = "Key" -class Origin(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Origin(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system" """ @@ -50,14 +35,14 @@ class Origin(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): SYSTEM = "system" USER_SYSTEM = "user,system" -class ResourceIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ResourceIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """String of the resource identity type. """ NONE = "None" SYSTEM_ASSIGNED = "SystemAssigned" -class SelectorType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SelectorType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Enum of the selector type. """ diff --git a/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/models/_models.py b/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/models/_models.py deleted file mode 100644 index fae34f530c2e..000000000000 --- a/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/models/_models.py +++ /dev/null @@ -1,1635 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.core.exceptions import HttpResponseError -import msrest.serialization - - -class Action(msrest.serialization.Model): - """Model that represents the base action model. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: ContinuousAction, DelayAction, DiscreteAction. - - All required parameters must be populated in order to send to Azure. - - :param type: Required. Enum that discriminates between action models.Constant filled by server. - :type type: str - :param name: Required. String that represents a Capability URN. - :type name: str - """ - - _validation = { - 'type': {'required': True}, - 'name': {'required': True, 'max_length': 2048, 'min_length': 0}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - } - - _subtype_map = { - 'type': {'continuous': 'ContinuousAction', 'delay': 'DelayAction', 'discrete': 'DiscreteAction'} - } - - def __init__( - self, - **kwargs - ): - super(Action, self).__init__(**kwargs) - self.type = None # type: Optional[str] - self.name = kwargs['name'] - - -class ActionStatus(msrest.serialization.Model): - """Model that represents the an action and its status. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: The name of the action status. - :vartype name: str - :ivar id: The id of the action status. - :vartype id: str - :ivar status: The status of the action. - :vartype status: str - :ivar targets: The array of targets. - :vartype targets: - list[~chaos_management_client.models.ExperimentExecutionActionTargetDetailsProperties] - """ - - _validation = { - 'name': {'readonly': True}, - 'id': {'readonly': True}, - 'status': {'readonly': True}, - 'targets': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'id': {'key': 'id', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - 'targets': {'key': 'targets', 'type': '[ExperimentExecutionActionTargetDetailsProperties]'}, - } - - def __init__( - self, - **kwargs - ): - super(ActionStatus, self).__init__(**kwargs) - self.name = None - self.id = None - self.status = None - self.targets = None - - -class Branch(msrest.serialization.Model): - """Model that represents a branch in the step. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. String of the branch name. - :type name: str - :param actions: Required. List of actions. - :type actions: list[~chaos_management_client.models.Action] - """ - - _validation = { - 'name': {'required': True, 'min_length': 1}, - 'actions': {'required': True, 'min_items': 1}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'actions': {'key': 'actions', 'type': '[Action]'}, - } - - def __init__( - self, - **kwargs - ): - super(Branch, self).__init__(**kwargs) - self.name = kwargs['name'] - self.actions = kwargs['actions'] - - -class BranchStatus(msrest.serialization.Model): - """Model that represents the a list of actions and action statuses. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: The name of the branch status. - :vartype name: str - :ivar id: The id of the branch status. - :vartype id: str - :ivar status: The status of the branch. - :vartype status: str - :ivar actions: The array of actions. - :vartype actions: list[~chaos_management_client.models.ActionStatus] - """ - - _validation = { - 'name': {'readonly': True}, - 'id': {'readonly': True}, - 'status': {'readonly': True}, - 'actions': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'id': {'key': 'id', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - 'actions': {'key': 'actions', 'type': '[ActionStatus]'}, - } - - def __init__( - self, - **kwargs - ): - super(BranchStatus, self).__init__(**kwargs) - self.name = None - self.id = None - self.status = None - self.actions = None - - -class Resource(msrest.serialization.Model): - """Common fields that are returned in the response for all Azure Resource Manager resources. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - - -class Capability(Resource): - """Model that represents a Capability resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: The standard system metadata of a resource type. - :vartype system_data: ~chaos_management_client.models.SystemData - :ivar publisher: String of the Publisher that this Capability extends. - :vartype publisher: str - :ivar target_type: String of the Target Type that this Capability extends. - :vartype target_type: str - :ivar description: Localized string of the description. - :vartype description: str - :ivar parameters_schema: URL to retrieve JSON schema of the Capability parameters. - :vartype parameters_schema: str - :ivar urn: String of the URN for this Capability Type. - :vartype urn: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'publisher': {'readonly': True}, - 'target_type': {'readonly': True}, - 'description': {'readonly': True}, - 'parameters_schema': {'readonly': True, 'max_length': 2048, 'min_length': 0}, - 'urn': {'readonly': True, 'max_length': 2048, 'min_length': 0}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'publisher': {'key': 'properties.publisher', 'type': 'str'}, - 'target_type': {'key': 'properties.targetType', 'type': 'str'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'parameters_schema': {'key': 'properties.parametersSchema', 'type': 'str'}, - 'urn': {'key': 'properties.urn', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Capability, self).__init__(**kwargs) - self.system_data = None - self.publisher = None - self.target_type = None - self.description = None - self.parameters_schema = None - self.urn = None - - -class CapabilityListResult(msrest.serialization.Model): - """Model that represents a list of Capability resources and a link for pagination. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of Capability resources. - :vartype value: list[~chaos_management_client.models.Capability] - :ivar next_link: URL to retrieve the next page of Capability resources. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True, 'max_length': 2048, 'min_length': 0}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Capability]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CapabilityListResult, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class CapabilityType(Resource): - """Model that represents a Capability Type resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: The system metadata properties of the capability type resource. - :vartype system_data: ~chaos_management_client.models.SystemData - :param location: Location of the Capability Type resource. - :type location: str - :ivar publisher: String of the Publisher that this Capability Type extends. - :vartype publisher: str - :ivar target_type: String of the Target Type that this Capability Type extends. - :vartype target_type: str - :ivar display_name: Localized string of the display name. - :vartype display_name: str - :ivar description: Localized string of the description. - :vartype description: str - :ivar parameters_schema: URL to retrieve JSON schema of the Capability Type parameters. - :vartype parameters_schema: str - :ivar urn: String of the URN for this Capability Type. - :vartype urn: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'publisher': {'readonly': True}, - 'target_type': {'readonly': True}, - 'display_name': {'readonly': True}, - 'description': {'readonly': True}, - 'parameters_schema': {'readonly': True, 'max_length': 2048, 'min_length': 0}, - 'urn': {'readonly': True, 'max_length': 2048, 'min_length': 0}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'location': {'key': 'location', 'type': 'str'}, - 'publisher': {'key': 'properties.publisher', 'type': 'str'}, - 'target_type': {'key': 'properties.targetType', 'type': 'str'}, - 'display_name': {'key': 'properties.displayName', 'type': 'str'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'parameters_schema': {'key': 'properties.parametersSchema', 'type': 'str'}, - 'urn': {'key': 'properties.urn', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CapabilityType, self).__init__(**kwargs) - self.system_data = None - self.location = kwargs.get('location', None) - self.publisher = None - self.target_type = None - self.display_name = None - self.description = None - self.parameters_schema = None - self.urn = None - - -class CapabilityTypeListResult(msrest.serialization.Model): - """Model that represents a list of Capability Type resources and a link for pagination. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of Capability Type resources. - :vartype value: list[~chaos_management_client.models.CapabilityType] - :ivar next_link: URL to retrieve the next page of Capability Type resources. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True, 'max_length': 2048, 'min_length': 0}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[CapabilityType]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CapabilityTypeListResult, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class ContinuousAction(Action): - """Model that represents a continuous action. - - All required parameters must be populated in order to send to Azure. - - :param type: Required. Enum that discriminates between action models.Constant filled by server. - :type type: str - :param name: Required. String that represents a Capability URN. - :type name: str - :param duration: Required. ISO8601 formatted string that represents a duration. - :type duration: str - :param parameters: Required. List of key value pairs. - :type parameters: list[~chaos_management_client.models.KeyValuePair] - :param selector_id: Required. String that represents a selector. - :type selector_id: str - """ - - _validation = { - 'type': {'required': True}, - 'name': {'required': True, 'max_length': 2048, 'min_length': 0}, - 'duration': {'required': True, 'pattern': r'^P(\d+Y)?(\d+M)?(\d+D)?(T(\d+H)?(\d+M)?(\d+(\.\d+)?S)?)?$'}, - 'parameters': {'required': True}, - 'selector_id': {'required': True, 'min_length': 1}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'duration': {'key': 'duration', 'type': 'str'}, - 'parameters': {'key': 'parameters', 'type': '[KeyValuePair]'}, - 'selector_id': {'key': 'selectorId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ContinuousAction, self).__init__(**kwargs) - self.type = 'continuous' # type: str - self.duration = kwargs['duration'] - self.parameters = kwargs['parameters'] - self.selector_id = kwargs['selector_id'] - - -class DelayAction(Action): - """Model that represents a delay action. - - All required parameters must be populated in order to send to Azure. - - :param type: Required. Enum that discriminates between action models.Constant filled by server. - :type type: str - :param name: Required. String that represents a Capability URN. - :type name: str - :param duration: Required. ISO8601 formatted string that represents a duration. - :type duration: str - """ - - _validation = { - 'type': {'required': True}, - 'name': {'required': True, 'max_length': 2048, 'min_length': 0}, - 'duration': {'required': True, 'pattern': r'^P(\d+Y)?(\d+M)?(\d+D)?(T(\d+H)?(\d+M)?(\d+(\.\d+)?S)?)?$'}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'duration': {'key': 'duration', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DelayAction, self).__init__(**kwargs) - self.type = 'delay' # type: str - self.duration = kwargs['duration'] - - -class DiscreteAction(Action): - """Model that represents a discrete action. - - All required parameters must be populated in order to send to Azure. - - :param type: Required. Enum that discriminates between action models.Constant filled by server. - :type type: str - :param name: Required. String that represents a Capability URN. - :type name: str - :param parameters: Required. List of key value pairs. - :type parameters: list[~chaos_management_client.models.KeyValuePair] - :param selector_id: Required. String that represents a selector. - :type selector_id: str - """ - - _validation = { - 'type': {'required': True}, - 'name': {'required': True, 'max_length': 2048, 'min_length': 0}, - 'parameters': {'required': True}, - 'selector_id': {'required': True, 'min_length': 1}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'parameters': {'key': 'parameters', 'type': '[KeyValuePair]'}, - 'selector_id': {'key': 'selectorId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DiscreteAction, self).__init__(**kwargs) - self.type = 'discrete' # type: str - self.parameters = kwargs['parameters'] - self.selector_id = kwargs['selector_id'] - - -class ErrorAdditionalInfo(msrest.serialization.Model): - """The resource management error additional info. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar type: The additional info type. - :vartype type: str - :ivar info: The additional info. - :vartype info: any - """ - - _validation = { - 'type': {'readonly': True}, - 'info': {'readonly': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'info': {'key': 'info', 'type': 'object'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorAdditionalInfo, self).__init__(**kwargs) - self.type = None - self.info = None - - -class ErrorDetail(msrest.serialization.Model): - """The error detail. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar code: The error code. - :vartype code: str - :ivar message: The error message. - :vartype message: str - :ivar target: The error target. - :vartype target: str - :ivar details: The error details. - :vartype details: list[~chaos_management_client.models.ErrorDetail] - :ivar additional_info: The error additional info. - :vartype additional_info: list[~chaos_management_client.models.ErrorAdditionalInfo] - """ - - _validation = { - 'code': {'readonly': True}, - 'message': {'readonly': True}, - 'target': {'readonly': True}, - 'details': {'readonly': True}, - 'additional_info': {'readonly': True}, - } - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[ErrorDetail]'}, - 'additional_info': {'key': 'additionalInfo', 'type': '[ErrorAdditionalInfo]'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorDetail, self).__init__(**kwargs) - self.code = None - self.message = None - self.target = None - self.details = None - self.additional_info = None - - -class ErrorResponse(msrest.serialization.Model): - """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). - - :param error: The error object. - :type error: ~chaos_management_client.models.ErrorDetail - """ - - _attribute_map = { - 'error': {'key': 'error', 'type': 'ErrorDetail'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorResponse, self).__init__(**kwargs) - self.error = kwargs.get('error', None) - - -class TrackedResource(Resource): - """The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' and a 'location'. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TrackedResource, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.location = kwargs['location'] - - -class Experiment(TrackedResource): - """Model that represents a Experiment resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str - :ivar system_data: The system metadata of the experiment resource. - :vartype system_data: ~chaos_management_client.models.SystemData - :param identity: The identity of the experiment resource. - :type identity: ~chaos_management_client.models.ResourceIdentity - :param steps: Required. List of steps. - :type steps: list[~chaos_management_client.models.Step] - :param selectors: Required. List of selectors. - :type selectors: list[~chaos_management_client.models.Selector] - :param start_on_creation: A boolean value that indicates if experiment should be started on - creation or not. - :type start_on_creation: bool - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'system_data': {'readonly': True}, - 'steps': {'required': True, 'min_items': 1}, - 'selectors': {'required': True, 'min_items': 1}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'location': {'key': 'location', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'identity': {'key': 'identity', 'type': 'ResourceIdentity'}, - 'steps': {'key': 'properties.steps', 'type': '[Step]'}, - 'selectors': {'key': 'properties.selectors', 'type': '[Selector]'}, - 'start_on_creation': {'key': 'properties.startOnCreation', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(Experiment, self).__init__(**kwargs) - self.system_data = None - self.identity = kwargs.get('identity', None) - self.steps = kwargs['steps'] - self.selectors = kwargs['selectors'] - self.start_on_creation = kwargs.get('start_on_creation', None) - - -class ExperimentCancelOperationResult(msrest.serialization.Model): - """Model that represents the result of a cancel Experiment operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: String of the Experiment name. - :vartype name: str - :ivar status_url: URL to retrieve the Experiment status. - :vartype status_url: str - """ - - _validation = { - 'name': {'readonly': True}, - 'status_url': {'readonly': True, 'max_length': 2048, 'min_length': 0}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'status_url': {'key': 'statusUrl', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ExperimentCancelOperationResult, self).__init__(**kwargs) - self.name = None - self.status_url = None - - -class ExperimentExecutionActionTargetDetailsError(msrest.serialization.Model): - """Model that represents the Experiment action target details error model. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar code: The error code. - :vartype code: str - :ivar message: The error message. - :vartype message: str - """ - - _validation = { - 'code': {'readonly': True}, - 'message': {'readonly': True}, - } - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ExperimentExecutionActionTargetDetailsError, self).__init__(**kwargs) - self.code = None - self.message = None - - -class ExperimentExecutionActionTargetDetailsProperties(msrest.serialization.Model): - """Model that represents the Experiment action target details properties model. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar status: The status of the execution. - :vartype status: str - :ivar target: The target for the action. - :vartype target: str - :ivar failed_date_utc: String that represents the failed date time. - :vartype failed_date_utc: ~datetime.datetime - :ivar completed_date_utc: String that represents the completed date time. - :vartype completed_date_utc: ~datetime.datetime - :ivar error: The error of the action. - :vartype error: ~chaos_management_client.models.ExperimentExecutionActionTargetDetailsError - """ - - _validation = { - 'status': {'readonly': True}, - 'target': {'readonly': True}, - 'failed_date_utc': {'readonly': True}, - 'completed_date_utc': {'readonly': True}, - 'error': {'readonly': True}, - } - - _attribute_map = { - 'status': {'key': 'status', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'failed_date_utc': {'key': 'failedDateUtc', 'type': 'iso-8601'}, - 'completed_date_utc': {'key': 'completedDateUtc', 'type': 'iso-8601'}, - 'error': {'key': 'error', 'type': 'ExperimentExecutionActionTargetDetailsError'}, - } - - def __init__( - self, - **kwargs - ): - super(ExperimentExecutionActionTargetDetailsProperties, self).__init__(**kwargs) - self.status = None - self.target = None - self.failed_date_utc = None - self.completed_date_utc = None - self.error = None - - -class ExperimentExecutionDetails(msrest.serialization.Model): - """Model that represents the execution details of a Experiment. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar type: String of the resource type. - :vartype type: str - :ivar id: String of the fully qualified resource ID. - :vartype id: str - :ivar name: String of the resource name. - :vartype name: str - :ivar experiment_id: The id of the experiment. - :vartype experiment_id: str - :ivar status: The value of the status of the experiment execution. - :vartype status: str - :ivar failure_reason: The reason why the execution failed. - :vartype failure_reason: str - :ivar created_date_utc: String that represents the created date time. - :vartype created_date_utc: ~datetime.datetime - :ivar last_action_date_utc: String that represents the last action date time. - :vartype last_action_date_utc: ~datetime.datetime - :ivar start_date_utc: String that represents the start date time. - :vartype start_date_utc: ~datetime.datetime - :ivar stop_date_utc: String that represents the stop date time. - :vartype stop_date_utc: ~datetime.datetime - :ivar run_information: The information of the experiment run. - :vartype run_information: - ~chaos_management_client.models.ExperimentExecutionDetailsPropertiesRunInformation - """ - - _validation = { - 'type': {'readonly': True}, - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'experiment_id': {'readonly': True}, - 'status': {'readonly': True}, - 'failure_reason': {'readonly': True}, - 'created_date_utc': {'readonly': True}, - 'last_action_date_utc': {'readonly': True}, - 'start_date_utc': {'readonly': True}, - 'stop_date_utc': {'readonly': True}, - 'run_information': {'readonly': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'experiment_id': {'key': 'properties.experimentId', 'type': 'str'}, - 'status': {'key': 'properties.status', 'type': 'str'}, - 'failure_reason': {'key': 'properties.failureReason', 'type': 'str'}, - 'created_date_utc': {'key': 'properties.createdDateUtc', 'type': 'iso-8601'}, - 'last_action_date_utc': {'key': 'properties.lastActionDateUtc', 'type': 'iso-8601'}, - 'start_date_utc': {'key': 'properties.startDateUtc', 'type': 'iso-8601'}, - 'stop_date_utc': {'key': 'properties.stopDateUtc', 'type': 'iso-8601'}, - 'run_information': {'key': 'properties.runInformation', 'type': 'ExperimentExecutionDetailsPropertiesRunInformation'}, - } - - def __init__( - self, - **kwargs - ): - super(ExperimentExecutionDetails, self).__init__(**kwargs) - self.type = None - self.id = None - self.name = None - self.experiment_id = None - self.status = None - self.failure_reason = None - self.created_date_utc = None - self.last_action_date_utc = None - self.start_date_utc = None - self.stop_date_utc = None - self.run_information = None - - -class ExperimentExecutionDetailsListResult(msrest.serialization.Model): - """Model that represents a list of Experiment execution details and a link for pagination. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of Experiment execution details. - :vartype value: list[~chaos_management_client.models.ExperimentExecutionDetails] - :ivar next_link: URL to retrieve the next page of Experiment execution details. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True, 'max_length': 2048, 'min_length': 0}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ExperimentExecutionDetails]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ExperimentExecutionDetailsListResult, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class ExperimentExecutionDetailsPropertiesRunInformation(msrest.serialization.Model): - """The information of the experiment run. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar steps: The steps of the experiment run. - :vartype steps: list[~chaos_management_client.models.StepStatus] - """ - - _validation = { - 'steps': {'readonly': True}, - } - - _attribute_map = { - 'steps': {'key': 'steps', 'type': '[StepStatus]'}, - } - - def __init__( - self, - **kwargs - ): - super(ExperimentExecutionDetailsPropertiesRunInformation, self).__init__(**kwargs) - self.steps = None - - -class ExperimentListResult(msrest.serialization.Model): - """Model that represents a list of Experiment resources and a link for pagination. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of Experiment resources. - :vartype value: list[~chaos_management_client.models.Experiment] - :ivar next_link: URL to retrieve the next page of Experiment resources. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True, 'max_length': 2048, 'min_length': 0}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Experiment]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ExperimentListResult, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class ExperimentStartOperationResult(msrest.serialization.Model): - """Model that represents the result of a start Experiment operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: String of the Experiment name. - :vartype name: str - :ivar status_url: URL to retrieve the Experiment status. - :vartype status_url: str - """ - - _validation = { - 'name': {'readonly': True}, - 'status_url': {'readonly': True, 'max_length': 2048, 'min_length': 0}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'status_url': {'key': 'statusUrl', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ExperimentStartOperationResult, self).__init__(**kwargs) - self.name = None - self.status_url = None - - -class ExperimentStatus(msrest.serialization.Model): - """Model that represents the status of a Experiment. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar type: String of the resource type. - :vartype type: str - :ivar id: String of the fully qualified resource ID. - :vartype id: str - :ivar name: String of the resource name. - :vartype name: str - :ivar status: String that represents the status of a Experiment. - :vartype status: str - :ivar created_date_utc: String that represents the created date time of a Experiment. - :vartype created_date_utc: ~datetime.datetime - :ivar end_date_utc: String that represents the end date time of a Experiment. - :vartype end_date_utc: ~datetime.datetime - """ - - _validation = { - 'type': {'readonly': True}, - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'status': {'readonly': True}, - 'created_date_utc': {'readonly': True}, - 'end_date_utc': {'readonly': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'status': {'key': 'properties.status', 'type': 'str'}, - 'created_date_utc': {'key': 'properties.createdDateUtc', 'type': 'iso-8601'}, - 'end_date_utc': {'key': 'properties.endDateUtc', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(ExperimentStatus, self).__init__(**kwargs) - self.type = None - self.id = None - self.name = None - self.status = None - self.created_date_utc = None - self.end_date_utc = None - - -class ExperimentStatusListResult(msrest.serialization.Model): - """Model that represents a list of Experiment statuses and a link for pagination. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of Experiment statuses. - :vartype value: list[~chaos_management_client.models.ExperimentStatus] - :ivar next_link: URL to retrieve the next page of Experiment statuses. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True, 'max_length': 2048, 'min_length': 0}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ExperimentStatus]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ExperimentStatusListResult, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class KeyValuePair(msrest.serialization.Model): - """A map to describe the settings of an action. - - All required parameters must be populated in order to send to Azure. - - :param key: Required. The name of the setting for the action. - :type key: str - :param value: Required. The value of the setting for the action. - :type value: str - """ - - _validation = { - 'key': {'required': True, 'min_length': 1}, - 'value': {'required': True, 'min_length': 1}, - } - - _attribute_map = { - 'key': {'key': 'key', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(KeyValuePair, self).__init__(**kwargs) - self.key = kwargs['key'] - self.value = kwargs['value'] - - -class Operation(msrest.serialization.Model): - """Details of a REST API operation, returned from the Resource Provider Operations API. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: - "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". - :vartype name: str - :ivar is_data_action: Whether the operation applies to data-plane. This is "true" for - data-plane operations and "false" for ARM/control-plane operations. - :vartype is_data_action: bool - :param display: Localized display information for this particular operation. - :type display: ~chaos_management_client.models.OperationDisplay - :ivar origin: The intended executor of the operation; as in Resource Based Access Control - (RBAC) and audit logs UX. Default value is "user,system". Possible values include: "user", - "system", "user,system". - :vartype origin: str or ~chaos_management_client.models.Origin - :ivar action_type: Enum. Indicates the action type. "Internal" refers to actions that are for - internal only APIs. Possible values include: "Internal". - :vartype action_type: str or ~chaos_management_client.models.ActionType - """ - - _validation = { - 'name': {'readonly': True}, - 'is_data_action': {'readonly': True}, - 'origin': {'readonly': True}, - 'action_type': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, - 'display': {'key': 'display', 'type': 'OperationDisplay'}, - 'origin': {'key': 'origin', 'type': 'str'}, - 'action_type': {'key': 'actionType', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(Operation, self).__init__(**kwargs) - self.name = None - self.is_data_action = None - self.display = kwargs.get('display', None) - self.origin = None - self.action_type = None - - -class OperationDisplay(msrest.serialization.Model): - """Localized display information for this particular operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provider: The localized friendly form of the resource provider name, e.g. "Microsoft - Monitoring Insights" or "Microsoft Compute". - :vartype provider: str - :ivar resource: The localized friendly name of the resource type related to this operation. - E.g. "Virtual Machines" or "Job Schedule Collections". - :vartype resource: str - :ivar operation: The concise, localized friendly name for the operation; suitable for - dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual Machine". - :vartype operation: str - :ivar description: The short, localized friendly description of the operation; suitable for - tool tips and detailed views. - :vartype description: str - """ - - _validation = { - 'provider': {'readonly': True}, - 'resource': {'readonly': True}, - 'operation': {'readonly': True}, - 'description': {'readonly': True}, - } - - _attribute_map = { - 'provider': {'key': 'provider', 'type': 'str'}, - 'resource': {'key': 'resource', 'type': 'str'}, - 'operation': {'key': 'operation', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationDisplay, self).__init__(**kwargs) - self.provider = None - self.resource = None - self.operation = None - self.description = None - - -class OperationListResult(msrest.serialization.Model): - """A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of operations supported by the resource provider. - :vartype value: list[~chaos_management_client.models.Operation] - :ivar next_link: URL to get the next set of operation list results (if there are any). - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Operation]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationListResult, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class ResourceIdentity(msrest.serialization.Model): - """The managed identity of a resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param type: Required. String of the resource identity type. Possible values include: "None", - "SystemAssigned". - :type type: str or ~chaos_management_client.models.ResourceIdentityType - :ivar principal_id: GUID that represents the principal ID of this resource identity. - :vartype principal_id: str - :ivar tenant_id: GUID that represents the tenant ID of this resource identity. - :vartype tenant_id: str - """ - - _validation = { - 'type': {'required': True}, - 'principal_id': {'readonly': True, 'pattern': r'^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$'}, - 'tenant_id': {'readonly': True, 'pattern': r'^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$'}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ResourceIdentity, self).__init__(**kwargs) - self.type = kwargs['type'] - self.principal_id = None - self.tenant_id = None - - -class Selector(msrest.serialization.Model): - """Model that represents a selector in the Experiment resource. - - All required parameters must be populated in order to send to Azure. - - :param type: Required. Enum of the selector type. Possible values include: "Percent", "Random", - "Tag", "List". - :type type: str or ~chaos_management_client.models.SelectorType - :param id: Required. String of the selector ID. - :type id: str - :param targets: Required. List of Target references. - :type targets: list[~chaos_management_client.models.TargetReference] - """ - - _validation = { - 'type': {'required': True}, - 'id': {'required': True, 'min_length': 1}, - 'targets': {'required': True, 'min_items': 1}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'id': {'key': 'id', 'type': 'str'}, - 'targets': {'key': 'targets', 'type': '[TargetReference]'}, - } - - def __init__( - self, - **kwargs - ): - super(Selector, self).__init__(**kwargs) - self.type = kwargs['type'] - self.id = kwargs['id'] - self.targets = kwargs['targets'] - - -class Step(msrest.serialization.Model): - """Model that represents a step in the Experiment resource. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. String of the step name. - :type name: str - :param branches: Required. List of branches. - :type branches: list[~chaos_management_client.models.Branch] - """ - - _validation = { - 'name': {'required': True, 'min_length': 1}, - 'branches': {'required': True, 'min_items': 1}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'branches': {'key': 'branches', 'type': '[Branch]'}, - } - - def __init__( - self, - **kwargs - ): - super(Step, self).__init__(**kwargs) - self.name = kwargs['name'] - self.branches = kwargs['branches'] - - -class StepStatus(msrest.serialization.Model): - """Model that represents the a list of branches and branch statuses. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: The name of the step. - :vartype name: str - :ivar id: The id of the step. - :vartype id: str - :ivar status: The value of the status of the step. - :vartype status: str - :ivar branches: The array of branches. - :vartype branches: list[~chaos_management_client.models.BranchStatus] - """ - - _validation = { - 'name': {'readonly': True}, - 'id': {'readonly': True}, - 'status': {'readonly': True}, - 'branches': {'readonly': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'id': {'key': 'id', 'type': 'str'}, - 'status': {'key': 'status', 'type': 'str'}, - 'branches': {'key': 'branches', 'type': '[BranchStatus]'}, - } - - def __init__( - self, - **kwargs - ): - super(StepStatus, self).__init__(**kwargs) - self.name = None - self.id = None - self.status = None - self.branches = None - - -class SystemData(msrest.serialization.Model): - """Metadata pertaining to creation and last modification of the resource. - - :param created_by: The identity that created the resource. - :type created_by: str - :param created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". - :type created_by_type: str or ~chaos_management_client.models.CreatedByType - :param created_at: The timestamp of resource creation (UTC). - :type created_at: ~datetime.datetime - :param last_modified_by: The identity that last modified the resource. - :type last_modified_by: str - :param last_modified_by_type: The type of identity that last modified the resource. Possible - values include: "User", "Application", "ManagedIdentity", "Key". - :type last_modified_by_type: str or ~chaos_management_client.models.CreatedByType - :param last_modified_at: The timestamp of resource last modification (UTC). - :type last_modified_at: ~datetime.datetime - """ - - _attribute_map = { - 'created_by': {'key': 'createdBy', 'type': 'str'}, - 'created_by_type': {'key': 'createdByType', 'type': 'str'}, - 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, - 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, - 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, - 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(SystemData, self).__init__(**kwargs) - self.created_by = kwargs.get('created_by', None) - self.created_by_type = kwargs.get('created_by_type', None) - self.created_at = kwargs.get('created_at', None) - self.last_modified_by = kwargs.get('last_modified_by', None) - self.last_modified_by_type = kwargs.get('last_modified_by_type', None) - self.last_modified_at = kwargs.get('last_modified_at', None) - - -class Target(Resource): - """Model that represents a Target resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: The system metadata of the target resource. - :vartype system_data: ~chaos_management_client.models.SystemData - :param location: Location of the target resource. - :type location: str - :param properties: Required. The properties of the target resource. - :type properties: dict[str, any] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'properties': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'location': {'key': 'location', 'type': 'str'}, - 'properties': {'key': 'properties', 'type': '{object}'}, - } - - def __init__( - self, - **kwargs - ): - super(Target, self).__init__(**kwargs) - self.system_data = None - self.location = kwargs.get('location', None) - self.properties = kwargs['properties'] - - -class TargetListResult(msrest.serialization.Model): - """Model that represents a list of Target resources and a link for pagination. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of Target resources. - :vartype value: list[~chaos_management_client.models.Target] - :ivar next_link: URL to retrieve the next page of Target resources. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True, 'max_length': 2048, 'min_length': 0}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Target]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TargetListResult, self).__init__(**kwargs) - self.value = None - self.next_link = None - - -class TargetReference(msrest.serialization.Model): - """Model that represents a reference to a Target in the selector. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar type: Enum of the Target reference type. Has constant value: "ChaosTarget". - :vartype type: str - :param id: Required. String of the resource ID of a Target resource. - :type id: str - """ - - _validation = { - 'type': {'required': True, 'constant': True}, - 'id': {'required': True, 'pattern': r'^\/[Ss][Uu][Bb][Ss][Cc][Rr][Ii][Pp][Tt][Ii][Oo][Nn][Ss]\/[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}\/[Rr][Ee][Ss][Oo][Uu][Rr][Cc][Ee][Gg][Rr][Oo][Uu][Pp][Ss]\/[a-zA-Z0-9_\-\.\(\)]*[a-zA-Z0-9_\-\(\)]\/[Pp][Rr][Oo][Vv][Ii][Dd][Ee][Rr][Ss]\/[a-zA-Z0-9]+\.[a-zA-Z0-9]+\/[a-zA-Z0-9_\-\.]+\/[a-zA-Z0-9_\-\.]+\/[Pp][Rr][Oo][Vv][Ii][Dd][Ee][Rr][Ss]\/[Mm][Ii][Cc][Rr][Oo][Ss][Oo][Ff][Tt]\.[Cc][Hh][Aa][Oo][Ss]\/[Tt][Aa][Rr][Gg][Ee][Tt][Ss]\/[a-zA-Z0-9_\-\.]+$'}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - 'id': {'key': 'id', 'type': 'str'}, - } - - type = "ChaosTarget" - - def __init__( - self, - **kwargs - ): - super(TargetReference, self).__init__(**kwargs) - self.id = kwargs['id'] - - -class TargetType(Resource): - """Model that represents a Target Type resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: The system metadata properties of the target type resource. - :vartype system_data: ~chaos_management_client.models.SystemData - :param location: Location of the Target Type resource. - :type location: str - :ivar display_name: Localized string of the display name. - :vartype display_name: str - :ivar description: Localized string of the description. - :vartype description: str - :ivar properties_schema: URL to retrieve JSON schema of the Target Type properties. - :vartype properties_schema: str - :ivar resource_types: List of resource types this Target Type can extend. - :vartype resource_types: list[str] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'system_data': {'readonly': True}, - 'display_name': {'readonly': True}, - 'description': {'readonly': True}, - 'properties_schema': {'readonly': True, 'max_length': 2048, 'min_length': 0}, - 'resource_types': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'location': {'key': 'location', 'type': 'str'}, - 'display_name': {'key': 'properties.displayName', 'type': 'str'}, - 'description': {'key': 'properties.description', 'type': 'str'}, - 'properties_schema': {'key': 'properties.propertiesSchema', 'type': 'str'}, - 'resource_types': {'key': 'properties.resourceTypes', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(TargetType, self).__init__(**kwargs) - self.system_data = None - self.location = kwargs.get('location', None) - self.display_name = None - self.description = None - self.properties_schema = None - self.resource_types = None - - -class TargetTypeListResult(msrest.serialization.Model): - """Model that represents a list of Target Type resources and a link for pagination. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of Target Type resources. - :vartype value: list[~chaos_management_client.models.TargetType] - :ivar next_link: URL to retrieve the next page of Target Type resources. - :vartype next_link: str - """ - - _validation = { - 'value': {'readonly': True}, - 'next_link': {'readonly': True, 'max_length': 2048, 'min_length': 0}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[TargetType]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(TargetTypeListResult, self).__init__(**kwargs) - self.value = None - self.next_link = None diff --git a/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/models/_models_py3.py b/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/models/_models_py3.py index efe187cc1b39..d5ef8ccea7c4 100644 --- a/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/models/_models_py3.py +++ b/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/models/_models_py3.py @@ -23,10 +23,10 @@ class Action(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param type: Required. Enum that discriminates between action models.Constant filled by server. - :type type: str - :param name: Required. String that represents a Capability URN. - :type name: str + :ivar type: Required. Enum that discriminates between action models.Constant filled by server. + :vartype type: str + :ivar name: Required. String that represents a Capability URN. + :vartype name: str """ _validation = { @@ -49,6 +49,10 @@ def __init__( name: str, **kwargs ): + """ + :keyword name: Required. String that represents a Capability URN. + :paramtype name: str + """ super(Action, self).__init__(**kwargs) self.type = None # type: Optional[str] self.name = name @@ -65,15 +69,21 @@ class ActionStatus(msrest.serialization.Model): :vartype id: str :ivar status: The status of the action. :vartype status: str + :ivar start_time: String that represents the start time of the action. + :vartype start_time: ~datetime.datetime + :ivar end_time: String that represents the end time of the action. + :vartype end_time: ~datetime.datetime :ivar targets: The array of targets. :vartype targets: - list[~chaos_management_client.models.ExperimentExecutionActionTargetDetailsProperties] + list[~azure.mgmt.chaos.models.ExperimentExecutionActionTargetDetailsProperties] """ _validation = { 'name': {'readonly': True}, 'id': {'readonly': True}, 'status': {'readonly': True}, + 'start_time': {'readonly': True}, + 'end_time': {'readonly': True}, 'targets': {'readonly': True}, } @@ -81,6 +91,8 @@ class ActionStatus(msrest.serialization.Model): 'name': {'key': 'name', 'type': 'str'}, 'id': {'key': 'id', 'type': 'str'}, 'status': {'key': 'status', 'type': 'str'}, + 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, + 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, 'targets': {'key': 'targets', 'type': '[ExperimentExecutionActionTargetDetailsProperties]'}, } @@ -88,10 +100,14 @@ def __init__( self, **kwargs ): + """ + """ super(ActionStatus, self).__init__(**kwargs) self.name = None self.id = None self.status = None + self.start_time = None + self.end_time = None self.targets = None @@ -100,10 +116,10 @@ class Branch(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. String of the branch name. - :type name: str - :param actions: Required. List of actions. - :type actions: list[~chaos_management_client.models.Action] + :ivar name: Required. String of the branch name. + :vartype name: str + :ivar actions: Required. List of actions. + :vartype actions: list[~azure.mgmt.chaos.models.Action] """ _validation = { @@ -123,6 +139,12 @@ def __init__( actions: List["Action"], **kwargs ): + """ + :keyword name: Required. String of the branch name. + :paramtype name: str + :keyword actions: Required. List of actions. + :paramtype actions: list[~azure.mgmt.chaos.models.Action] + """ super(Branch, self).__init__(**kwargs) self.name = name self.actions = actions @@ -140,7 +162,7 @@ class BranchStatus(msrest.serialization.Model): :ivar status: The status of the branch. :vartype status: str :ivar actions: The array of actions. - :vartype actions: list[~chaos_management_client.models.ActionStatus] + :vartype actions: list[~azure.mgmt.chaos.models.ActionStatus] """ _validation = { @@ -161,6 +183,8 @@ def __init__( self, **kwargs ): + """ + """ super(BranchStatus, self).__init__(**kwargs) self.name = None self.id = None @@ -199,6 +223,8 @@ def __init__( self, **kwargs ): + """ + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -219,7 +245,7 @@ class Capability(Resource): "Microsoft.Storage/storageAccounts". :vartype type: str :ivar system_data: The standard system metadata of a resource type. - :vartype system_data: ~chaos_management_client.models.SystemData + :vartype system_data: ~azure.mgmt.chaos.models.SystemData :ivar publisher: String of the Publisher that this Capability extends. :vartype publisher: str :ivar target_type: String of the Target Type that this Capability extends. @@ -260,6 +286,8 @@ def __init__( self, **kwargs ): + """ + """ super(Capability, self).__init__(**kwargs) self.system_data = None self.publisher = None @@ -275,7 +303,7 @@ class CapabilityListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :ivar value: List of Capability resources. - :vartype value: list[~chaos_management_client.models.Capability] + :vartype value: list[~azure.mgmt.chaos.models.Capability] :ivar next_link: URL to retrieve the next page of Capability resources. :vartype next_link: str """ @@ -294,6 +322,8 @@ def __init__( self, **kwargs ): + """ + """ super(CapabilityListResult, self).__init__(**kwargs) self.value = None self.next_link = None @@ -313,9 +343,9 @@ class CapabilityType(Resource): "Microsoft.Storage/storageAccounts". :vartype type: str :ivar system_data: The system metadata properties of the capability type resource. - :vartype system_data: ~chaos_management_client.models.SystemData - :param location: Location of the Capability Type resource. - :type location: str + :vartype system_data: ~azure.mgmt.chaos.models.SystemData + :ivar location: Location of the Capability Type resource. + :vartype location: str :ivar publisher: String of the Publisher that this Capability Type extends. :vartype publisher: str :ivar target_type: String of the Target Type that this Capability Type extends. @@ -363,6 +393,10 @@ def __init__( location: Optional[str] = None, **kwargs ): + """ + :keyword location: Location of the Capability Type resource. + :paramtype location: str + """ super(CapabilityType, self).__init__(**kwargs) self.system_data = None self.location = location @@ -380,7 +414,7 @@ class CapabilityTypeListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :ivar value: List of Capability Type resources. - :vartype value: list[~chaos_management_client.models.CapabilityType] + :vartype value: list[~azure.mgmt.chaos.models.CapabilityType] :ivar next_link: URL to retrieve the next page of Capability Type resources. :vartype next_link: str """ @@ -399,6 +433,8 @@ def __init__( self, **kwargs ): + """ + """ super(CapabilityTypeListResult, self).__init__(**kwargs) self.value = None self.next_link = None @@ -409,16 +445,16 @@ class ContinuousAction(Action): All required parameters must be populated in order to send to Azure. - :param type: Required. Enum that discriminates between action models.Constant filled by server. - :type type: str - :param name: Required. String that represents a Capability URN. - :type name: str - :param duration: Required. ISO8601 formatted string that represents a duration. - :type duration: str - :param parameters: Required. List of key value pairs. - :type parameters: list[~chaos_management_client.models.KeyValuePair] - :param selector_id: Required. String that represents a selector. - :type selector_id: str + :ivar type: Required. Enum that discriminates between action models.Constant filled by server. + :vartype type: str + :ivar name: Required. String that represents a Capability URN. + :vartype name: str + :ivar duration: Required. ISO8601 formatted string that represents a duration. + :vartype duration: str + :ivar parameters: Required. List of key value pairs. + :vartype parameters: list[~azure.mgmt.chaos.models.KeyValuePair] + :ivar selector_id: Required. String that represents a selector. + :vartype selector_id: str """ _validation = { @@ -446,6 +482,16 @@ def __init__( selector_id: str, **kwargs ): + """ + :keyword name: Required. String that represents a Capability URN. + :paramtype name: str + :keyword duration: Required. ISO8601 formatted string that represents a duration. + :paramtype duration: str + :keyword parameters: Required. List of key value pairs. + :paramtype parameters: list[~azure.mgmt.chaos.models.KeyValuePair] + :keyword selector_id: Required. String that represents a selector. + :paramtype selector_id: str + """ super(ContinuousAction, self).__init__(name=name, **kwargs) self.type = 'continuous' # type: str self.duration = duration @@ -458,12 +504,12 @@ class DelayAction(Action): All required parameters must be populated in order to send to Azure. - :param type: Required. Enum that discriminates between action models.Constant filled by server. - :type type: str - :param name: Required. String that represents a Capability URN. - :type name: str - :param duration: Required. ISO8601 formatted string that represents a duration. - :type duration: str + :ivar type: Required. Enum that discriminates between action models.Constant filled by server. + :vartype type: str + :ivar name: Required. String that represents a Capability URN. + :vartype name: str + :ivar duration: Required. ISO8601 formatted string that represents a duration. + :vartype duration: str """ _validation = { @@ -485,6 +531,12 @@ def __init__( duration: str, **kwargs ): + """ + :keyword name: Required. String that represents a Capability URN. + :paramtype name: str + :keyword duration: Required. ISO8601 formatted string that represents a duration. + :paramtype duration: str + """ super(DelayAction, self).__init__(name=name, **kwargs) self.type = 'delay' # type: str self.duration = duration @@ -495,14 +547,14 @@ class DiscreteAction(Action): All required parameters must be populated in order to send to Azure. - :param type: Required. Enum that discriminates between action models.Constant filled by server. - :type type: str - :param name: Required. String that represents a Capability URN. - :type name: str - :param parameters: Required. List of key value pairs. - :type parameters: list[~chaos_management_client.models.KeyValuePair] - :param selector_id: Required. String that represents a selector. - :type selector_id: str + :ivar type: Required. Enum that discriminates between action models.Constant filled by server. + :vartype type: str + :ivar name: Required. String that represents a Capability URN. + :vartype name: str + :ivar parameters: Required. List of key value pairs. + :vartype parameters: list[~azure.mgmt.chaos.models.KeyValuePair] + :ivar selector_id: Required. String that represents a selector. + :vartype selector_id: str """ _validation = { @@ -527,6 +579,14 @@ def __init__( selector_id: str, **kwargs ): + """ + :keyword name: Required. String that represents a Capability URN. + :paramtype name: str + :keyword parameters: Required. List of key value pairs. + :paramtype parameters: list[~azure.mgmt.chaos.models.KeyValuePair] + :keyword selector_id: Required. String that represents a selector. + :paramtype selector_id: str + """ super(DiscreteAction, self).__init__(name=name, **kwargs) self.type = 'discrete' # type: str self.parameters = parameters @@ -558,6 +618,8 @@ def __init__( self, **kwargs ): + """ + """ super(ErrorAdditionalInfo, self).__init__(**kwargs) self.type = None self.info = None @@ -575,9 +637,9 @@ class ErrorDetail(msrest.serialization.Model): :ivar target: The error target. :vartype target: str :ivar details: The error details. - :vartype details: list[~chaos_management_client.models.ErrorDetail] + :vartype details: list[~azure.mgmt.chaos.models.ErrorDetail] :ivar additional_info: The error additional info. - :vartype additional_info: list[~chaos_management_client.models.ErrorAdditionalInfo] + :vartype additional_info: list[~azure.mgmt.chaos.models.ErrorAdditionalInfo] """ _validation = { @@ -600,6 +662,8 @@ def __init__( self, **kwargs ): + """ + """ super(ErrorDetail, self).__init__(**kwargs) self.code = None self.message = None @@ -611,8 +675,8 @@ def __init__( class ErrorResponse(msrest.serialization.Model): """Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This also follows the OData error response format.). - :param error: The error object. - :type error: ~chaos_management_client.models.ErrorDetail + :ivar error: The error object. + :vartype error: ~azure.mgmt.chaos.models.ErrorDetail """ _attribute_map = { @@ -625,6 +689,10 @@ def __init__( error: Optional["ErrorDetail"] = None, **kwargs ): + """ + :keyword error: The error object. + :paramtype error: ~azure.mgmt.chaos.models.ErrorDetail + """ super(ErrorResponse, self).__init__(**kwargs) self.error = error @@ -644,10 +712,10 @@ class TrackedResource(Resource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str """ _validation = { @@ -672,6 +740,12 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + """ super(TrackedResource, self).__init__(**kwargs) self.tags = tags self.location = location @@ -692,21 +766,21 @@ class Experiment(TrackedResource): :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". :vartype type: str - :param tags: A set of tags. Resource tags. - :type tags: dict[str, str] - :param location: Required. The geo-location where the resource lives. - :type location: str + :ivar tags: A set of tags. Resource tags. + :vartype tags: dict[str, str] + :ivar location: Required. The geo-location where the resource lives. + :vartype location: str :ivar system_data: The system metadata of the experiment resource. - :vartype system_data: ~chaos_management_client.models.SystemData - :param identity: The identity of the experiment resource. - :type identity: ~chaos_management_client.models.ResourceIdentity - :param steps: Required. List of steps. - :type steps: list[~chaos_management_client.models.Step] - :param selectors: Required. List of selectors. - :type selectors: list[~chaos_management_client.models.Selector] - :param start_on_creation: A boolean value that indicates if experiment should be started on + :vartype system_data: ~azure.mgmt.chaos.models.SystemData + :ivar identity: The identity of the experiment resource. + :vartype identity: ~azure.mgmt.chaos.models.ResourceIdentity + :ivar steps: Required. List of steps. + :vartype steps: list[~azure.mgmt.chaos.models.Step] + :ivar selectors: Required. List of selectors. + :vartype selectors: list[~azure.mgmt.chaos.models.Selector] + :ivar start_on_creation: A boolean value that indicates if experiment should be started on creation or not. - :type start_on_creation: bool + :vartype start_on_creation: bool """ _validation = { @@ -743,6 +817,21 @@ def __init__( start_on_creation: Optional[bool] = None, **kwargs ): + """ + :keyword tags: A set of tags. Resource tags. + :paramtype tags: dict[str, str] + :keyword location: Required. The geo-location where the resource lives. + :paramtype location: str + :keyword identity: The identity of the experiment resource. + :paramtype identity: ~azure.mgmt.chaos.models.ResourceIdentity + :keyword steps: Required. List of steps. + :paramtype steps: list[~azure.mgmt.chaos.models.Step] + :keyword selectors: Required. List of selectors. + :paramtype selectors: list[~azure.mgmt.chaos.models.Selector] + :keyword start_on_creation: A boolean value that indicates if experiment should be started on + creation or not. + :paramtype start_on_creation: bool + """ super(Experiment, self).__init__(tags=tags, location=location, **kwargs) self.system_data = None self.identity = identity @@ -776,6 +865,8 @@ def __init__( self, **kwargs ): + """ + """ super(ExperimentCancelOperationResult, self).__init__(**kwargs) self.name = None self.status_url = None @@ -806,6 +897,8 @@ def __init__( self, **kwargs ): + """ + """ super(ExperimentExecutionActionTargetDetailsError, self).__init__(**kwargs) self.code = None self.message = None @@ -825,7 +918,7 @@ class ExperimentExecutionActionTargetDetailsProperties(msrest.serialization.Mode :ivar completed_date_utc: String that represents the completed date time. :vartype completed_date_utc: ~datetime.datetime :ivar error: The error of the action. - :vartype error: ~chaos_management_client.models.ExperimentExecutionActionTargetDetailsError + :vartype error: ~azure.mgmt.chaos.models.ExperimentExecutionActionTargetDetailsError """ _validation = { @@ -848,6 +941,8 @@ def __init__( self, **kwargs ): + """ + """ super(ExperimentExecutionActionTargetDetailsProperties, self).__init__(**kwargs) self.status = None self.target = None @@ -883,7 +978,7 @@ class ExperimentExecutionDetails(msrest.serialization.Model): :vartype stop_date_utc: ~datetime.datetime :ivar run_information: The information of the experiment run. :vartype run_information: - ~chaos_management_client.models.ExperimentExecutionDetailsPropertiesRunInformation + ~azure.mgmt.chaos.models.ExperimentExecutionDetailsPropertiesRunInformation """ _validation = { @@ -918,6 +1013,8 @@ def __init__( self, **kwargs ): + """ + """ super(ExperimentExecutionDetails, self).__init__(**kwargs) self.type = None self.id = None @@ -938,7 +1035,7 @@ class ExperimentExecutionDetailsListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :ivar value: List of Experiment execution details. - :vartype value: list[~chaos_management_client.models.ExperimentExecutionDetails] + :vartype value: list[~azure.mgmt.chaos.models.ExperimentExecutionDetails] :ivar next_link: URL to retrieve the next page of Experiment execution details. :vartype next_link: str """ @@ -957,6 +1054,8 @@ def __init__( self, **kwargs ): + """ + """ super(ExperimentExecutionDetailsListResult, self).__init__(**kwargs) self.value = None self.next_link = None @@ -968,7 +1067,7 @@ class ExperimentExecutionDetailsPropertiesRunInformation(msrest.serialization.Mo Variables are only populated by the server, and will be ignored when sending a request. :ivar steps: The steps of the experiment run. - :vartype steps: list[~chaos_management_client.models.StepStatus] + :vartype steps: list[~azure.mgmt.chaos.models.StepStatus] """ _validation = { @@ -983,6 +1082,8 @@ def __init__( self, **kwargs ): + """ + """ super(ExperimentExecutionDetailsPropertiesRunInformation, self).__init__(**kwargs) self.steps = None @@ -993,7 +1094,7 @@ class ExperimentListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :ivar value: List of Experiment resources. - :vartype value: list[~chaos_management_client.models.Experiment] + :vartype value: list[~azure.mgmt.chaos.models.Experiment] :ivar next_link: URL to retrieve the next page of Experiment resources. :vartype next_link: str """ @@ -1012,6 +1113,8 @@ def __init__( self, **kwargs ): + """ + """ super(ExperimentListResult, self).__init__(**kwargs) self.value = None self.next_link = None @@ -1042,6 +1145,8 @@ def __init__( self, **kwargs ): + """ + """ super(ExperimentStartOperationResult, self).__init__(**kwargs) self.name = None self.status_url = None @@ -1088,6 +1193,8 @@ def __init__( self, **kwargs ): + """ + """ super(ExperimentStatus, self).__init__(**kwargs) self.type = None self.id = None @@ -1103,7 +1210,7 @@ class ExperimentStatusListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :ivar value: List of Experiment statuses. - :vartype value: list[~chaos_management_client.models.ExperimentStatus] + :vartype value: list[~azure.mgmt.chaos.models.ExperimentStatus] :ivar next_link: URL to retrieve the next page of Experiment statuses. :vartype next_link: str """ @@ -1122,6 +1229,8 @@ def __init__( self, **kwargs ): + """ + """ super(ExperimentStatusListResult, self).__init__(**kwargs) self.value = None self.next_link = None @@ -1132,10 +1241,10 @@ class KeyValuePair(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param key: Required. The name of the setting for the action. - :type key: str - :param value: Required. The value of the setting for the action. - :type value: str + :ivar key: Required. The name of the setting for the action. + :vartype key: str + :ivar value: Required. The value of the setting for the action. + :vartype value: str """ _validation = { @@ -1155,6 +1264,12 @@ def __init__( value: str, **kwargs ): + """ + :keyword key: Required. The name of the setting for the action. + :paramtype key: str + :keyword value: Required. The value of the setting for the action. + :paramtype value: str + """ super(KeyValuePair, self).__init__(**kwargs) self.key = key self.value = value @@ -1171,15 +1286,15 @@ class Operation(msrest.serialization.Model): :ivar is_data_action: Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for ARM/control-plane operations. :vartype is_data_action: bool - :param display: Localized display information for this particular operation. - :type display: ~chaos_management_client.models.OperationDisplay + :ivar display: Localized display information for this particular operation. + :vartype display: ~azure.mgmt.chaos.models.OperationDisplay :ivar origin: The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system". Possible values include: "user", "system", "user,system". - :vartype origin: str or ~chaos_management_client.models.Origin + :vartype origin: str or ~azure.mgmt.chaos.models.Origin :ivar action_type: Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. Possible values include: "Internal". - :vartype action_type: str or ~chaos_management_client.models.ActionType + :vartype action_type: str or ~azure.mgmt.chaos.models.ActionType """ _validation = { @@ -1203,6 +1318,10 @@ def __init__( display: Optional["OperationDisplay"] = None, **kwargs ): + """ + :keyword display: Localized display information for this particular operation. + :paramtype display: ~azure.mgmt.chaos.models.OperationDisplay + """ super(Operation, self).__init__(**kwargs) self.name = None self.is_data_action = None @@ -1248,6 +1367,8 @@ def __init__( self, **kwargs ): + """ + """ super(OperationDisplay, self).__init__(**kwargs) self.provider = None self.resource = None @@ -1261,7 +1382,7 @@ class OperationListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :ivar value: List of operations supported by the resource provider. - :vartype value: list[~chaos_management_client.models.Operation] + :vartype value: list[~azure.mgmt.chaos.models.Operation] :ivar next_link: URL to get the next set of operation list results (if there are any). :vartype next_link: str """ @@ -1280,6 +1401,8 @@ def __init__( self, **kwargs ): + """ + """ super(OperationListResult, self).__init__(**kwargs) self.value = None self.next_link = None @@ -1292,9 +1415,9 @@ class ResourceIdentity(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param type: Required. String of the resource identity type. Possible values include: "None", + :ivar type: Required. String of the resource identity type. Possible values include: "None", "SystemAssigned". - :type type: str or ~chaos_management_client.models.ResourceIdentityType + :vartype type: str or ~azure.mgmt.chaos.models.ResourceIdentityType :ivar principal_id: GUID that represents the principal ID of this resource identity. :vartype principal_id: str :ivar tenant_id: GUID that represents the tenant ID of this resource identity. @@ -1319,6 +1442,11 @@ def __init__( type: Union[str, "ResourceIdentityType"], **kwargs ): + """ + :keyword type: Required. String of the resource identity type. Possible values include: "None", + "SystemAssigned". + :paramtype type: str or ~azure.mgmt.chaos.models.ResourceIdentityType + """ super(ResourceIdentity, self).__init__(**kwargs) self.type = type self.principal_id = None @@ -1330,13 +1458,13 @@ class Selector(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param type: Required. Enum of the selector type. Possible values include: "Percent", "Random", + :ivar type: Required. Enum of the selector type. Possible values include: "Percent", "Random", "Tag", "List". - :type type: str or ~chaos_management_client.models.SelectorType - :param id: Required. String of the selector ID. - :type id: str - :param targets: Required. List of Target references. - :type targets: list[~chaos_management_client.models.TargetReference] + :vartype type: str or ~azure.mgmt.chaos.models.SelectorType + :ivar id: Required. String of the selector ID. + :vartype id: str + :ivar targets: Required. List of Target references. + :vartype targets: list[~azure.mgmt.chaos.models.TargetReference] """ _validation = { @@ -1359,6 +1487,15 @@ def __init__( targets: List["TargetReference"], **kwargs ): + """ + :keyword type: Required. Enum of the selector type. Possible values include: "Percent", + "Random", "Tag", "List". + :paramtype type: str or ~azure.mgmt.chaos.models.SelectorType + :keyword id: Required. String of the selector ID. + :paramtype id: str + :keyword targets: Required. List of Target references. + :paramtype targets: list[~azure.mgmt.chaos.models.TargetReference] + """ super(Selector, self).__init__(**kwargs) self.type = type self.id = id @@ -1370,10 +1507,10 @@ class Step(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. String of the step name. - :type name: str - :param branches: Required. List of branches. - :type branches: list[~chaos_management_client.models.Branch] + :ivar name: Required. String of the step name. + :vartype name: str + :ivar branches: Required. List of branches. + :vartype branches: list[~azure.mgmt.chaos.models.Branch] """ _validation = { @@ -1393,6 +1530,12 @@ def __init__( branches: List["Branch"], **kwargs ): + """ + :keyword name: Required. String of the step name. + :paramtype name: str + :keyword branches: Required. List of branches. + :paramtype branches: list[~azure.mgmt.chaos.models.Branch] + """ super(Step, self).__init__(**kwargs) self.name = name self.branches = branches @@ -1410,7 +1553,7 @@ class StepStatus(msrest.serialization.Model): :ivar status: The value of the status of the step. :vartype status: str :ivar branches: The array of branches. - :vartype branches: list[~chaos_management_client.models.BranchStatus] + :vartype branches: list[~azure.mgmt.chaos.models.BranchStatus] """ _validation = { @@ -1431,6 +1574,8 @@ def __init__( self, **kwargs ): + """ + """ super(StepStatus, self).__init__(**kwargs) self.name = None self.id = None @@ -1441,20 +1586,20 @@ def __init__( class SystemData(msrest.serialization.Model): """Metadata pertaining to creation and last modification of the resource. - :param created_by: The identity that created the resource. - :type created_by: str - :param created_by_type: The type of identity that created the resource. Possible values - include: "User", "Application", "ManagedIdentity", "Key". - :type created_by_type: str or ~chaos_management_client.models.CreatedByType - :param created_at: The timestamp of resource creation (UTC). - :type created_at: ~datetime.datetime - :param last_modified_by: The identity that last modified the resource. - :type last_modified_by: str - :param last_modified_by_type: The type of identity that last modified the resource. Possible + :ivar created_by: The identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource. Possible values include: + "User", "Application", "ManagedIdentity", "Key". + :vartype created_by_type: str or ~azure.mgmt.chaos.models.CreatedByType + :ivar created_at: The timestamp of resource creation (UTC). + :vartype created_at: ~datetime.datetime + :ivar last_modified_by: The identity that last modified the resource. + :vartype last_modified_by: str + :ivar last_modified_by_type: The type of identity that last modified the resource. Possible values include: "User", "Application", "ManagedIdentity", "Key". - :type last_modified_by_type: str or ~chaos_management_client.models.CreatedByType - :param last_modified_at: The timestamp of resource last modification (UTC). - :type last_modified_at: ~datetime.datetime + :vartype last_modified_by_type: str or ~azure.mgmt.chaos.models.CreatedByType + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime """ _attribute_map = { @@ -1477,6 +1622,22 @@ def __init__( last_modified_at: Optional[datetime.datetime] = None, **kwargs ): + """ + :keyword created_by: The identity that created the resource. + :paramtype created_by: str + :keyword created_by_type: The type of identity that created the resource. Possible values + include: "User", "Application", "ManagedIdentity", "Key". + :paramtype created_by_type: str or ~azure.mgmt.chaos.models.CreatedByType + :keyword created_at: The timestamp of resource creation (UTC). + :paramtype created_at: ~datetime.datetime + :keyword last_modified_by: The identity that last modified the resource. + :paramtype last_modified_by: str + :keyword last_modified_by_type: The type of identity that last modified the resource. Possible + values include: "User", "Application", "ManagedIdentity", "Key". + :paramtype last_modified_by_type: str or ~azure.mgmt.chaos.models.CreatedByType + :keyword last_modified_at: The timestamp of resource last modification (UTC). + :paramtype last_modified_at: ~datetime.datetime + """ super(SystemData, self).__init__(**kwargs) self.created_by = created_by self.created_by_type = created_by_type @@ -1502,11 +1663,11 @@ class Target(Resource): "Microsoft.Storage/storageAccounts". :vartype type: str :ivar system_data: The system metadata of the target resource. - :vartype system_data: ~chaos_management_client.models.SystemData - :param location: Location of the target resource. - :type location: str - :param properties: Required. The properties of the target resource. - :type properties: dict[str, any] + :vartype system_data: ~azure.mgmt.chaos.models.SystemData + :ivar location: Location of the target resource. + :vartype location: str + :ivar properties: Required. The properties of the target resource. + :vartype properties: dict[str, any] """ _validation = { @@ -1533,6 +1694,12 @@ def __init__( location: Optional[str] = None, **kwargs ): + """ + :keyword location: Location of the target resource. + :paramtype location: str + :keyword properties: Required. The properties of the target resource. + :paramtype properties: dict[str, any] + """ super(Target, self).__init__(**kwargs) self.system_data = None self.location = location @@ -1545,7 +1712,7 @@ class TargetListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :ivar value: List of Target resources. - :vartype value: list[~chaos_management_client.models.Target] + :vartype value: list[~azure.mgmt.chaos.models.Target] :ivar next_link: URL to retrieve the next page of Target resources. :vartype next_link: str """ @@ -1564,6 +1731,8 @@ def __init__( self, **kwargs ): + """ + """ super(TargetListResult, self).__init__(**kwargs) self.value = None self.next_link = None @@ -1578,8 +1747,8 @@ class TargetReference(msrest.serialization.Model): :ivar type: Enum of the Target reference type. Has constant value: "ChaosTarget". :vartype type: str - :param id: Required. String of the resource ID of a Target resource. - :type id: str + :ivar id: Required. String of the resource ID of a Target resource. + :vartype id: str """ _validation = { @@ -1600,6 +1769,10 @@ def __init__( id: str, **kwargs ): + """ + :keyword id: Required. String of the resource ID of a Target resource. + :paramtype id: str + """ super(TargetReference, self).__init__(**kwargs) self.id = id @@ -1618,9 +1791,9 @@ class TargetType(Resource): "Microsoft.Storage/storageAccounts". :vartype type: str :ivar system_data: The system metadata properties of the target type resource. - :vartype system_data: ~chaos_management_client.models.SystemData - :param location: Location of the Target Type resource. - :type location: str + :vartype system_data: ~azure.mgmt.chaos.models.SystemData + :ivar location: Location of the Target Type resource. + :vartype location: str :ivar display_name: Localized string of the display name. :vartype display_name: str :ivar description: Localized string of the description. @@ -1660,6 +1833,10 @@ def __init__( location: Optional[str] = None, **kwargs ): + """ + :keyword location: Location of the Target Type resource. + :paramtype location: str + """ super(TargetType, self).__init__(**kwargs) self.system_data = None self.location = location @@ -1675,7 +1852,7 @@ class TargetTypeListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :ivar value: List of Target Type resources. - :vartype value: list[~chaos_management_client.models.TargetType] + :vartype value: list[~azure.mgmt.chaos.models.TargetType] :ivar next_link: URL to retrieve the next page of Target Type resources. :vartype next_link: str """ @@ -1694,6 +1871,8 @@ def __init__( self, **kwargs ): + """ + """ super(TargetTypeListResult, self).__init__(**kwargs) self.value = None self.next_link = None diff --git a/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/operations/_capabilities_operations.py b/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/operations/_capabilities_operations.py index b7e8c3655f70..872d1ad326cd 100644 --- a/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/operations/_capabilities_operations.py +++ b/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/operations/_capabilities_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,23 +6,211 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + resource_group_name: str, + parent_provider_namespace: str, + parent_resource_type: str, + parent_resource_name: str, + target_name: str, + *, + continuation_token_parameter: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-09-15-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{parentProviderNamespace}/{parentResourceType}/{parentResourceName}/providers/Microsoft.Chaos/targets/{targetName}/capabilities") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', pattern=r'^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.\(\)]*[a-zA-Z0-9_\-\(\)]$'), + "parentProviderNamespace": _SERIALIZER.url("parent_provider_namespace", parent_provider_namespace, 'str', pattern=r'^[a-zA-Z0-9]+\.[a-zA-Z0-9]+$'), + "parentResourceType": _SERIALIZER.url("parent_resource_type", parent_resource_type, 'str', pattern=r'^[a-zA-Z0-9_\-\.]+$'), + "parentResourceName": _SERIALIZER.url("parent_resource_name", parent_resource_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.]+$'), + "targetName": _SERIALIZER.url("target_name", target_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.]+$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if continuation_token_parameter is not None: + _query_parameters['continuationToken'] = _SERIALIZER.query("continuation_token_parameter", continuation_token_parameter, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + parent_provider_namespace: str, + parent_resource_type: str, + parent_resource_name: str, + target_name: str, + capability_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-09-15-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{parentProviderNamespace}/{parentResourceType}/{parentResourceName}/providers/Microsoft.Chaos/targets/{targetName}/capabilities/{capabilityName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', pattern=r'^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.\(\)]*[a-zA-Z0-9_\-\(\)]$'), + "parentProviderNamespace": _SERIALIZER.url("parent_provider_namespace", parent_provider_namespace, 'str', pattern=r'^[a-zA-Z0-9]+\.[a-zA-Z0-9]+$'), + "parentResourceType": _SERIALIZER.url("parent_resource_type", parent_resource_type, 'str', pattern=r'^[a-zA-Z0-9_\-\.]+$'), + "parentResourceName": _SERIALIZER.url("parent_resource_name", parent_resource_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.]+$'), + "targetName": _SERIALIZER.url("target_name", target_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.]+$'), + "capabilityName": _SERIALIZER.url("capability_name", capability_name, 'str', pattern=r'^[a-zA-Z0-9\-\.]+-\d\.\d$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_delete_request( + subscription_id: str, + resource_group_name: str, + parent_provider_namespace: str, + parent_resource_type: str, + parent_resource_name: str, + target_name: str, + capability_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-09-15-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{parentProviderNamespace}/{parentResourceType}/{parentResourceName}/providers/Microsoft.Chaos/targets/{targetName}/capabilities/{capabilityName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', pattern=r'^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.\(\)]*[a-zA-Z0-9_\-\(\)]$'), + "parentProviderNamespace": _SERIALIZER.url("parent_provider_namespace", parent_provider_namespace, 'str', pattern=r'^[a-zA-Z0-9]+\.[a-zA-Z0-9]+$'), + "parentResourceType": _SERIALIZER.url("parent_resource_type", parent_resource_type, 'str', pattern=r'^[a-zA-Z0-9_\-\.]+$'), + "parentResourceName": _SERIALIZER.url("parent_resource_name", parent_resource_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.]+$'), + "targetName": _SERIALIZER.url("target_name", target_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.]+$'), + "capabilityName": _SERIALIZER.url("capability_name", capability_name, 'str', pattern=r'^[a-zA-Z0-9\-\.]+-\d\.\d$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + subscription_id: str, + resource_group_name: str, + parent_provider_namespace: str, + parent_resource_type: str, + parent_resource_name: str, + target_name: str, + capability_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-09-15-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{parentProviderNamespace}/{parentResourceType}/{parentResourceName}/providers/Microsoft.Chaos/targets/{targetName}/capabilities/{capabilityName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', pattern=r'^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.\(\)]*[a-zA-Z0-9_\-\(\)]$'), + "parentProviderNamespace": _SERIALIZER.url("parent_provider_namespace", parent_provider_namespace, 'str', pattern=r'^[a-zA-Z0-9]+\.[a-zA-Z0-9]+$'), + "parentResourceType": _SERIALIZER.url("parent_resource_type", parent_resource_type, 'str', pattern=r'^[a-zA-Z0-9_\-\.]+$'), + "parentResourceName": _SERIALIZER.url("parent_resource_name", parent_resource_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.]+$'), + "targetName": _SERIALIZER.url("target_name", target_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.]+$'), + "capabilityName": _SERIALIZER.url("capability_name", capability_name, 'str', pattern=r'^[a-zA-Z0-9\-\.]+-\d\.\d$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) class CapabilitiesOperations(object): """CapabilitiesOperations operations. @@ -30,7 +219,7 @@ class CapabilitiesOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~chaos_management_client.models + :type models: ~azure.mgmt.chaos.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -45,17 +234,17 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - parent_provider_namespace, # type: str - parent_resource_type, # type: str - parent_resource_name, # type: str - target_name, # type: str - continuation_token_parameter=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.CapabilityListResult"] + resource_group_name: str, + parent_provider_namespace: str, + parent_resource_type: str, + parent_resource_name: str, + target_name: str, + continuation_token_parameter: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.CapabilityListResult"]: """Get a list of Capability resources that extend a Target resource.. :param resource_group_name: String that represents an Azure resource group. @@ -68,53 +257,59 @@ def list( :type parent_resource_name: str :param target_name: String that represents a Target resource name. :type target_name: str - :param continuation_token_parameter: String that sets the continuation token. + :param continuation_token_parameter: String that sets the continuation token. Default value is + None. :type continuation_token_parameter: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either CapabilityListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~chaos_management_client.models.CapabilityListResult] + :return: An iterator like instance of either CapabilityListResult or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.chaos.models.CapabilityListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-15-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.CapabilityListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-15-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.\(\)]*[a-zA-Z0-9_\-\(\)]$'), - 'parentProviderNamespace': self._serialize.url("parent_provider_namespace", parent_provider_namespace, 'str', pattern=r'^[a-zA-Z0-9]+\.[a-zA-Z0-9]+$'), - 'parentResourceType': self._serialize.url("parent_resource_type", parent_resource_type, 'str', pattern=r'^[a-zA-Z0-9_\-\.]+$'), - 'parentResourceName': self._serialize.url("parent_resource_name", parent_resource_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.]+$'), - 'targetName': self._serialize.url("target_name", target_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.]+$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if continuation_token_parameter is not None: - query_parameters['continuationToken'] = self._serialize.query("continuation_token_parameter", continuation_token_parameter, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + parent_provider_namespace=parent_provider_namespace, + parent_resource_type=parent_resource_type, + parent_resource_name=parent_resource_name, + target_name=target_name, + api_version=api_version, + continuation_token_parameter=continuation_token_parameter, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + parent_provider_namespace=parent_provider_namespace, + parent_resource_type=parent_resource_type, + parent_resource_name=parent_resource_name, + target_name=target_name, + api_version=api_version, + continuation_token_parameter=continuation_token_parameter, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('CapabilityListResult', pipeline_response) + deserialized = self._deserialize("CapabilityListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -123,32 +318,37 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{parentProviderNamespace}/{parentResourceType}/{parentResourceName}/providers/Microsoft.Chaos/targets/{targetName}/capabilities'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{parentProviderNamespace}/{parentResourceType}/{parentResourceName}/providers/Microsoft.Chaos/targets/{targetName}/capabilities"} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - parent_provider_namespace, # type: str - parent_resource_type, # type: str - parent_resource_name, # type: str - target_name, # type: str - capability_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Capability" + resource_group_name: str, + parent_provider_namespace: str, + parent_resource_type: str, + parent_resource_name: str, + target_name: str, + capability_name: str, + **kwargs: Any + ) -> "_models.Capability": """Get a Capability resource that extends a Target resource. :param resource_group_name: String that represents an Azure resource group. @@ -165,7 +365,7 @@ def get( :type capability_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: Capability, or the result of cls(response) - :rtype: ~chaos_management_client.models.Capability + :rtype: ~azure.mgmt.chaos.models.Capability :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.Capability"] @@ -173,37 +373,34 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-15-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.\(\)]*[a-zA-Z0-9_\-\(\)]$'), - 'parentProviderNamespace': self._serialize.url("parent_provider_namespace", parent_provider_namespace, 'str', pattern=r'^[a-zA-Z0-9]+\.[a-zA-Z0-9]+$'), - 'parentResourceType': self._serialize.url("parent_resource_type", parent_resource_type, 'str', pattern=r'^[a-zA-Z0-9_\-\.]+$'), - 'parentResourceName': self._serialize.url("parent_resource_name", parent_resource_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.]+$'), - 'targetName': self._serialize.url("target_name", target_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.]+$'), - 'capabilityName': self._serialize.url("capability_name", capability_name, 'str', pattern=r'^[a-zA-Z0-9\-\.]+-\d\.\d$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2021-09-15-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + parent_provider_namespace=parent_provider_namespace, + parent_resource_type=parent_resource_type, + parent_resource_name=parent_resource_name, + target_name=target_name, + capability_name=capability_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Capability', pipeline_response) @@ -212,19 +409,21 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{parentProviderNamespace}/{parentResourceType}/{parentResourceName}/providers/Microsoft.Chaos/targets/{targetName}/capabilities/{capabilityName}'} # type: ignore - def delete( + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{parentProviderNamespace}/{parentResourceType}/{parentResourceName}/providers/Microsoft.Chaos/targets/{targetName}/capabilities/{capabilityName}"} # type: ignore + + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - parent_provider_namespace, # type: str - parent_resource_type, # type: str - parent_resource_name, # type: str - target_name, # type: str - capability_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + parent_provider_namespace: str, + parent_resource_type: str, + parent_resource_name: str, + target_name: str, + capability_name: str, + **kwargs: Any + ) -> None: """Delete a Capability that extends a Target resource. :param resource_group_name: String that represents an Azure resource group. @@ -249,56 +448,54 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-15-preview" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.\(\)]*[a-zA-Z0-9_\-\(\)]$'), - 'parentProviderNamespace': self._serialize.url("parent_provider_namespace", parent_provider_namespace, 'str', pattern=r'^[a-zA-Z0-9]+\.[a-zA-Z0-9]+$'), - 'parentResourceType': self._serialize.url("parent_resource_type", parent_resource_type, 'str', pattern=r'^[a-zA-Z0-9_\-\.]+$'), - 'parentResourceName': self._serialize.url("parent_resource_name", parent_resource_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.]+$'), - 'targetName': self._serialize.url("target_name", target_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.]+$'), - 'capabilityName': self._serialize.url("capability_name", capability_name, 'str', pattern=r'^[a-zA-Z0-9\-\.]+-\d\.\d$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2021-09-15-preview") # type: str + + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + parent_provider_namespace=parent_provider_namespace, + parent_resource_type=parent_resource_type, + parent_resource_name=parent_resource_name, + target_name=target_name, + capability_name=capability_name, + api_version=api_version, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{parentProviderNamespace}/{parentResourceType}/{parentResourceName}/providers/Microsoft.Chaos/targets/{targetName}/capabilities/{capabilityName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{parentProviderNamespace}/{parentResourceType}/{parentResourceName}/providers/Microsoft.Chaos/targets/{targetName}/capabilities/{capabilityName}"} # type: ignore + + @distributed_trace def create_or_update( self, - resource_group_name, # type: str - parent_provider_namespace, # type: str - parent_resource_type, # type: str - parent_resource_name, # type: str - target_name, # type: str - capability_name, # type: str - capability, # type: "_models.Capability" - **kwargs # type: Any - ): - # type: (...) -> "_models.Capability" + resource_group_name: str, + parent_provider_namespace: str, + parent_resource_type: str, + parent_resource_name: str, + target_name: str, + capability_name: str, + capability: "_models.Capability", + **kwargs: Any + ) -> "_models.Capability": """Create or update a Capability resource that extends a Target resource. :param resource_group_name: String that represents an Azure resource group. @@ -314,10 +511,10 @@ def create_or_update( :param capability_name: String that represents a Capability resource name. :type capability_name: str :param capability: Capability resource to be created or updated. - :type capability: ~chaos_management_client.models.Capability + :type capability: ~azure.mgmt.chaos.models.Capability :keyword callable cls: A custom type or function that will be passed the direct response :return: Capability, or the result of cls(response) - :rtype: ~chaos_management_client.models.Capability + :rtype: ~azure.mgmt.chaos.models.Capability :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.Capability"] @@ -325,42 +522,38 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-15-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.\(\)]*[a-zA-Z0-9_\-\(\)]$'), - 'parentProviderNamespace': self._serialize.url("parent_provider_namespace", parent_provider_namespace, 'str', pattern=r'^[a-zA-Z0-9]+\.[a-zA-Z0-9]+$'), - 'parentResourceType': self._serialize.url("parent_resource_type", parent_resource_type, 'str', pattern=r'^[a-zA-Z0-9_\-\.]+$'), - 'parentResourceName': self._serialize.url("parent_resource_name", parent_resource_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.]+$'), - 'targetName': self._serialize.url("target_name", target_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.]+$'), - 'capabilityName': self._serialize.url("capability_name", capability_name, 'str', pattern=r'^[a-zA-Z0-9\-\.]+-\d\.\d$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(capability, 'Capability') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-09-15-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(capability, 'Capability') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + parent_provider_namespace=parent_provider_namespace, + parent_resource_type=parent_resource_type, + parent_resource_name=parent_resource_name, + target_name=target_name, + capability_name=capability_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Capability', pipeline_response) @@ -369,4 +562,6 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{parentProviderNamespace}/{parentResourceType}/{parentResourceName}/providers/Microsoft.Chaos/targets/{targetName}/capabilities/{capabilityName}'} # type: ignore + + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{parentProviderNamespace}/{parentResourceType}/{parentResourceName}/providers/Microsoft.Chaos/targets/{targetName}/capabilities/{capabilityName}"} # type: ignore + diff --git a/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/operations/_capability_types_operations.py b/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/operations/_capability_types_operations.py index 844c13f7de4c..051cc328bb08 100644 --- a/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/operations/_capability_types_operations.py +++ b/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/operations/_capability_types_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,23 +6,102 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + location_name: str, + target_type_name: str, + *, + continuation_token_parameter: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-09-15-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Chaos/locations/{locationName}/targetTypes/{targetTypeName}/capabilityTypes") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', pattern=r'^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$'), + "locationName": _SERIALIZER.url("location_name", location_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.]+$'), + "targetTypeName": _SERIALIZER.url("target_type_name", target_type_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.]+$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if continuation_token_parameter is not None: + _query_parameters['continuationToken'] = _SERIALIZER.query("continuation_token_parameter", continuation_token_parameter, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + location_name: str, + target_type_name: str, + capability_type_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-09-15-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Chaos/locations/{locationName}/targetTypes/{targetTypeName}/capabilityTypes/{capabilityTypeName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', pattern=r'^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$'), + "locationName": _SERIALIZER.url("location_name", location_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.]+$'), + "targetTypeName": _SERIALIZER.url("target_type_name", target_type_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.]+$'), + "capabilityTypeName": _SERIALIZER.url("capability_type_name", capability_type_name, 'str', pattern=r'^[a-zA-Z0-9\-\.]+-\d\.\d$'), + } + + _url = _format_url_section(_url, **path_format_arguments) -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) class CapabilityTypesOperations(object): """CapabilityTypesOperations operations. @@ -30,7 +110,7 @@ class CapabilityTypesOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~chaos_management_client.models + :type models: ~azure.mgmt.chaos.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -45,64 +125,67 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - location_name, # type: str - target_type_name, # type: str - continuation_token_parameter=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.CapabilityTypeListResult"] + location_name: str, + target_type_name: str, + continuation_token_parameter: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.CapabilityTypeListResult"]: """Get a list of Capability Type resources for given Target Type and location. :param location_name: String that represents a Location resource name. :type location_name: str :param target_type_name: String that represents a Target Type resource name. :type target_type_name: str - :param continuation_token_parameter: String that sets the continuation token. + :param continuation_token_parameter: String that sets the continuation token. Default value is + None. :type continuation_token_parameter: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either CapabilityTypeListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~chaos_management_client.models.CapabilityTypeListResult] + :return: An iterator like instance of either CapabilityTypeListResult or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.chaos.models.CapabilityTypeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-15-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.CapabilityTypeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-15-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$'), - 'locationName': self._serialize.url("location_name", location_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.]+$'), - 'targetTypeName': self._serialize.url("target_type_name", target_type_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.]+$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if continuation_token_parameter is not None: - query_parameters['continuationToken'] = self._serialize.query("continuation_token_parameter", continuation_token_parameter, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + location_name=location_name, + target_type_name=target_type_name, + api_version=api_version, + continuation_token_parameter=continuation_token_parameter, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + location_name=location_name, + target_type_name=target_type_name, + api_version=api_version, + continuation_token_parameter=continuation_token_parameter, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('CapabilityTypeListResult', pipeline_response) + deserialized = self._deserialize("CapabilityTypeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -111,29 +194,34 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Chaos/locations/{locationName}/targetTypes/{targetTypeName}/capabilityTypes'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Chaos/locations/{locationName}/targetTypes/{targetTypeName}/capabilityTypes"} # type: ignore + @distributed_trace def get( self, - location_name, # type: str - target_type_name, # type: str - capability_type_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.CapabilityType" + location_name: str, + target_type_name: str, + capability_type_name: str, + **kwargs: Any + ) -> "_models.CapabilityType": """Get a Capability Type resource for given Target Type and location. :param location_name: String that represents a Location resource name. @@ -144,7 +232,7 @@ def get( :type capability_type_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: CapabilityType, or the result of cls(response) - :rtype: ~chaos_management_client.models.CapabilityType + :rtype: ~azure.mgmt.chaos.models.CapabilityType :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.CapabilityType"] @@ -152,34 +240,31 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-15-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$'), - 'locationName': self._serialize.url("location_name", location_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.]+$'), - 'targetTypeName': self._serialize.url("target_type_name", target_type_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.]+$'), - 'capabilityTypeName': self._serialize.url("capability_type_name", capability_type_name, 'str', pattern=r'^[a-zA-Z0-9\-\.]+-\d\.\d$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2021-09-15-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + location_name=location_name, + target_type_name=target_type_name, + capability_type_name=capability_type_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('CapabilityType', pipeline_response) @@ -188,4 +273,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Chaos/locations/{locationName}/targetTypes/{targetTypeName}/capabilityTypes/{capabilityTypeName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Chaos/locations/{locationName}/targetTypes/{targetTypeName}/capabilityTypes/{capabilityTypeName}"} # type: ignore + diff --git a/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/operations/_experiments_operations.py b/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/operations/_experiments_operations.py index ed9410549e6b..19ec7c6e346e 100644 --- a/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/operations/_experiments_operations.py +++ b/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/operations/_experiments_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,25 +6,443 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_all_request( + subscription_id: str, + *, + running: Optional[bool] = None, + continuation_token_parameter: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-09-15-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Chaos/experiments") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', pattern=r'^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if running is not None: + _query_parameters['running'] = _SERIALIZER.query("running", running, 'bool') + if continuation_token_parameter is not None: + _query_parameters['continuationToken'] = _SERIALIZER.query("continuation_token_parameter", continuation_token_parameter, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + *, + running: Optional[bool] = None, + continuation_token_parameter: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-09-15-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', pattern=r'^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.\(\)]*[a-zA-Z0-9_\-\(\)]$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if running is not None: + _query_parameters['running'] = _SERIALIZER.query("running", running, 'bool') + if continuation_token_parameter is not None: + _query_parameters['continuationToken'] = _SERIALIZER.query("continuation_token_parameter", continuation_token_parameter, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_delete_request( + subscription_id: str, + resource_group_name: str, + experiment_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-09-15-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', pattern=r'^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.\(\)]*[a-zA-Z0-9_\-\(\)]$'), + "experimentName": _SERIALIZER.url("experiment_name", experiment_name, 'str', min_length=1, pattern=r'^[^<>%&:?#/\\]+$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + experiment_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-09-15-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', pattern=r'^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.\(\)]*[a-zA-Z0-9_\-\(\)]$'), + "experimentName": _SERIALIZER.url("experiment_name", experiment_name, 'str', min_length=1, pattern=r'^[^<>%&:?#/\\]+$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + experiment_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-09-15-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', pattern=r'^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.\(\)]*[a-zA-Z0-9_\-\(\)]$'), + "experimentName": _SERIALIZER.url("experiment_name", experiment_name, 'str', min_length=1, pattern=r'^[^<>%&:?#/\\]+$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_cancel_request_initial( + subscription_id: str, + resource_group_name: str, + experiment_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-09-15-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/cancel") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', pattern=r'^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.\(\)]*[a-zA-Z0-9_\-\(\)]$'), + "experimentName": _SERIALIZER.url("experiment_name", experiment_name, 'str', min_length=1, pattern=r'^[^<>%&:?#/\\]+$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_start_request( + subscription_id: str, + resource_group_name: str, + experiment_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-09-15-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/start") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', pattern=r'^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.\(\)]*[a-zA-Z0-9_\-\(\)]$'), + "experimentName": _SERIALIZER.url("experiment_name", experiment_name, 'str', min_length=1, pattern=r'^[^<>%&:?#/\\]+$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_all_statuses_request( + subscription_id: str, + resource_group_name: str, + experiment_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-09-15-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/statuses") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', pattern=r'^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.\(\)]*[a-zA-Z0-9_\-\(\)]$'), + "experimentName": _SERIALIZER.url("experiment_name", experiment_name, 'str', min_length=1, pattern=r'^[^<>%&:?#/\\]+$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_status_request( + subscription_id: str, + resource_group_name: str, + experiment_name: str, + status_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-09-15-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/statuses/{statusId}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', pattern=r'^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.\(\)]*[a-zA-Z0-9_\-\(\)]$'), + "experimentName": _SERIALIZER.url("experiment_name", experiment_name, 'str', min_length=1, pattern=r'^[^<>%&:?#/\\]+$'), + "statusId": _SERIALIZER.url("status_id", status_id, 'str', pattern=r'^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_execution_details_request( + subscription_id: str, + resource_group_name: str, + experiment_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-09-15-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/executionDetails") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', pattern=r'^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.\(\)]*[a-zA-Z0-9_\-\(\)]$'), + "experimentName": _SERIALIZER.url("experiment_name", experiment_name, 'str', min_length=1, pattern=r'^[^<>%&:?#/\\]+$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_execution_details_request( + subscription_id: str, + resource_group_name: str, + experiment_name: str, + execution_details_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-09-15-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/executionDetails/{executionDetailsId}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', pattern=r'^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.\(\)]*[a-zA-Z0-9_\-\(\)]$'), + "experimentName": _SERIALIZER.url("experiment_name", experiment_name, 'str', min_length=1, pattern=r'^[^<>%&:?#/\\]+$'), + "executionDetailsId": _SERIALIZER.url("execution_details_id", execution_details_id, 'str', pattern=r'^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) class ExperimentsOperations(object): """ExperimentsOperations operations. @@ -32,7 +451,7 @@ class ExperimentsOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~chaos_management_client.models + :type models: ~azure.mgmt.chaos.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -47,62 +466,64 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_all( self, - running=None, # type: Optional[bool] - continuation_token_parameter=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ExperimentListResult"] + running: Optional[bool] = None, + continuation_token_parameter: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.ExperimentListResult"]: """Get a list of Experiment resources in a subscription. :param running: Optional value that indicates whether to filter results based on if the - Experiment is currently running. If null, then the results will not be filtered. + Experiment is currently running. If null, then the results will not be filtered. Default value + is None. :type running: bool - :param continuation_token_parameter: String that sets the continuation token. + :param continuation_token_parameter: String that sets the continuation token. Default value is + None. :type continuation_token_parameter: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ExperimentListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~chaos_management_client.models.ExperimentListResult] + :return: An iterator like instance of either ExperimentListResult or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.chaos.models.ExperimentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-15-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ExperimentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-15-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_all.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if running is not None: - query_parameters['running'] = self._serialize.query("running", running, 'bool') - if continuation_token_parameter is not None: - query_parameters['continuationToken'] = self._serialize.query("continuation_token_parameter", continuation_token_parameter, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + running=running, + continuation_token_parameter=continuation_token_parameter, + template_url=self.list_all.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_all_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + running=running, + continuation_token_parameter=continuation_token_parameter, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ExperimentListResult', pipeline_response) + deserialized = self._deserialize("ExperimentListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -111,81 +532,89 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) - list_all.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Chaos/experiments'} # type: ignore + list_all.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Chaos/experiments"} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - running=None, # type: Optional[bool] - continuation_token_parameter=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ExperimentListResult"] + resource_group_name: str, + running: Optional[bool] = None, + continuation_token_parameter: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.ExperimentListResult"]: """Get a list of Experiment resources in a resource group. :param resource_group_name: String that represents an Azure resource group. :type resource_group_name: str :param running: Optional value that indicates whether to filter results based on if the - Experiment is currently running. If null, then the results will not be filtered. + Experiment is currently running. If null, then the results will not be filtered. Default value + is None. :type running: bool - :param continuation_token_parameter: String that sets the continuation token. + :param continuation_token_parameter: String that sets the continuation token. Default value is + None. :type continuation_token_parameter: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ExperimentListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~chaos_management_client.models.ExperimentListResult] + :return: An iterator like instance of either ExperimentListResult or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.chaos.models.ExperimentListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-15-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ExperimentListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-15-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.\(\)]*[a-zA-Z0-9_\-\(\)]$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if running is not None: - query_parameters['running'] = self._serialize.query("running", running, 'bool') - if continuation_token_parameter is not None: - query_parameters['continuationToken'] = self._serialize.query("continuation_token_parameter", continuation_token_parameter, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + running=running, + continuation_token_parameter=continuation_token_parameter, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + api_version=api_version, + running=running, + continuation_token_parameter=continuation_token_parameter, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ExperimentListResult', pipeline_response) + deserialized = self._deserialize("ExperimentListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -194,28 +623,33 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments"} # type: ignore - def delete( + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - experiment_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + experiment_name: str, + **kwargs: Any + ) -> None: """Delete a Experiment resource. :param resource_group_name: String that represents an Azure resource group. @@ -232,47 +666,45 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-15-preview" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.\(\)]*[a-zA-Z0-9_\-\(\)]$'), - 'experimentName': self._serialize.url("experiment_name", experiment_name, 'str', min_length=1, pattern=r'^[a-zA-Z0-9_\-\.]+$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2021-09-15-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + experiment_name=experiment_name, + api_version=api_version, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}"} # type: ignore + + @distributed_trace def get( self, - resource_group_name, # type: str - experiment_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Experiment" + resource_group_name: str, + experiment_name: str, + **kwargs: Any + ) -> "_models.Experiment": """Get a Experiment resource. :param resource_group_name: String that represents an Azure resource group. @@ -281,7 +713,7 @@ def get( :type experiment_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: Experiment, or the result of cls(response) - :rtype: ~chaos_management_client.models.Experiment + :rtype: ~azure.mgmt.chaos.models.Experiment :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.Experiment"] @@ -289,33 +721,30 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-15-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.\(\)]*[a-zA-Z0-9_\-\(\)]$'), - 'experimentName': self._serialize.url("experiment_name", experiment_name, 'str', min_length=1, pattern=r'^[a-zA-Z0-9_\-\.]+$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2021-09-15-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + experiment_name=experiment_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Experiment', pipeline_response) @@ -324,54 +753,50 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}"} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - experiment_name, # type: str - experiment, # type: "_models.Experiment" - **kwargs # type: Any - ): - # type: (...) -> "_models.Experiment" + resource_group_name: str, + experiment_name: str, + experiment: "_models.Experiment", + **kwargs: Any + ) -> "_models.Experiment": cls = kwargs.pop('cls', None) # type: ClsType["_models.Experiment"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-15-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.\(\)]*[a-zA-Z0-9_\-\(\)]$'), - 'experimentName': self._serialize.url("experiment_name", experiment_name, 'str', min_length=1, pattern=r'^[a-zA-Z0-9_\-\.]+$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(experiment, 'Experiment') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-09-15-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(experiment, 'Experiment') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + experiment_name=experiment_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = self._deserialize('Experiment', pipeline_response) @@ -379,16 +804,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}"} # type: ignore + + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - experiment_name, # type: str - experiment, # type: "_models.Experiment" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Experiment"] + resource_group_name: str, + experiment_name: str, + experiment: "_models.Experiment", + **kwargs: Any + ) -> LROPoller["_models.Experiment"]: """Create or update a Experiment resource. :param resource_group_name: String that represents an Azure resource group. @@ -396,17 +823,21 @@ def begin_create_or_update( :param experiment_name: String that represents a Experiment resource name. :type experiment_name: str :param experiment: Experiment resource to be created or updated. - :type experiment: ~chaos_management_client.models.Experiment + :type experiment: ~azure.mgmt.chaos.models.Experiment :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Experiment or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~chaos_management_client.models.Experiment] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.chaos.models.Experiment] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-15-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Experiment"] lro_delay = kwargs.pop( @@ -419,27 +850,22 @@ def begin_create_or_update( resource_group_name=resource_group_name, experiment_name=experiment_name, experiment=experiment, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Experiment', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.\(\)]*[a-zA-Z0-9_\-\(\)]$'), - 'experimentName': self._serialize.url("experiment_name", experiment_name, 'str', min_length=1, pattern=r'^[a-zA-Z0-9_\-\.]+$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'original-uri'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'original-uri'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -449,50 +875,45 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}"} # type: ignore def _cancel_initial( self, - resource_group_name, # type: str - experiment_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ExperimentCancelOperationResult" + resource_group_name: str, + experiment_name: str, + **kwargs: Any + ) -> "_models.ExperimentCancelOperationResult": cls = kwargs.pop('cls', None) # type: ClsType["_models.ExperimentCancelOperationResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-15-preview" - accept = "application/json" - - # Construct URL - url = self._cancel_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.\(\)]*[a-zA-Z0-9_\-\(\)]$'), - 'experimentName': self._serialize.url("experiment_name", experiment_name, 'str', min_length=1, pattern=r'^[a-zA-Z0-9_\-\.]+$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2021-09-15-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_cancel_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + experiment_name=experiment_name, + api_version=api_version, + template_url=self._cancel_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = self._deserialize('ExperimentCancelOperationResult', pipeline_response) @@ -500,15 +921,17 @@ def _cancel_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _cancel_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/cancel'} # type: ignore + _cancel_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/cancel"} # type: ignore + + + @distributed_trace def begin_cancel( self, - resource_group_name, # type: str - experiment_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ExperimentCancelOperationResult"] + resource_group_name: str, + experiment_name: str, + **kwargs: Any + ) -> LROPoller["_models.ExperimentCancelOperationResult"]: """Cancel a running Experiment resource. :param resource_group_name: String that represents an Azure resource group. @@ -517,14 +940,18 @@ def begin_cancel( :type experiment_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either ExperimentCancelOperationResult or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~chaos_management_client.models.ExperimentCancelOperationResult] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ExperimentCancelOperationResult or the + result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.chaos.models.ExperimentCancelOperationResult] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-15-preview") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ExperimentCancelOperationResult"] lro_delay = kwargs.pop( @@ -536,27 +963,21 @@ def begin_cancel( raw_result = self._cancel_initial( resource_group_name=resource_group_name, experiment_name=experiment_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ExperimentCancelOperationResult', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.\(\)]*[a-zA-Z0-9_\-\(\)]$'), - 'experimentName': self._serialize.url("experiment_name", experiment_name, 'str', min_length=1, pattern=r'^[a-zA-Z0-9_\-\.]+$'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'original-uri'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'original-uri'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -566,17 +987,17 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_cancel.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/cancel'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_cancel.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/cancel"} # type: ignore + + @distributed_trace def start( self, - resource_group_name, # type: str - experiment_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ExperimentStartOperationResult" + resource_group_name: str, + experiment_name: str, + **kwargs: Any + ) -> "_models.ExperimentStartOperationResult": """Start a Experiment resource. :param resource_group_name: String that represents an Azure resource group. @@ -585,7 +1006,7 @@ def start( :type experiment_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ExperimentStartOperationResult, or the result of cls(response) - :rtype: ~chaos_management_client.models.ExperimentStartOperationResult + :rtype: ~azure.mgmt.chaos.models.ExperimentStartOperationResult :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ExperimentStartOperationResult"] @@ -593,33 +1014,30 @@ def start( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-15-preview" - accept = "application/json" - - # Construct URL - url = self.start.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.\(\)]*[a-zA-Z0-9_\-\(\)]$'), - 'experimentName': self._serialize.url("experiment_name", experiment_name, 'str', min_length=1, pattern=r'^[a-zA-Z0-9_\-\.]+$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2021-09-15-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_start_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + experiment_name=experiment_name, + api_version=api_version, + template_url=self.start.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.post(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ExperimentStartOperationResult', pipeline_response) @@ -628,15 +1046,17 @@ def start( return cls(pipeline_response, deserialized, {}) return deserialized - start.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/start'} # type: ignore + start.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/start"} # type: ignore + + + @distributed_trace def list_all_statuses( self, - resource_group_name, # type: str - experiment_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ExperimentStatusListResult"] + resource_group_name: str, + experiment_name: str, + **kwargs: Any + ) -> Iterable["_models.ExperimentStatusListResult"]: """Get a list of statuses of a Experiment resource. :param resource_group_name: String that represents an Azure resource group. @@ -644,45 +1064,47 @@ def list_all_statuses( :param experiment_name: String that represents a Experiment resource name. :type experiment_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ExperimentStatusListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~chaos_management_client.models.ExperimentStatusListResult] + :return: An iterator like instance of either ExperimentStatusListResult or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.chaos.models.ExperimentStatusListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-15-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ExperimentStatusListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-15-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_all_statuses.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.\(\)]*[a-zA-Z0-9_\-\(\)]$'), - 'experimentName': self._serialize.url("experiment_name", experiment_name, 'str', min_length=1, pattern=r'^[a-zA-Z0-9_\-\.]+$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_all_statuses_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + experiment_name=experiment_name, + api_version=api_version, + template_url=self.list_all_statuses.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_all_statuses_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + experiment_name=experiment_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ExperimentStatusListResult', pipeline_response) + deserialized = self._deserialize("ExperimentStatusListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -691,29 +1113,34 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) - list_all_statuses.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/statuses'} # type: ignore + list_all_statuses.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/statuses"} # type: ignore + @distributed_trace def get_status( self, - resource_group_name, # type: str - experiment_name, # type: str - status_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ExperimentStatus" + resource_group_name: str, + experiment_name: str, + status_id: str, + **kwargs: Any + ) -> "_models.ExperimentStatus": """Get a status of a Experiment resource. :param resource_group_name: String that represents an Azure resource group. @@ -724,7 +1151,7 @@ def get_status( :type status_id: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ExperimentStatus, or the result of cls(response) - :rtype: ~chaos_management_client.models.ExperimentStatus + :rtype: ~azure.mgmt.chaos.models.ExperimentStatus :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ExperimentStatus"] @@ -732,34 +1159,31 @@ def get_status( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-15-preview" - accept = "application/json" - - # Construct URL - url = self.get_status.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.\(\)]*[a-zA-Z0-9_\-\(\)]$'), - 'experimentName': self._serialize.url("experiment_name", experiment_name, 'str', min_length=1, pattern=r'^[a-zA-Z0-9_\-\.]+$'), - 'statusId': self._serialize.url("status_id", status_id, 'str', pattern=r'^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2021-09-15-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_status_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + experiment_name=experiment_name, + status_id=status_id, + api_version=api_version, + template_url=self.get_status.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ExperimentStatus', pipeline_response) @@ -768,15 +1192,17 @@ def get_status( return cls(pipeline_response, deserialized, {}) return deserialized - get_status.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/statuses/{statusId}'} # type: ignore + get_status.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/statuses/{statusId}"} # type: ignore + + + @distributed_trace def list_execution_details( self, - resource_group_name, # type: str - experiment_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ExperimentExecutionDetailsListResult"] + resource_group_name: str, + experiment_name: str, + **kwargs: Any + ) -> Iterable["_models.ExperimentExecutionDetailsListResult"]: """Get a list of execution details of a Experiment resource. :param resource_group_name: String that represents an Azure resource group. @@ -784,45 +1210,48 @@ def list_execution_details( :param experiment_name: String that represents a Experiment resource name. :type experiment_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ExperimentExecutionDetailsListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~chaos_management_client.models.ExperimentExecutionDetailsListResult] + :return: An iterator like instance of either ExperimentExecutionDetailsListResult or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~azure.mgmt.chaos.models.ExperimentExecutionDetailsListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-15-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ExperimentExecutionDetailsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-15-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_execution_details.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.\(\)]*[a-zA-Z0-9_\-\(\)]$'), - 'experimentName': self._serialize.url("experiment_name", experiment_name, 'str', min_length=1, pattern=r'^[a-zA-Z0-9_\-\.]+$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_execution_details_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + experiment_name=experiment_name, + api_version=api_version, + template_url=self.list_execution_details.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_execution_details_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + experiment_name=experiment_name, + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('ExperimentExecutionDetailsListResult', pipeline_response) + deserialized = self._deserialize("ExperimentExecutionDetailsListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -831,29 +1260,34 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) - list_execution_details.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/executionDetails'} # type: ignore + list_execution_details.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/executionDetails"} # type: ignore + @distributed_trace def get_execution_details( self, - resource_group_name, # type: str - experiment_name, # type: str - execution_details_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ExperimentExecutionDetails" + resource_group_name: str, + experiment_name: str, + execution_details_id: str, + **kwargs: Any + ) -> "_models.ExperimentExecutionDetails": """Get an execution detail of a Experiment resource. :param resource_group_name: String that represents an Azure resource group. @@ -864,7 +1298,7 @@ def get_execution_details( :type execution_details_id: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ExperimentExecutionDetails, or the result of cls(response) - :rtype: ~chaos_management_client.models.ExperimentExecutionDetails + :rtype: ~azure.mgmt.chaos.models.ExperimentExecutionDetails :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ExperimentExecutionDetails"] @@ -872,34 +1306,31 @@ def get_execution_details( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-15-preview" - accept = "application/json" - - # Construct URL - url = self.get_execution_details.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.\(\)]*[a-zA-Z0-9_\-\(\)]$'), - 'experimentName': self._serialize.url("experiment_name", experiment_name, 'str', min_length=1, pattern=r'^[a-zA-Z0-9_\-\.]+$'), - 'executionDetailsId': self._serialize.url("execution_details_id", execution_details_id, 'str', pattern=r'^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2021-09-15-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_execution_details_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + experiment_name=experiment_name, + execution_details_id=execution_details_id, + api_version=api_version, + template_url=self.get_execution_details.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ExperimentExecutionDetails', pipeline_response) @@ -908,4 +1339,6 @@ def get_execution_details( return cls(pipeline_response, deserialized, {}) return deserialized - get_execution_details.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/executionDetails/{executionDetailsId}'} # type: ignore + + get_execution_details.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Chaos/experiments/{experimentName}/executionDetails/{executionDetailsId}"} # type: ignore + diff --git a/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/operations/_operations.py b/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/operations/_operations.py index f9c85feec236..631341b5709b 100644 --- a/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/operations/_operations.py +++ b/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/operations/_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,23 +6,50 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_all_request( + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-09-15-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/providers/Microsoft.Chaos/operations") + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) class Operations(object): """Operations operations. @@ -30,7 +58,7 @@ class Operations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~chaos_management_client.models + :type models: ~azure.mgmt.chaos.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -45,47 +73,48 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_all( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.OperationListResult"] + **kwargs: Any + ) -> Iterable["_models.OperationListResult"]: """Get a list all available Operations. :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~chaos_management_client.models.OperationListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.chaos.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-15-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-15-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list_all.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_all_request( + api_version=api_version, + template_url=self.list_all.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_all_request( + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('OperationListResult', pipeline_response) + deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -94,17 +123,22 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) - list_all.metadata = {'url': '/providers/Microsoft.Chaos/operations'} # type: ignore + list_all.metadata = {'url': "/providers/Microsoft.Chaos/operations"} # type: ignore diff --git a/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/operations/_target_types_operations.py b/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/operations/_target_types_operations.py index 31127b8e1ae6..cc558897549f 100644 --- a/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/operations/_target_types_operations.py +++ b/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/operations/_target_types_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,23 +6,98 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + location_name: str, + *, + continuation_token_parameter: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-09-15-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Chaos/locations/{locationName}/targetTypes") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', pattern=r'^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$'), + "locationName": _SERIALIZER.url("location_name", location_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.]+$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if continuation_token_parameter is not None: + _query_parameters['continuationToken'] = _SERIALIZER.query("continuation_token_parameter", continuation_token_parameter, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + location_name: str, + target_type_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-09-15-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.Chaos/locations/{locationName}/targetTypes/{targetTypeName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', pattern=r'^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$'), + "locationName": _SERIALIZER.url("location_name", location_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.]+$'), + "targetTypeName": _SERIALIZER.url("target_type_name", target_type_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.]+$'), + } + + _url = _format_url_section(_url, **path_format_arguments) -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) class TargetTypesOperations(object): """TargetTypesOperations operations. @@ -30,7 +106,7 @@ class TargetTypesOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~chaos_management_client.models + :type models: ~azure.mgmt.chaos.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -45,60 +121,62 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - location_name, # type: str - continuation_token_parameter=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.TargetTypeListResult"] + location_name: str, + continuation_token_parameter: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.TargetTypeListResult"]: """Get a list of Target Type resources for given location. :param location_name: String that represents a Location resource name. :type location_name: str - :param continuation_token_parameter: String that sets the continuation token. + :param continuation_token_parameter: String that sets the continuation token. Default value is + None. :type continuation_token_parameter: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either TargetTypeListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~chaos_management_client.models.TargetTypeListResult] + :return: An iterator like instance of either TargetTypeListResult or the result of + cls(response) + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.chaos.models.TargetTypeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-15-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.TargetTypeListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-15-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$'), - 'locationName': self._serialize.url("location_name", location_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.]+$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if continuation_token_parameter is not None: - query_parameters['continuationToken'] = self._serialize.query("continuation_token_parameter", continuation_token_parameter, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + location_name=location_name, + api_version=api_version, + continuation_token_parameter=continuation_token_parameter, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + location_name=location_name, + api_version=api_version, + continuation_token_parameter=continuation_token_parameter, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('TargetTypeListResult', pipeline_response) + deserialized = self._deserialize("TargetTypeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -107,28 +185,33 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Chaos/locations/{locationName}/targetTypes'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Chaos/locations/{locationName}/targetTypes"} # type: ignore + @distributed_trace def get( self, - location_name, # type: str - target_type_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.TargetType" + location_name: str, + target_type_name: str, + **kwargs: Any + ) -> "_models.TargetType": """Get a Target Type resources for given location. :param location_name: String that represents a Location resource name. @@ -137,7 +220,7 @@ def get( :type target_type_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: TargetType, or the result of cls(response) - :rtype: ~chaos_management_client.models.TargetType + :rtype: ~azure.mgmt.chaos.models.TargetType :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.TargetType"] @@ -145,33 +228,30 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-15-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$'), - 'locationName': self._serialize.url("location_name", location_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.]+$'), - 'targetTypeName': self._serialize.url("target_type_name", target_type_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.]+$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2021-09-15-preview") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + location_name=location_name, + target_type_name=target_type_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('TargetType', pipeline_response) @@ -180,4 +260,6 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.Chaos/locations/{locationName}/targetTypes/{targetTypeName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.Chaos/locations/{locationName}/targetTypes/{targetTypeName}"} # type: ignore + diff --git a/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/operations/_targets_operations.py b/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/operations/_targets_operations.py index d7a993a2ddf2..15d43e7b2bb1 100644 --- a/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/operations/_targets_operations.py +++ b/sdk/chaos/azure-mgmt-chaos/azure/mgmt/chaos/operations/_targets_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,23 +6,203 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + subscription_id: str, + resource_group_name: str, + parent_provider_namespace: str, + parent_resource_type: str, + parent_resource_name: str, + *, + continuation_token_parameter: Optional[str] = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-09-15-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{parentProviderNamespace}/{parentResourceType}/{parentResourceName}/providers/Microsoft.Chaos/targets") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', pattern=r'^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.\(\)]*[a-zA-Z0-9_\-\(\)]$'), + "parentProviderNamespace": _SERIALIZER.url("parent_provider_namespace", parent_provider_namespace, 'str', pattern=r'^[a-zA-Z0-9]+\.[a-zA-Z0-9]+$'), + "parentResourceType": _SERIALIZER.url("parent_resource_type", parent_resource_type, 'str', pattern=r'^[a-zA-Z0-9_\-\.]+$'), + "parentResourceName": _SERIALIZER.url("parent_resource_name", parent_resource_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.]+$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + if continuation_token_parameter is not None: + _query_parameters['continuationToken'] = _SERIALIZER.query("continuation_token_parameter", continuation_token_parameter, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + parent_provider_namespace: str, + parent_resource_type: str, + parent_resource_name: str, + target_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-09-15-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{parentProviderNamespace}/{parentResourceType}/{parentResourceName}/providers/Microsoft.Chaos/targets/{targetName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', pattern=r'^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.\(\)]*[a-zA-Z0-9_\-\(\)]$'), + "parentProviderNamespace": _SERIALIZER.url("parent_provider_namespace", parent_provider_namespace, 'str', pattern=r'^[a-zA-Z0-9]+\.[a-zA-Z0-9]+$'), + "parentResourceType": _SERIALIZER.url("parent_resource_type", parent_resource_type, 'str', pattern=r'^[a-zA-Z0-9_\-\.]+$'), + "parentResourceName": _SERIALIZER.url("parent_resource_name", parent_resource_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.]+$'), + "targetName": _SERIALIZER.url("target_name", target_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.]+$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_delete_request( + subscription_id: str, + resource_group_name: str, + parent_provider_namespace: str, + parent_resource_type: str, + parent_resource_name: str, + target_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-09-15-preview") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{parentProviderNamespace}/{parentResourceType}/{parentResourceName}/providers/Microsoft.Chaos/targets/{targetName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', pattern=r'^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.\(\)]*[a-zA-Z0-9_\-\(\)]$'), + "parentProviderNamespace": _SERIALIZER.url("parent_provider_namespace", parent_provider_namespace, 'str', pattern=r'^[a-zA-Z0-9]+\.[a-zA-Z0-9]+$'), + "parentResourceType": _SERIALIZER.url("parent_resource_type", parent_resource_type, 'str', pattern=r'^[a-zA-Z0-9_\-\.]+$'), + "parentResourceName": _SERIALIZER.url("parent_resource_name", parent_resource_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.]+$'), + "targetName": _SERIALIZER.url("target_name", target_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.]+$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + subscription_id: str, + resource_group_name: str, + parent_provider_namespace: str, + parent_resource_type: str, + parent_resource_name: str, + target_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-09-15-preview") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{parentProviderNamespace}/{parentResourceType}/{parentResourceName}/providers/Microsoft.Chaos/targets/{targetName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str', pattern=r'^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.\(\)]*[a-zA-Z0-9_\-\(\)]$'), + "parentProviderNamespace": _SERIALIZER.url("parent_provider_namespace", parent_provider_namespace, 'str', pattern=r'^[a-zA-Z0-9]+\.[a-zA-Z0-9]+$'), + "parentResourceType": _SERIALIZER.url("parent_resource_type", parent_resource_type, 'str', pattern=r'^[a-zA-Z0-9_\-\.]+$'), + "parentResourceName": _SERIALIZER.url("parent_resource_name", parent_resource_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.]+$'), + "targetName": _SERIALIZER.url("target_name", target_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.]+$'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) class TargetsOperations(object): """TargetsOperations operations. @@ -30,7 +211,7 @@ class TargetsOperations(object): instantiates it for you and attaches it as an attribute. :ivar models: Alias to model classes used in this operation group. - :type models: ~chaos_management_client.models + :type models: ~azure.mgmt.chaos.models :param client: Client for service requests. :param config: Configuration of service client. :param serializer: An object model serializer. @@ -45,16 +226,16 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - resource_group_name, # type: str - parent_provider_namespace, # type: str - parent_resource_type, # type: str - parent_resource_name, # type: str - continuation_token_parameter=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.TargetListResult"] + resource_group_name: str, + parent_provider_namespace: str, + parent_resource_type: str, + parent_resource_name: str, + continuation_token_parameter: Optional[str] = None, + **kwargs: Any + ) -> Iterable["_models.TargetListResult"]: """Get a list of Target resources that extend a tracked regional resource. :param resource_group_name: String that represents an Azure resource group. @@ -65,52 +246,56 @@ def list( :type parent_resource_type: str :param parent_resource_name: String that represents a resource name. :type parent_resource_name: str - :param continuation_token_parameter: String that sets the continuation token. + :param continuation_token_parameter: String that sets the continuation token. Default value is + None. :type continuation_token_parameter: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either TargetListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~chaos_management_client.models.TargetListResult] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.chaos.models.TargetListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-09-15-preview") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.TargetListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-15-preview" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.\(\)]*[a-zA-Z0-9_\-\(\)]$'), - 'parentProviderNamespace': self._serialize.url("parent_provider_namespace", parent_provider_namespace, 'str', pattern=r'^[a-zA-Z0-9]+\.[a-zA-Z0-9]+$'), - 'parentResourceType': self._serialize.url("parent_resource_type", parent_resource_type, 'str', pattern=r'^[a-zA-Z0-9_\-\.]+$'), - 'parentResourceName': self._serialize.url("parent_resource_name", parent_resource_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.]+$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - if continuation_token_parameter is not None: - query_parameters['continuationToken'] = self._serialize.query("continuation_token_parameter", continuation_token_parameter, 'str') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + parent_provider_namespace=parent_provider_namespace, + parent_resource_type=parent_resource_type, + parent_resource_name=parent_resource_name, + api_version=api_version, + continuation_token_parameter=continuation_token_parameter, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + parent_provider_namespace=parent_provider_namespace, + parent_resource_type=parent_resource_type, + parent_resource_name=parent_resource_name, + api_version=api_version, + continuation_token_parameter=continuation_token_parameter, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('TargetListResult', pipeline_response) + deserialized = self._deserialize("TargetListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -119,31 +304,36 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{parentProviderNamespace}/{parentResourceType}/{parentResourceName}/providers/Microsoft.Chaos/targets'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{parentProviderNamespace}/{parentResourceType}/{parentResourceName}/providers/Microsoft.Chaos/targets"} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - parent_provider_namespace, # type: str - parent_resource_type, # type: str - parent_resource_name, # type: str - target_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Target" + resource_group_name: str, + parent_provider_namespace: str, + parent_resource_type: str, + parent_resource_name: str, + target_name: str, + **kwargs: Any + ) -> "_models.Target": """Get a Target resource that extends a tracked regional resource. :param resource_group_name: String that represents an Azure resource group. @@ -158,7 +348,7 @@ def get( :type target_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: Target, or the result of cls(response) - :rtype: ~chaos_management_client.models.Target + :rtype: ~azure.mgmt.chaos.models.Target :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.Target"] @@ -166,36 +356,33 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-15-preview" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.\(\)]*[a-zA-Z0-9_\-\(\)]$'), - 'parentProviderNamespace': self._serialize.url("parent_provider_namespace", parent_provider_namespace, 'str', pattern=r'^[a-zA-Z0-9]+\.[a-zA-Z0-9]+$'), - 'parentResourceType': self._serialize.url("parent_resource_type", parent_resource_type, 'str', pattern=r'^[a-zA-Z0-9_\-\.]+$'), - 'parentResourceName': self._serialize.url("parent_resource_name", parent_resource_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.]+$'), - 'targetName': self._serialize.url("target_name", target_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.]+$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2021-09-15-preview") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + parent_provider_namespace=parent_provider_namespace, + parent_resource_type=parent_resource_type, + parent_resource_name=parent_resource_name, + target_name=target_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Target', pipeline_response) @@ -204,18 +391,20 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{parentProviderNamespace}/{parentResourceType}/{parentResourceName}/providers/Microsoft.Chaos/targets/{targetName}'} # type: ignore - def delete( + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{parentProviderNamespace}/{parentResourceType}/{parentResourceName}/providers/Microsoft.Chaos/targets/{targetName}"} # type: ignore + + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - parent_provider_namespace, # type: str - parent_resource_type, # type: str - parent_resource_name, # type: str - target_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + parent_provider_namespace: str, + parent_resource_type: str, + parent_resource_name: str, + target_name: str, + **kwargs: Any + ) -> None: """Delete a Target resource that extends a tracked regional resource. :param resource_group_name: String that represents an Azure resource group. @@ -238,54 +427,52 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-15-preview" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.\(\)]*[a-zA-Z0-9_\-\(\)]$'), - 'parentProviderNamespace': self._serialize.url("parent_provider_namespace", parent_provider_namespace, 'str', pattern=r'^[a-zA-Z0-9]+\.[a-zA-Z0-9]+$'), - 'parentResourceType': self._serialize.url("parent_resource_type", parent_resource_type, 'str', pattern=r'^[a-zA-Z0-9_\-\.]+$'), - 'parentResourceName': self._serialize.url("parent_resource_name", parent_resource_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.]+$'), - 'targetName': self._serialize.url("target_name", target_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.]+$'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2021-09-15-preview") # type: str + + + request = build_delete_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + parent_provider_namespace=parent_provider_namespace, + parent_resource_type=parent_resource_type, + parent_resource_name=parent_resource_name, + target_name=target_name, + api_version=api_version, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{parentProviderNamespace}/{parentResourceType}/{parentResourceName}/providers/Microsoft.Chaos/targets/{targetName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{parentProviderNamespace}/{parentResourceType}/{parentResourceName}/providers/Microsoft.Chaos/targets/{targetName}"} # type: ignore + + @distributed_trace def create_or_update( self, - resource_group_name, # type: str - parent_provider_namespace, # type: str - parent_resource_type, # type: str - parent_resource_name, # type: str - target_name, # type: str - target, # type: "_models.Target" - **kwargs # type: Any - ): - # type: (...) -> "_models.Target" + resource_group_name: str, + parent_provider_namespace: str, + parent_resource_type: str, + parent_resource_name: str, + target_name: str, + target: "_models.Target", + **kwargs: Any + ) -> "_models.Target": """Create or update a Target resource that extends a tracked regional resource. :param resource_group_name: String that represents an Azure resource group. @@ -299,10 +486,10 @@ def create_or_update( :param target_name: String that represents a Target resource name. :type target_name: str :param target: Target resource to be created or updated. - :type target: ~chaos_management_client.models.Target + :type target: ~azure.mgmt.chaos.models.Target :keyword callable cls: A custom type or function that will be passed the direct response :return: Target, or the result of cls(response) - :rtype: ~chaos_management_client.models.Target + :rtype: ~azure.mgmt.chaos.models.Target :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.Target"] @@ -310,41 +497,37 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-09-15-preview" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str', pattern=r'^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.\(\)]*[a-zA-Z0-9_\-\(\)]$'), - 'parentProviderNamespace': self._serialize.url("parent_provider_namespace", parent_provider_namespace, 'str', pattern=r'^[a-zA-Z0-9]+\.[a-zA-Z0-9]+$'), - 'parentResourceType': self._serialize.url("parent_resource_type", parent_resource_type, 'str', pattern=r'^[a-zA-Z0-9_\-\.]+$'), - 'parentResourceName': self._serialize.url("parent_resource_name", parent_resource_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.]+$'), - 'targetName': self._serialize.url("target_name", target_name, 'str', pattern=r'^[a-zA-Z0-9_\-\.]+$'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(target, 'Target') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-09-15-preview") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(target, 'Target') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + parent_provider_namespace=parent_provider_namespace, + parent_resource_type=parent_resource_type, + parent_resource_name=parent_resource_name, + target_name=target_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Target', pipeline_response) @@ -353,4 +536,6 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{parentProviderNamespace}/{parentResourceType}/{parentResourceName}/providers/Microsoft.Chaos/targets/{targetName}'} # type: ignore + + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{parentProviderNamespace}/{parentResourceType}/{parentResourceName}/providers/Microsoft.Chaos/targets/{targetName}"} # type: ignore + diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservices/README.md b/sdk/recoveryservices/azure-mgmt-recoveryservices/README.md index 8f499a468e56..a04368d7dec7 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservices/README.md +++ b/sdk/recoveryservices/azure-mgmt-recoveryservices/README.md @@ -15,7 +15,7 @@ To learn how to use this package, see the [quickstart guide](https://aka.ms/azsd -For docs and references, see [Python SDK References](https://docs.microsoft.com/python/api/overview/azure/recoveryservices) +For docs and references, see [Python SDK References](https://docs.microsoft.com/python/api/overview/azure/) Code samples for this package can be found at [Recovery Services](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com. Additional code samples for different Azure services are available at [Samples Repo](https://aka.ms/azsdk/python/mgmt/samples) diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservices/sdk_packaging.toml b/sdk/recoveryservices/azure-mgmt-recoveryservices/sdk_packaging.toml index 5efb29092888..c94c454f0da1 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservices/sdk_packaging.toml +++ b/sdk/recoveryservices/azure-mgmt-recoveryservices/sdk_packaging.toml @@ -1,5 +1,5 @@ [packaging] package_name = "azure-mgmt-recoveryservices" package_pprint_name = "Recovery Services" -package_doc_id = "recoveryservices" +package_doc_id = "" is_stable = false diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/CHANGELOG.md b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/CHANGELOG.md index a5c466bcf370..1be92aff64ef 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/CHANGELOG.md +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/CHANGELOG.md @@ -1,5 +1,12 @@ # Release History +## 4.2.0 (2022-05-07) + +**Features** + + - Model AzureIaaSVMProtectionPolicy has a new parameter tiering_policy + - Model SubProtectionPolicy has a new parameter tiering_policy + ## 4.1.1 (2022-02-18) **Bug Fixes** diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/_meta.json b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/_meta.json index 6338884bcb55..ce5b138dc056 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/_meta.json +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/_meta.json @@ -1,11 +1,11 @@ { "autorest": "3.7.2", "use": [ - "@autorest/python@5.12.0", + "@autorest/python@5.13.0", "@autorest/modelerfour@4.19.3" ], - "commit": "644beb7e189d0c5e16377df6a88aef589707b7f0", + "commit": "78665b44d4b9295e56664193fc3baa9e0526d15d", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest_command": "autorest specification/recoveryservicesbackup/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --python3-only --track2 --use=@autorest/python@5.12.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2", + "autorest_command": "autorest specification/recoveryservicesbackup/resource-manager/readme.md --multiapi --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --python3-only --use=@autorest/python@5.13.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2", "readme": "specification/recoveryservicesbackup/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/_version.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/_version.py index 83801515a450..0a3e80c7ba62 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/_version.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "4.1.1" +VERSION = "4.2.0" diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/_configuration.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/_configuration.py index 625737a23c73..dd07b65c0794 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/_configuration.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/_configuration.py @@ -19,7 +19,7 @@ from azure.core.credentials import TokenCredential -class RecoveryServicesBackupClientConfiguration(Configuration): +class RecoveryServicesBackupClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for RecoveryServicesBackupClient. Note that all parameters used to create this instance are saved as instance @@ -29,6 +29,9 @@ class RecoveryServicesBackupClientConfiguration(Configuration): :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The subscription Id. :type subscription_id: str + :keyword api_version: Api Version. Default value is "2021-12-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +41,8 @@ def __init__( **kwargs: Any ) -> None: super(RecoveryServicesBackupClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +50,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2021-12-01" + self.api_version = api_version self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-recoveryservicesbackup/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/_metadata.json b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/_metadata.json index 788e9287b110..d74377c269f3 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/_metadata.json +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"RecoveryServicesBackupClientConfiguration\"], \"._operations_mixin\": [\"RecoveryServicesBackupClientOperationsMixin\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"RecoveryServicesBackupClientConfiguration\"], \"._operations_mixin\": [\"RecoveryServicesBackupClientOperationsMixin\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"RecoveryServicesBackupClientConfiguration\"], \"._operations_mixin\": [\"RecoveryServicesBackupClientOperationsMixin\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"RecoveryServicesBackupClientConfiguration\"], \"._operations_mixin\": [\"RecoveryServicesBackupClientOperationsMixin\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { @@ -164,72 +164,72 @@ }, "_bms_prepare_data_move_initial" : { "sync": { - "signature": "def _bms_prepare_data_move_initial(\n self,\n vault_name, # type: str\n resource_group_name, # type: str\n parameters, # type: \"_models.PrepareDataMoveRequest\"\n **kwargs # type: Any\n):\n # type: (...) -\u003e None\n", + "signature": "def _bms_prepare_data_move_initial( # pylint: disable=inconsistent-return-statements\n self,\n vault_name, # type: str\n resource_group_name, # type: str\n parameters, # type: \"_models.PrepareDataMoveRequest\"\n **kwargs # type: Any\n):\n # type: (...) -\u003e None\n", "doc": "\n\n:param vault_name: The name of the recovery services vault.\n:type vault_name: str\n:param resource_group_name: The name of the resource group where the recovery services vault is\n present.\n:type resource_group_name: str\n:param parameters: Prepare data move request.\n:type parameters: ~azure.mgmt.recoveryservicesbackup.activestamp.models.PrepareDataMoveRequest\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None, or the result of cls(response)\n:rtype: None\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" }, "async": { "coroutine": true, - "signature": "async def _bms_prepare_data_move_initial(\n self,\n vault_name: str,\n resource_group_name: str,\n parameters: \"_models.PrepareDataMoveRequest\",\n **kwargs: Any\n) -\u003e None:\n", + "signature": "async def _bms_prepare_data_move_initial( # pylint: disable=inconsistent-return-statements\n self,\n vault_name: str,\n resource_group_name: str,\n parameters: \"_models.PrepareDataMoveRequest\",\n **kwargs: Any\n) -\u003e None:\n", "doc": "\n\n:param vault_name: The name of the recovery services vault.\n:type vault_name: str\n:param resource_group_name: The name of the resource group where the recovery services vault is\n present.\n:type resource_group_name: str\n:param parameters: Prepare data move request.\n:type parameters: ~azure.mgmt.recoveryservicesbackup.activestamp.models.PrepareDataMoveRequest\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None, or the result of cls(response)\n:rtype: None\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" }, "call": "vault_name, resource_group_name, parameters" }, "begin_bms_prepare_data_move" : { "sync": { - "signature": "def begin_bms_prepare_data_move(\n self,\n vault_name, # type: str\n resource_group_name, # type: str\n parameters, # type: \"_models.PrepareDataMoveRequest\"\n **kwargs # type: Any\n):\n # type: (...) -\u003e LROPoller[None]\n", + "signature": "def begin_bms_prepare_data_move( # pylint: disable=inconsistent-return-statements\n self,\n vault_name, # type: str\n resource_group_name, # type: str\n parameters, # type: \"_models.PrepareDataMoveRequest\"\n **kwargs # type: Any\n):\n # type: (...) -\u003e LROPoller[None]\n", "doc": "\"\"\"Prepares source vault for Data Move operation.\n\n:param vault_name: The name of the recovery services vault.\n:type vault_name: str\n:param resource_group_name: The name of the resource group where the recovery services vault is\n present.\n:type resource_group_name: str\n:param parameters: Prepare data move request.\n:type parameters: ~azure.mgmt.recoveryservicesbackup.activestamp.models.PrepareDataMoveRequest\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this\n operation to not poll, or pass in your own initialized polling object for a personal polling\n strategy.\n:paramtype polling: bool or ~azure.core.polling.PollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no\n Retry-After header is present.\n:return: An instance of LROPoller that returns either None or the result of cls(response)\n:rtype: ~azure.core.polling.LROPoller[None]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" }, "async": { "coroutine": true, - "signature": "async def begin_bms_prepare_data_move(\n self,\n vault_name: str,\n resource_group_name: str,\n parameters: \"_models.PrepareDataMoveRequest\",\n **kwargs: Any\n) -\u003e AsyncLROPoller[None]:\n", + "signature": "async def begin_bms_prepare_data_move( # pylint: disable=inconsistent-return-statements\n self,\n vault_name: str,\n resource_group_name: str,\n parameters: \"_models.PrepareDataMoveRequest\",\n **kwargs: Any\n) -\u003e AsyncLROPoller[None]:\n", "doc": "\"\"\"Prepares source vault for Data Move operation.\n\n:param vault_name: The name of the recovery services vault.\n:type vault_name: str\n:param resource_group_name: The name of the resource group where the recovery services vault is\n present.\n:type resource_group_name: str\n:param parameters: Prepare data move request.\n:type parameters: ~azure.mgmt.recoveryservicesbackup.activestamp.models.PrepareDataMoveRequest\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for\n this operation to not poll, or pass in your own initialized polling object for a personal\n polling strategy.\n:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no\n Retry-After header is present.\n:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)\n:rtype: ~azure.core.polling.AsyncLROPoller[None]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" }, "call": "vault_name, resource_group_name, parameters" }, "_bms_trigger_data_move_initial" : { "sync": { - "signature": "def _bms_trigger_data_move_initial(\n self,\n vault_name, # type: str\n resource_group_name, # type: str\n parameters, # type: \"_models.TriggerDataMoveRequest\"\n **kwargs # type: Any\n):\n # type: (...) -\u003e None\n", + "signature": "def _bms_trigger_data_move_initial( # pylint: disable=inconsistent-return-statements\n self,\n vault_name, # type: str\n resource_group_name, # type: str\n parameters, # type: \"_models.TriggerDataMoveRequest\"\n **kwargs # type: Any\n):\n # type: (...) -\u003e None\n", "doc": "\n\n:param vault_name: The name of the recovery services vault.\n:type vault_name: str\n:param resource_group_name: The name of the resource group where the recovery services vault is\n present.\n:type resource_group_name: str\n:param parameters: Trigger data move request.\n:type parameters: ~azure.mgmt.recoveryservicesbackup.activestamp.models.TriggerDataMoveRequest\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None, or the result of cls(response)\n:rtype: None\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" }, "async": { "coroutine": true, - "signature": "async def _bms_trigger_data_move_initial(\n self,\n vault_name: str,\n resource_group_name: str,\n parameters: \"_models.TriggerDataMoveRequest\",\n **kwargs: Any\n) -\u003e None:\n", + "signature": "async def _bms_trigger_data_move_initial( # pylint: disable=inconsistent-return-statements\n self,\n vault_name: str,\n resource_group_name: str,\n parameters: \"_models.TriggerDataMoveRequest\",\n **kwargs: Any\n) -\u003e None:\n", "doc": "\n\n:param vault_name: The name of the recovery services vault.\n:type vault_name: str\n:param resource_group_name: The name of the resource group where the recovery services vault is\n present.\n:type resource_group_name: str\n:param parameters: Trigger data move request.\n:type parameters: ~azure.mgmt.recoveryservicesbackup.activestamp.models.TriggerDataMoveRequest\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None, or the result of cls(response)\n:rtype: None\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" }, "call": "vault_name, resource_group_name, parameters" }, "begin_bms_trigger_data_move" : { "sync": { - "signature": "def begin_bms_trigger_data_move(\n self,\n vault_name, # type: str\n resource_group_name, # type: str\n parameters, # type: \"_models.TriggerDataMoveRequest\"\n **kwargs # type: Any\n):\n # type: (...) -\u003e LROPoller[None]\n", + "signature": "def begin_bms_trigger_data_move( # pylint: disable=inconsistent-return-statements\n self,\n vault_name, # type: str\n resource_group_name, # type: str\n parameters, # type: \"_models.TriggerDataMoveRequest\"\n **kwargs # type: Any\n):\n # type: (...) -\u003e LROPoller[None]\n", "doc": "\"\"\"Triggers Data Move Operation on target vault.\n\n:param vault_name: The name of the recovery services vault.\n:type vault_name: str\n:param resource_group_name: The name of the resource group where the recovery services vault is\n present.\n:type resource_group_name: str\n:param parameters: Trigger data move request.\n:type parameters: ~azure.mgmt.recoveryservicesbackup.activestamp.models.TriggerDataMoveRequest\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this\n operation to not poll, or pass in your own initialized polling object for a personal polling\n strategy.\n:paramtype polling: bool or ~azure.core.polling.PollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no\n Retry-After header is present.\n:return: An instance of LROPoller that returns either None or the result of cls(response)\n:rtype: ~azure.core.polling.LROPoller[None]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" }, "async": { "coroutine": true, - "signature": "async def begin_bms_trigger_data_move(\n self,\n vault_name: str,\n resource_group_name: str,\n parameters: \"_models.TriggerDataMoveRequest\",\n **kwargs: Any\n) -\u003e AsyncLROPoller[None]:\n", + "signature": "async def begin_bms_trigger_data_move( # pylint: disable=inconsistent-return-statements\n self,\n vault_name: str,\n resource_group_name: str,\n parameters: \"_models.TriggerDataMoveRequest\",\n **kwargs: Any\n) -\u003e AsyncLROPoller[None]:\n", "doc": "\"\"\"Triggers Data Move Operation on target vault.\n\n:param vault_name: The name of the recovery services vault.\n:type vault_name: str\n:param resource_group_name: The name of the resource group where the recovery services vault is\n present.\n:type resource_group_name: str\n:param parameters: Trigger data move request.\n:type parameters: ~azure.mgmt.recoveryservicesbackup.activestamp.models.TriggerDataMoveRequest\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for\n this operation to not poll, or pass in your own initialized polling object for a personal\n polling strategy.\n:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no\n Retry-After header is present.\n:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)\n:rtype: ~azure.core.polling.AsyncLROPoller[None]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" }, "call": "vault_name, resource_group_name, parameters" }, "_move_recovery_point_initial" : { "sync": { - "signature": "def _move_recovery_point_initial(\n self,\n vault_name, # type: str\n resource_group_name, # type: str\n fabric_name, # type: str\n container_name, # type: str\n protected_item_name, # type: str\n recovery_point_id, # type: str\n parameters, # type: \"_models.MoveRPAcrossTiersRequest\"\n **kwargs # type: Any\n):\n # type: (...) -\u003e None\n", + "signature": "def _move_recovery_point_initial( # pylint: disable=inconsistent-return-statements\n self,\n vault_name, # type: str\n resource_group_name, # type: str\n fabric_name, # type: str\n container_name, # type: str\n protected_item_name, # type: str\n recovery_point_id, # type: str\n parameters, # type: \"_models.MoveRPAcrossTiersRequest\"\n **kwargs # type: Any\n):\n # type: (...) -\u003e None\n", "doc": "\"\"\"Move recovery point from one datastore to another store.\n\n:param vault_name: The name of the recovery services vault.\n:type vault_name: str\n:param resource_group_name: The name of the resource group where the recovery services vault is\n present.\n:type resource_group_name: str\n:param fabric_name:\n:type fabric_name: str\n:param container_name:\n:type container_name: str\n:param protected_item_name:\n:type protected_item_name: str\n:param recovery_point_id:\n:type recovery_point_id: str\n:param parameters: Move Resource Across Tiers Request.\n:type parameters:\n ~azure.mgmt.recoveryservicesbackup.activestamp.models.MoveRPAcrossTiersRequest\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None, or the result of cls(response)\n:rtype: None\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" }, "async": { "coroutine": true, - "signature": "async def _move_recovery_point_initial(\n self,\n vault_name: str,\n resource_group_name: str,\n fabric_name: str,\n container_name: str,\n protected_item_name: str,\n recovery_point_id: str,\n parameters: \"_models.MoveRPAcrossTiersRequest\",\n **kwargs: Any\n) -\u003e None:\n", + "signature": "async def _move_recovery_point_initial( # pylint: disable=inconsistent-return-statements\n self,\n vault_name: str,\n resource_group_name: str,\n fabric_name: str,\n container_name: str,\n protected_item_name: str,\n recovery_point_id: str,\n parameters: \"_models.MoveRPAcrossTiersRequest\",\n **kwargs: Any\n) -\u003e None:\n", "doc": "\"\"\"Move recovery point from one datastore to another store.\n\n:param vault_name: The name of the recovery services vault.\n:type vault_name: str\n:param resource_group_name: The name of the resource group where the recovery services vault is\n present.\n:type resource_group_name: str\n:param fabric_name:\n:type fabric_name: str\n:param container_name:\n:type container_name: str\n:param protected_item_name:\n:type protected_item_name: str\n:param recovery_point_id:\n:type recovery_point_id: str\n:param parameters: Move Resource Across Tiers Request.\n:type parameters:\n ~azure.mgmt.recoveryservicesbackup.activestamp.models.MoveRPAcrossTiersRequest\n:keyword callable cls: A custom type or function that will be passed the direct response\n:return: None, or the result of cls(response)\n:rtype: None\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" }, "call": "vault_name, resource_group_name, fabric_name, container_name, protected_item_name, recovery_point_id, parameters" }, "begin_move_recovery_point" : { "sync": { - "signature": "def begin_move_recovery_point(\n self,\n vault_name, # type: str\n resource_group_name, # type: str\n fabric_name, # type: str\n container_name, # type: str\n protected_item_name, # type: str\n recovery_point_id, # type: str\n parameters, # type: \"_models.MoveRPAcrossTiersRequest\"\n **kwargs # type: Any\n):\n # type: (...) -\u003e LROPoller[None]\n", + "signature": "def begin_move_recovery_point( # pylint: disable=inconsistent-return-statements\n self,\n vault_name, # type: str\n resource_group_name, # type: str\n fabric_name, # type: str\n container_name, # type: str\n protected_item_name, # type: str\n recovery_point_id, # type: str\n parameters, # type: \"_models.MoveRPAcrossTiersRequest\"\n **kwargs # type: Any\n):\n # type: (...) -\u003e LROPoller[None]\n", "doc": "\"\"\"Move recovery point from one datastore to another store.\n\nMove recovery point from one datastore to another store.\n\n:param vault_name: The name of the recovery services vault.\n:type vault_name: str\n:param resource_group_name: The name of the resource group where the recovery services vault is\n present.\n:type resource_group_name: str\n:param fabric_name:\n:type fabric_name: str\n:param container_name:\n:type container_name: str\n:param protected_item_name:\n:type protected_item_name: str\n:param recovery_point_id:\n:type recovery_point_id: str\n:param parameters: Move Resource Across Tiers Request.\n:type parameters:\n ~azure.mgmt.recoveryservicesbackup.activestamp.models.MoveRPAcrossTiersRequest\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: By default, your polling method will be ARMPolling. Pass in False for this\n operation to not poll, or pass in your own initialized polling object for a personal polling\n strategy.\n:paramtype polling: bool or ~azure.core.polling.PollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no\n Retry-After header is present.\n:return: An instance of LROPoller that returns either None or the result of cls(response)\n:rtype: ~azure.core.polling.LROPoller[None]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" }, "async": { "coroutine": true, - "signature": "async def begin_move_recovery_point(\n self,\n vault_name: str,\n resource_group_name: str,\n fabric_name: str,\n container_name: str,\n protected_item_name: str,\n recovery_point_id: str,\n parameters: \"_models.MoveRPAcrossTiersRequest\",\n **kwargs: Any\n) -\u003e AsyncLROPoller[None]:\n", + "signature": "async def begin_move_recovery_point( # pylint: disable=inconsistent-return-statements\n self,\n vault_name: str,\n resource_group_name: str,\n fabric_name: str,\n container_name: str,\n protected_item_name: str,\n recovery_point_id: str,\n parameters: \"_models.MoveRPAcrossTiersRequest\",\n **kwargs: Any\n) -\u003e AsyncLROPoller[None]:\n", "doc": "\"\"\"Move recovery point from one datastore to another store.\n\nMove recovery point from one datastore to another store.\n\n:param vault_name: The name of the recovery services vault.\n:type vault_name: str\n:param resource_group_name: The name of the resource group where the recovery services vault is\n present.\n:type resource_group_name: str\n:param fabric_name:\n:type fabric_name: str\n:param container_name:\n:type container_name: str\n:param protected_item_name:\n:type protected_item_name: str\n:param recovery_point_id:\n:type recovery_point_id: str\n:param parameters: Move Resource Across Tiers Request.\n:type parameters:\n ~azure.mgmt.recoveryservicesbackup.activestamp.models.MoveRPAcrossTiersRequest\n:keyword callable cls: A custom type or function that will be passed the direct response\n:keyword str continuation_token: A continuation token to restart a poller from a saved state.\n:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for\n this operation to not poll, or pass in your own initialized polling object for a personal\n polling strategy.\n:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod\n:keyword int polling_interval: Default waiting time between two polls for LRO operations if no\n Retry-After header is present.\n:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)\n:rtype: ~azure.core.polling.AsyncLROPoller[None]\n:raises: ~azure.core.exceptions.HttpResponseError\n\"\"\"" }, "call": "vault_name, resource_group_name, fabric_name, container_name, protected_item_name, recovery_point_id, parameters" diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/_recovery_services_backup_client.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/_recovery_services_backup_client.py index d282b39a52a0..8a1518604292 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/_recovery_services_backup_client.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/_recovery_services_backup_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from msrest import Deserializer, Serializer from . import models from ._configuration import RecoveryServicesBackupClientConfiguration @@ -21,7 +22,7 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class RecoveryServicesBackupClient(RecoveryServicesBackupClientOperationsMixin): +class RecoveryServicesBackupClient(RecoveryServicesBackupClientOperationsMixin): # pylint: disable=too-many-instance-attributes """Open API 2.0 Specs for Azure RecoveryServices Backup service. :ivar backup_resource_storage_configs_non_crr: BackupResourceStorageConfigsNonCRROperations @@ -175,8 +176,11 @@ class RecoveryServicesBackupClient(RecoveryServicesBackupClientOperationsMixin): :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The subscription Id. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2021-12-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ @@ -247,7 +251,7 @@ def __init__( def _send_request( self, - request, # type: HttpRequest + request: HttpRequest, **kwargs: Any ) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/_version.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/_version.py index 83801515a450..0a3e80c7ba62 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/_version.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "4.1.1" +VERSION = "4.2.0" diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/_configuration.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/_configuration.py index 898e5dd0cc15..50aaba0ff488 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/_configuration.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/_configuration.py @@ -19,7 +19,7 @@ from azure.core.credentials_async import AsyncTokenCredential -class RecoveryServicesBackupClientConfiguration(Configuration): +class RecoveryServicesBackupClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for RecoveryServicesBackupClient. Note that all parameters used to create this instance are saved as instance @@ -29,6 +29,9 @@ class RecoveryServicesBackupClientConfiguration(Configuration): :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The subscription Id. :type subscription_id: str + :keyword api_version: Api Version. Default value is "2021-12-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +41,8 @@ def __init__( **kwargs: Any ) -> None: super(RecoveryServicesBackupClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +50,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2021-12-01" + self.api_version = api_version self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-recoveryservicesbackup/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/_recovery_services_backup_client.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/_recovery_services_backup_client.py index d9ea7be427ed..96283bcdd270 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/_recovery_services_backup_client.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/_recovery_services_backup_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from msrest import Deserializer, Serializer from .. import models from ._configuration import RecoveryServicesBackupClientConfiguration @@ -21,7 +22,7 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class RecoveryServicesBackupClient(RecoveryServicesBackupClientOperationsMixin): +class RecoveryServicesBackupClient(RecoveryServicesBackupClientOperationsMixin): # pylint: disable=too-many-instance-attributes """Open API 2.0 Specs for Azure RecoveryServices Backup service. :ivar backup_resource_storage_configs_non_crr: BackupResourceStorageConfigsNonCRROperations @@ -177,8 +178,11 @@ class RecoveryServicesBackupClient(RecoveryServicesBackupClientOperationsMixin): :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The subscription Id. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2021-12-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_engines_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_engines_operations.py index d48d97a509d3..48ea7362e81d 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_engines_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_engines_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -63,9 +62,9 @@ def list( :param resource_group_name: The name of the resource group where the recovery services vault is present. :type resource_group_name: str - :param filter: OData filter options. + :param filter: OData filter options. Default value is None. :type filter: str - :param skip_token: skipToken Filter. + :param skip_token: skipToken Filter. Default value is None. :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either BackupEngineBaseResourceList or the result of @@ -74,6 +73,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupEngineBaseResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupEngineBaseResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -86,6 +87,7 @@ def prepare_request(next_link=None): vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, filter=filter, skip_token=skip_token, template_url=self.list.metadata['url'], @@ -99,6 +101,7 @@ def prepare_request(next_link=None): vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, filter=filter, skip_token=skip_token, template_url=next_link, @@ -118,7 +121,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -131,7 +138,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupEngines'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupEngines"} # type: ignore @distributed_trace_async async def get( @@ -152,9 +159,9 @@ async def get( :type resource_group_name: str :param backup_engine_name: Name of the backup management server. :type backup_engine_name: str - :param filter: OData filter options. + :param filter: OData filter options. Default value is None. :type filter: str - :param skip_token: skipToken Filter. + :param skip_token: skipToken Filter. Default value is None. :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response :return: BackupEngineBaseResource, or the result of cls(response) @@ -167,12 +174,15 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + request = build_get_request( vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, backup_engine_name=backup_engine_name, + api_version=api_version, filter=filter, skip_token=skip_token, template_url=self.get.metadata['url'], @@ -180,7 +190,11 @@ async def get( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -194,5 +208,5 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupEngines/{backupEngineName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupEngines/{backupEngineName}"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_jobs_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_jobs_operations.py index 155ee33ff61c..1328e3346984 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_jobs_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_jobs_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -15,7 +14,6 @@ from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -62,9 +60,9 @@ def list( :param resource_group_name: The name of the resource group where the recovery services vault is present. :type resource_group_name: str - :param filter: OData filter options. + :param filter: OData filter options. Default value is None. :type filter: str - :param skip_token: skipToken Filter. + :param skip_token: skipToken Filter. Default value is None. :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either JobResourceList or the result of cls(response) @@ -72,6 +70,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicesbackup.activestamp.models.JobResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.JobResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -84,6 +84,7 @@ def prepare_request(next_link=None): vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, filter=filter, skip_token=skip_token, template_url=self.list.metadata['url'], @@ -97,6 +98,7 @@ def prepare_request(next_link=None): vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, filter=filter, skip_token=skip_token, template_url=next_link, @@ -116,7 +118,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -129,4 +135,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobs'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobs"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_operation_results_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_operation_results_operations.py index e0977223fe33..c576a68e500d 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_operation_results_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_operation_results_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -45,7 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get( + async def get( # pylint: disable=inconsistent-return-statements self, vault_name: str, resource_group_name: str, @@ -78,18 +77,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + request = build_get_request( vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, operation_id=operation_id, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -99,5 +105,5 @@ async def get( if cls: return cls(pipeline_response, None, {}) - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupOperationResults/{operationId}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupOperationResults/{operationId}"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_operation_statuses_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_operation_statuses_operations.py index a5c1274235b8..6c65961055e4 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_operation_statuses_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_operation_statuses_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -76,18 +75,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + request = build_get_request( vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, operation_id=operation_id, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -101,5 +107,5 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupOperations/{operationId}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupOperations/{operationId}"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_policies_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_policies_operations.py index 14f5c3796969..1297079261c9 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_policies_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_policies_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -15,7 +14,6 @@ from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -63,7 +61,7 @@ def list( :param resource_group_name: The name of the resource group where the recovery services vault is present. :type resource_group_name: str - :param filter: OData filter options. + :param filter: OData filter options. Default value is None. :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ProtectionPolicyResourceList or the result of @@ -72,6 +70,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionPolicyResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProtectionPolicyResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -84,6 +84,7 @@ def prepare_request(next_link=None): vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, filter=filter, template_url=self.list.metadata['url'], ) @@ -96,6 +97,7 @@ def prepare_request(next_link=None): vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, filter=filter, template_url=next_link, ) @@ -114,7 +116,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -127,4 +133,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_protectable_items_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_protectable_items_operations.py index 4d38523f491f..0be00855e726 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_protectable_items_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_protectable_items_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -15,7 +14,6 @@ from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -64,9 +62,9 @@ def list( :param resource_group_name: The name of the resource group where the recovery services vault is present. :type resource_group_name: str - :param filter: OData filter options. + :param filter: OData filter options. Default value is None. :type filter: str - :param skip_token: skipToken Filter. + :param skip_token: skipToken Filter. Default value is None. :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either WorkloadProtectableItemResourceList or the result @@ -75,6 +73,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicesbackup.activestamp.models.WorkloadProtectableItemResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadProtectableItemResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -87,6 +87,7 @@ def prepare_request(next_link=None): vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, filter=filter, skip_token=skip_token, template_url=self.list.metadata['url'], @@ -100,6 +101,7 @@ def prepare_request(next_link=None): vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, filter=filter, skip_token=skip_token, template_url=next_link, @@ -119,7 +121,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -132,4 +138,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectableItems'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectableItems"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_protected_items_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_protected_items_operations.py index d46d3b74d45c..fd0e7e104e23 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_protected_items_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_protected_items_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -15,7 +14,6 @@ from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -62,9 +60,9 @@ def list( :param resource_group_name: The name of the resource group where the recovery services vault is present. :type resource_group_name: str - :param filter: OData filter options. + :param filter: OData filter options. Default value is None. :type filter: str - :param skip_token: skipToken Filter. + :param skip_token: skipToken Filter. Default value is None. :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ProtectedItemResourceList or the result of @@ -73,6 +71,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectedItemResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProtectedItemResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -85,6 +85,7 @@ def prepare_request(next_link=None): vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, filter=filter, skip_token=skip_token, template_url=self.list.metadata['url'], @@ -98,6 +99,7 @@ def prepare_request(next_link=None): vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, filter=filter, skip_token=skip_token, template_url=next_link, @@ -117,7 +119,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -130,4 +136,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectedItems'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectedItems"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_protection_containers_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_protection_containers_operations.py index 4b79d6e1ce30..7734987a2b8b 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_protection_containers_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_protection_containers_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -15,7 +14,6 @@ from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -61,7 +59,7 @@ def list( :param resource_group_name: The name of the resource group where the recovery services vault is present. :type resource_group_name: str - :param filter: OData filter options. + :param filter: OData filter options. Default value is None. :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ProtectionContainerResourceList or the result of @@ -70,6 +68,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionContainerResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProtectionContainerResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -82,6 +82,7 @@ def prepare_request(next_link=None): vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, filter=filter, template_url=self.list.metadata['url'], ) @@ -94,6 +95,7 @@ def prepare_request(next_link=None): vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, filter=filter, template_url=next_link, ) @@ -112,7 +114,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -125,4 +131,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectionContainers'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectionContainers"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_protection_intent_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_protection_intent_operations.py index 35a0e24e990c..84b43202d3b6 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_protection_intent_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_protection_intent_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -15,7 +14,6 @@ from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -62,9 +60,9 @@ def list( :param resource_group_name: The name of the resource group where the recovery services vault is present. :type resource_group_name: str - :param filter: OData filter options. + :param filter: OData filter options. Default value is None. :type filter: str - :param skip_token: skipToken Filter. + :param skip_token: skipToken Filter. Default value is None. :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ProtectionIntentResourceList or the result of @@ -73,6 +71,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionIntentResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProtectionIntentResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -85,6 +85,7 @@ def prepare_request(next_link=None): vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, filter=filter, skip_token=skip_token, template_url=self.list.metadata['url'], @@ -98,6 +99,7 @@ def prepare_request(next_link=None): vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, filter=filter, skip_token=skip_token, template_url=next_link, @@ -117,7 +119,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -130,4 +136,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectionIntents'} # type: ignore + list.metadata = {'url': "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectionIntents"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_resource_encryption_configs_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_resource_encryption_configs_operations.py index 1971b35ec994..8bb6a874525f 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_resource_encryption_configs_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_resource_encryption_configs_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -70,17 +69,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + request = build_get_request( vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -95,11 +101,11 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupEncryptionConfigs/backupResourceEncryptionConfig'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupEncryptionConfigs/backupResourceEncryptionConfig"} # type: ignore @distributed_trace_async - async def update( + async def update( # pylint: disable=inconsistent-return-statements self, vault_name: str, resource_group_name: str, @@ -127,6 +133,7 @@ async def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'BackupResourceEncryptionConfigResource') @@ -135,6 +142,7 @@ async def update( vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.update.metadata['url'], @@ -142,7 +150,11 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -153,5 +165,5 @@ async def update( if cls: return cls(pipeline_response, None, {}) - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupEncryptionConfigs/backupResourceEncryptionConfig'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupEncryptionConfigs/backupResourceEncryptionConfig"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_resource_storage_configs_non_crr_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_resource_storage_configs_non_crr_operations.py index 40fe8fe7d5d0..ba50675b6f57 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_resource_storage_configs_non_crr_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_resource_storage_configs_non_crr_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -69,17 +68,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + request = build_get_request( vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -94,7 +100,7 @@ async def get( return deserialized - get.metadata = {'url': '/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig'} # type: ignore + get.metadata = {'url': "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig"} # type: ignore @distributed_trace_async @@ -126,6 +132,7 @@ async def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'BackupResourceConfigResource') @@ -134,6 +141,7 @@ async def update( vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.update.metadata['url'], @@ -141,7 +149,11 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -156,11 +168,11 @@ async def update( return deserialized - update.metadata = {'url': '/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig'} # type: ignore + update.metadata = {'url': "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig"} # type: ignore @distributed_trace_async - async def patch( + async def patch( # pylint: disable=inconsistent-return-statements self, vault_name: str, resource_group_name: str, @@ -188,6 +200,7 @@ async def patch( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'BackupResourceConfigResource') @@ -196,6 +209,7 @@ async def patch( vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.patch.metadata['url'], @@ -203,7 +217,11 @@ async def patch( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [204]: @@ -214,5 +232,5 @@ async def patch( if cls: return cls(pipeline_response, None, {}) - patch.metadata = {'url': '/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig'} # type: ignore + patch.metadata = {'url': "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_resource_vault_configs_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_resource_vault_configs_operations.py index e0e263a2784d..54e14c13c4cb 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_resource_vault_configs_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_resource_vault_configs_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -69,17 +68,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + request = build_get_request( vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -94,7 +100,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupconfig/vaultconfig'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupconfig/vaultconfig"} # type: ignore @distributed_trace_async @@ -126,6 +132,7 @@ async def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'BackupResourceVaultConfigResource') @@ -134,6 +141,7 @@ async def update( vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.update.metadata['url'], @@ -141,7 +149,11 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -156,7 +168,7 @@ async def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupconfig/vaultconfig'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupconfig/vaultconfig"} # type: ignore @distributed_trace_async @@ -188,6 +200,7 @@ async def put( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'BackupResourceVaultConfigResource') @@ -196,6 +209,7 @@ async def put( vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.put.metadata['url'], @@ -203,7 +217,11 @@ async def put( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -218,5 +236,5 @@ async def put( return deserialized - put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupconfig/vaultconfig'} # type: ignore + put.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupconfig/vaultconfig"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_status_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_status_operations.py index 61f43c9f903a..36503353706d 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_status_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_status_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -70,6 +69,7 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'BackupStatusRequest') @@ -77,6 +77,7 @@ async def get( request = build_get_request( azure_region=azure_region, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.get.metadata['url'], @@ -84,7 +85,11 @@ async def get( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -98,5 +103,5 @@ async def get( return deserialized - get.metadata = {'url': '/Subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupStatus'} # type: ignore + get.metadata = {'url': "/Subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupStatus"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_usage_summaries_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_usage_summaries_operations.py index 843e55fac9ff..30908ff69b10 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_usage_summaries_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_usage_summaries_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -15,7 +14,6 @@ from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -62,9 +60,9 @@ def list( :param resource_group_name: The name of the resource group where the recovery services vault is present. :type resource_group_name: str - :param filter: OData filter options. + :param filter: OData filter options. Default value is None. :type filter: str - :param skip_token: skipToken Filter. + :param skip_token: skipToken Filter. Default value is None. :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either BackupManagementUsageList or the result of @@ -73,6 +71,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementUsageList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupManagementUsageList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -85,6 +85,7 @@ def prepare_request(next_link=None): vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, filter=filter, skip_token=skip_token, template_url=self.list.metadata['url'], @@ -98,6 +99,7 @@ def prepare_request(next_link=None): vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, filter=filter, skip_token=skip_token, template_url=next_link, @@ -117,7 +119,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -130,4 +136,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupUsageSummaries'} # type: ignore + list.metadata = {'url': "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupUsageSummaries"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_workload_items_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_workload_items_operations.py index d1a1fafcc616..8a4873318ef3 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_workload_items_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backup_workload_items_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -15,7 +14,6 @@ from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -70,9 +68,9 @@ def list( :type fabric_name: str :param container_name: Name of the container. :type container_name: str - :param filter: OData filter options. + :param filter: OData filter options. Default value is None. :type filter: str - :param skip_token: skipToken Filter. + :param skip_token: skipToken Filter. Default value is None. :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either WorkloadItemResourceList or the result of @@ -81,6 +79,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicesbackup.activestamp.models.WorkloadItemResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadItemResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -95,6 +95,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, fabric_name=fabric_name, container_name=container_name, + api_version=api_version, filter=filter, skip_token=skip_token, template_url=self.list.metadata['url'], @@ -110,6 +111,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, fabric_name=fabric_name, container_name=container_name, + api_version=api_version, filter=filter, skip_token=skip_token, template_url=next_link, @@ -129,7 +131,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -142,4 +148,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/items'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/items"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backups_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backups_operations.py index 284710e1f7c4..eb856bd3c392 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backups_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_backups_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -45,7 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def trigger( + async def trigger( # pylint: disable=inconsistent-return-statements self, vault_name: str, resource_group_name: str, @@ -83,6 +82,7 @@ async def trigger( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'BackupRequestResource') @@ -94,6 +94,7 @@ async def trigger( fabric_name=fabric_name, container_name=container_name, protected_item_name=protected_item_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.trigger.metadata['url'], @@ -101,7 +102,11 @@ async def trigger( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: @@ -111,5 +116,5 @@ async def trigger( if cls: return cls(pipeline_response, None, {}) - trigger.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/backup'} # type: ignore + trigger.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/backup"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_bms_prepare_data_move_operation_result_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_bms_prepare_data_move_operation_result_operations.py index 766e6abd66e7..2e6fae2f1d2a 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_bms_prepare_data_move_operation_result_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_bms_prepare_data_move_operation_result_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -74,18 +73,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + request = build_get_request( vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, operation_id=operation_id, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -102,5 +108,5 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig/operationResults/{operationId}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig/operationResults/{operationId}"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_export_jobs_operation_results_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_export_jobs_operation_results_operations.py index a8cae08f1ceb..4aa327961dfa 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_export_jobs_operation_results_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_export_jobs_operation_results_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -75,18 +74,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + request = build_get_request( vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, operation_id=operation_id, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -104,5 +110,5 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobs/operationResults/{operationId}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobs/operationResults/{operationId}"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_feature_support_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_feature_support_operations.py index c4b37c180303..edcf7a30fc4e 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_feature_support_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_feature_support_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -71,6 +70,7 @@ async def validate( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'FeatureSupportRequest') @@ -78,6 +78,7 @@ async def validate( request = build_validate_request( azure_region=azure_region, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.validate.metadata['url'], @@ -85,7 +86,11 @@ async def validate( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -99,5 +104,5 @@ async def validate( return deserialized - validate.metadata = {'url': '/Subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupValidateFeatures'} # type: ignore + validate.metadata = {'url': "/Subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupValidateFeatures"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_item_level_recovery_connections_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_item_level_recovery_connections_operations.py index 364af796cc2c..28b8e7824cd9 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_item_level_recovery_connections_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_item_level_recovery_connections_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -45,7 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def provision( + async def provision( # pylint: disable=inconsistent-return-statements self, vault_name: str, resource_group_name: str, @@ -90,6 +89,7 @@ async def provision( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ILRRequestResource') @@ -102,6 +102,7 @@ async def provision( container_name=container_name, protected_item_name=protected_item_name, recovery_point_id=recovery_point_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.provision.metadata['url'], @@ -109,7 +110,11 @@ async def provision( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: @@ -119,11 +124,11 @@ async def provision( if cls: return cls(pipeline_response, None, {}) - provision.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/provisionInstantItemRecovery'} # type: ignore + provision.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/provisionInstantItemRecovery"} # type: ignore @distributed_trace_async - async def revoke( + async def revoke( # pylint: disable=inconsistent-return-statements self, vault_name: str, resource_group_name: str, @@ -163,6 +168,8 @@ async def revoke( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + request = build_revoke_request( vault_name=vault_name, @@ -172,12 +179,17 @@ async def revoke( container_name=container_name, protected_item_name=protected_item_name, recovery_point_id=recovery_point_id, + api_version=api_version, template_url=self.revoke.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: @@ -187,5 +199,5 @@ async def revoke( if cls: return cls(pipeline_response, None, {}) - revoke.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/revokeInstantItemRecovery'} # type: ignore + revoke.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/revokeInstantItemRecovery"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_job_cancellations_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_job_cancellations_operations.py index 3c1982835202..f8217bf330d7 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_job_cancellations_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_job_cancellations_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -45,7 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def trigger( + async def trigger( # pylint: disable=inconsistent-return-statements self, vault_name: str, resource_group_name: str, @@ -73,18 +72,25 @@ async def trigger( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + request = build_trigger_request( vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, job_name=job_name, + api_version=api_version, template_url=self.trigger.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: @@ -94,5 +100,5 @@ async def trigger( if cls: return cls(pipeline_response, None, {}) - trigger.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobs/{jobName}/cancel'} # type: ignore + trigger.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobs/{jobName}/cancel"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_job_details_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_job_details_operations.py index e4ab6ba7c9a7..170a59d4d524 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_job_details_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_job_details_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -72,18 +71,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + request = build_get_request( vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, job_name=job_name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -97,5 +103,5 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobs/{jobName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobs/{jobName}"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_job_operation_results_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_job_operation_results_operations.py index 79a3439de3c9..3d5818def91a 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_job_operation_results_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_job_operation_results_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -45,7 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get( + async def get( # pylint: disable=inconsistent-return-statements self, vault_name: str, resource_group_name: str, @@ -75,6 +74,8 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + request = build_get_request( vault_name=vault_name, @@ -82,12 +83,17 @@ async def get( subscription_id=self._config.subscription_id, job_name=job_name, operation_id=operation_id, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -97,5 +103,5 @@ async def get( if cls: return cls(pipeline_response, None, {}) - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobs/{jobName}/operationResults/{operationId}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobs/{jobName}/operationResults/{operationId}"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_jobs_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_jobs_operations.py index 645973e29a26..97bb9720479c 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_jobs_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_jobs_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -45,7 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def export( + async def export( # pylint: disable=inconsistent-return-statements self, vault_name: str, resource_group_name: str, @@ -59,7 +58,7 @@ async def export( :param resource_group_name: The name of the resource group where the recovery services vault is present. :type resource_group_name: str - :param filter: OData filter options. + :param filter: OData filter options. Default value is None. :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -72,18 +71,25 @@ async def export( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + request = build_export_request( vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, filter=filter, template_url=self.export.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: @@ -93,5 +99,5 @@ async def export( if cls: return cls(pipeline_response, None, {}) - export.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobsExport'} # type: ignore + export.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobsExport"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_operation_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_operation_operations.py index 69a5e46e143b..f56cc513b8cf 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_operation_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_operation_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -73,6 +72,7 @@ async def validate( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ValidateOperationRequest') @@ -81,6 +81,7 @@ async def validate( vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.validate.metadata['url'], @@ -88,7 +89,11 @@ async def validate( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -102,5 +107,5 @@ async def validate( return deserialized - validate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupValidateOperation'} # type: ignore + validate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupValidateOperation"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_operations.py index 1d6edc67fcfd..04fa38a69cf8 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -15,7 +14,6 @@ from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -60,6 +58,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicesbackup.activestamp.models.ClientDiscoveryResponse] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ClientDiscoveryResponse"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -69,6 +69,7 @@ def prepare_request(next_link=None): if not next_link: request = build_list_request( + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -77,6 +78,7 @@ def prepare_request(next_link=None): else: request = build_list_request( + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -94,7 +96,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -107,4 +113,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/providers/Microsoft.RecoveryServices/operations'} # type: ignore + list.metadata = {'url': "/providers/Microsoft.RecoveryServices/operations"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_private_endpoint_connection_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_private_endpoint_connection_operations.py index a24cb05de651..92b35c5d8423 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_private_endpoint_connection_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_private_endpoint_connection_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar, Union from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -74,18 +73,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + request = build_get_request( vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -100,7 +106,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore async def _put_initial( @@ -117,6 +123,7 @@ async def _put_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'PrivateEndpointConnectionResource') @@ -126,6 +133,7 @@ async def _put_initial( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._put_initial.metadata['url'], @@ -133,7 +141,11 @@ async def _put_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -151,7 +163,7 @@ async def _put_initial( return deserialized - _put_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + _put_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace_async @@ -189,8 +201,9 @@ async def begin_put( ~azure.core.polling.AsyncLROPoller[~azure.mgmt.recoveryservicesbackup.activestamp.models.PrivateEndpointConnectionResource] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -203,6 +216,7 @@ async def begin_put( resource_group_name=resource_group_name, private_endpoint_connection_name=private_endpoint_connection_name, parameters=parameters, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -227,12 +241,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + begin_put.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, vault_name: str, resource_group_name: str, @@ -245,18 +258,25 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + request = build_delete_request_initial( vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -266,11 +286,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, vault_name: str, resource_group_name: str, @@ -298,7 +318,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -310,6 +331,7 @@ async def begin_delete( vault_name=vault_name, resource_group_name=resource_group_name, private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -330,7 +352,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_private_endpoint_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_private_endpoint_operations.py index 0c94ea60aabc..85007dfaf404 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_private_endpoint_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_private_endpoint_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -77,6 +76,8 @@ async def get_operation_status( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + request = build_get_operation_status_request( vault_name=vault_name, @@ -84,12 +85,17 @@ async def get_operation_status( subscription_id=self._config.subscription_id, private_endpoint_connection_name=private_endpoint_connection_name, operation_id=operation_id, + api_version=api_version, template_url=self.get_operation_status.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -104,5 +110,5 @@ async def get_operation_status( return deserialized - get_operation_status.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}/operationsStatus/{operationId}'} # type: ignore + get_operation_status.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}/operationsStatus/{operationId}"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protectable_containers_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protectable_containers_operations.py index 71c2cfc0958c..09d033aa29da 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protectable_containers_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protectable_containers_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -15,7 +14,6 @@ from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -64,7 +62,7 @@ def list( :type resource_group_name: str :param fabric_name: :type fabric_name: str - :param filter: OData filter options. + :param filter: OData filter options. Default value is None. :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ProtectableContainerResourceList or the result of @@ -73,6 +71,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectableContainerResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProtectableContainerResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -86,6 +86,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, fabric_name=fabric_name, + api_version=api_version, filter=filter, template_url=self.list.metadata['url'], ) @@ -99,6 +100,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, fabric_name=fabric_name, + api_version=api_version, filter=filter, template_url=next_link, ) @@ -117,7 +119,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -130,4 +136,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectableContainers'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectableContainers"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protected_item_operation_results_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protected_item_operation_results_operations.py index 744995db01a2..39d96dbfa1c2 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protected_item_operation_results_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protected_item_operation_results_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -82,6 +81,8 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + request = build_get_request( vault_name=vault_name, @@ -91,12 +92,17 @@ async def get( container_name=container_name, protected_item_name=protected_item_name, operation_id=operation_id, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -112,5 +118,5 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/operationResults/{operationId}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/operationResults/{operationId}"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protected_item_operation_statuses_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protected_item_operation_statuses_operations.py index 4217d806f467..969f47c719bd 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protected_item_operation_statuses_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protected_item_operation_statuses_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -85,6 +84,8 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + request = build_get_request( vault_name=vault_name, @@ -94,12 +95,17 @@ async def get( container_name=container_name, protected_item_name=protected_item_name, operation_id=operation_id, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -113,5 +119,5 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/operationsStatus/{operationId}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/operationsStatus/{operationId}"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protected_items_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protected_items_operations.py index c6824048308b..e91df22e203f 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protected_items_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protected_items_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -70,7 +69,7 @@ async def get( :type container_name: str :param protected_item_name: Backed up item name whose details are to be fetched. :type protected_item_name: str - :param filter: OData filter options. + :param filter: OData filter options. Default value is None. :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ProtectedItemResource, or the result of cls(response) @@ -83,6 +82,8 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + request = build_get_request( vault_name=vault_name, @@ -91,13 +92,18 @@ async def get( fabric_name=fabric_name, container_name=container_name, protected_item_name=protected_item_name, + api_version=api_version, filter=filter, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -111,7 +117,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}"} # type: ignore @distributed_trace_async @@ -154,6 +160,7 @@ async def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ProtectedItemResource') @@ -165,6 +172,7 @@ async def create_or_update( fabric_name=fabric_name, container_name=container_name, protected_item_name=protected_item_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], @@ -172,7 +180,11 @@ async def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -188,11 +200,11 @@ async def create_or_update( return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}'} # type: ignore + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, vault_name: str, resource_group_name: str, @@ -227,6 +239,8 @@ async def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + request = build_delete_request( vault_name=vault_name, @@ -235,12 +249,17 @@ async def delete( fabric_name=fabric_name, container_name=container_name, protected_item_name=protected_item_name, + api_version=api_version, template_url=self.delete.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -250,5 +269,5 @@ async def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protection_container_operation_results_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protection_container_operation_results_operations.py index 475f344eddbc..9a32bbfb7c4c 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protection_container_operation_results_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protection_container_operation_results_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -80,6 +79,8 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + request = build_get_request( vault_name=vault_name, @@ -88,12 +89,17 @@ async def get( fabric_name=fabric_name, container_name=container_name, operation_id=operation_id, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -109,5 +115,5 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/operationResults/{operationId}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/operationResults/{operationId}"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protection_container_refresh_operation_results_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protection_container_refresh_operation_results_operations.py index 61edf92ab770..6d639f668d35 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protection_container_refresh_operation_results_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protection_container_refresh_operation_results_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -45,7 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get( + async def get( # pylint: disable=inconsistent-return-statements self, vault_name: str, resource_group_name: str, @@ -76,6 +75,8 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + request = build_get_request( vault_name=vault_name, @@ -83,12 +84,17 @@ async def get( subscription_id=self._config.subscription_id, fabric_name=fabric_name, operation_id=operation_id, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -98,5 +104,5 @@ async def get( if cls: return cls(pipeline_response, None, {}) - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/operationResults/{operationId}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/operationResults/{operationId}"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protection_containers_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protection_containers_operations.py index 6c9f94234fb7..0d000104ebf1 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protection_containers_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protection_containers_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -75,6 +74,8 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + request = build_get_request( vault_name=vault_name, @@ -82,12 +83,17 @@ async def get( subscription_id=self._config.subscription_id, fabric_name=fabric_name, container_name=container_name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -101,7 +107,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}"} # type: ignore @distributed_trace_async @@ -143,6 +149,7 @@ async def register( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ProtectionContainerResource') @@ -153,6 +160,7 @@ async def register( subscription_id=self._config.subscription_id, fabric_name=fabric_name, container_name=container_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.register.metadata['url'], @@ -160,7 +168,11 @@ async def register( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -176,11 +188,11 @@ async def register( return deserialized - register.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}'} # type: ignore + register.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}"} # type: ignore @distributed_trace_async - async def unregister( + async def unregister( # pylint: disable=inconsistent-return-statements self, vault_name: str, resource_group_name: str, @@ -214,6 +226,8 @@ async def unregister( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + request = build_unregister_request( vault_name=vault_name, @@ -221,12 +235,17 @@ async def unregister( subscription_id=self._config.subscription_id, fabric_name=fabric_name, container_name=container_name, + api_version=api_version, template_url=self.unregister.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -236,11 +255,11 @@ async def unregister( if cls: return cls(pipeline_response, None, {}) - unregister.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}'} # type: ignore + unregister.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}"} # type: ignore @distributed_trace_async - async def inquire( + async def inquire( # pylint: disable=inconsistent-return-statements self, vault_name: str, resource_group_name: str, @@ -263,7 +282,7 @@ async def inquire( :type fabric_name: str :param container_name: Name of the container in which inquiry needs to be triggered. :type container_name: str - :param filter: OData filter options. + :param filter: OData filter options. Default value is None. :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -276,6 +295,8 @@ async def inquire( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + request = build_inquire_request( vault_name=vault_name, @@ -283,13 +304,18 @@ async def inquire( subscription_id=self._config.subscription_id, fabric_name=fabric_name, container_name=container_name, + api_version=api_version, filter=filter, template_url=self.inquire.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: @@ -299,11 +325,11 @@ async def inquire( if cls: return cls(pipeline_response, None, {}) - inquire.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/inquire'} # type: ignore + inquire.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/inquire"} # type: ignore @distributed_trace_async - async def refresh( + async def refresh( # pylint: disable=inconsistent-return-statements self, vault_name: str, resource_group_name: str, @@ -323,7 +349,7 @@ async def refresh( :type resource_group_name: str :param fabric_name: Fabric name associated the container. :type fabric_name: str - :param filter: OData filter options. + :param filter: OData filter options. Default value is None. :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -336,19 +362,26 @@ async def refresh( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + request = build_refresh_request( vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, fabric_name=fabric_name, + api_version=api_version, filter=filter, template_url=self.refresh.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: @@ -358,5 +391,5 @@ async def refresh( if cls: return cls(pipeline_response, None, {}) - refresh.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/refreshContainers'} # type: ignore + refresh.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/refreshContainers"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protection_intent_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protection_intent_operations.py index e4a9f970d1d6..d52add3b00a0 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protection_intent_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protection_intent_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -81,6 +80,7 @@ async def validate( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'PreValidateEnableBackupRequest') @@ -88,6 +88,7 @@ async def validate( request = build_validate_request( azure_region=azure_region, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.validate.metadata['url'], @@ -95,7 +96,11 @@ async def validate( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -109,7 +114,7 @@ async def validate( return deserialized - validate.metadata = {'url': '/Subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupPreValidateProtection'} # type: ignore + validate.metadata = {'url': "/Subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupPreValidateProtection"} # type: ignore @distributed_trace_async @@ -145,6 +150,8 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + request = build_get_request( vault_name=vault_name, @@ -152,12 +159,17 @@ async def get( subscription_id=self._config.subscription_id, fabric_name=fabric_name, intent_object_name=intent_object_name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -171,7 +183,7 @@ async def get( return deserialized - get.metadata = {'url': '/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/backupProtectionIntent/{intentObjectName}'} # type: ignore + get.metadata = {'url': "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/backupProtectionIntent/{intentObjectName}"} # type: ignore @distributed_trace_async @@ -209,6 +221,7 @@ async def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ProtectionIntentResource') @@ -219,6 +232,7 @@ async def create_or_update( subscription_id=self._config.subscription_id, fabric_name=fabric_name, intent_object_name=intent_object_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], @@ -226,7 +240,11 @@ async def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -240,11 +258,11 @@ async def create_or_update( return deserialized - create_or_update.metadata = {'url': '/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/backupProtectionIntent/{intentObjectName}'} # type: ignore + create_or_update.metadata = {'url': "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/backupProtectionIntent/{intentObjectName}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, vault_name: str, resource_group_name: str, @@ -274,6 +292,8 @@ async def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + request = build_delete_request( vault_name=vault_name, @@ -281,12 +301,17 @@ async def delete( subscription_id=self._config.subscription_id, fabric_name=fabric_name, intent_object_name=intent_object_name, + api_version=api_version, template_url=self.delete.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [204]: @@ -296,5 +321,5 @@ async def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/backupProtectionIntent/{intentObjectName}'} # type: ignore + delete.metadata = {'url': "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/backupProtectionIntent/{intentObjectName}"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protection_policies_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protection_policies_operations.py index 93b8ad39e43b..077a6bbc9a7d 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protection_policies_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protection_policies_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar, Union from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -76,18 +75,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + request = build_get_request( vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, policy_name=policy_name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -101,7 +107,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName}"} # type: ignore @distributed_trace_async @@ -138,6 +144,7 @@ async def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ProtectionPolicyResource') @@ -147,6 +154,7 @@ async def create_or_update( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, policy_name=policy_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], @@ -154,7 +162,11 @@ async def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -170,10 +182,10 @@ async def create_or_update( return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName}'} # type: ignore + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, vault_name: str, resource_group_name: str, @@ -186,18 +198,25 @@ async def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + request = build_delete_request_initial( vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, policy_name=policy_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -207,11 +226,11 @@ async def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName}"} # type: ignore @distributed_trace_async - async def begin_delete( + async def begin_delete( # pylint: disable=inconsistent-return-statements self, vault_name: str, resource_group_name: str, @@ -241,7 +260,8 @@ async def begin_delete( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -253,6 +273,7 @@ async def begin_delete( vault_name=vault_name, resource_group_name=resource_group_name, policy_name=policy_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -273,7 +294,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName}"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protection_policy_operation_results_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protection_policy_operation_results_operations.py index 46e216086645..70f276884f41 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protection_policy_operation_results_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protection_policy_operation_results_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -76,6 +75,8 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + request = build_get_request( vault_name=vault_name, @@ -83,12 +84,17 @@ async def get( subscription_id=self._config.subscription_id, policy_name=policy_name, operation_id=operation_id, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -102,5 +108,5 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName}/operationResults/{operationId}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName}/operationResults/{operationId}"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protection_policy_operation_statuses_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protection_policy_operation_statuses_operations.py index b55495d6a0c7..68f22d9b1bf1 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protection_policy_operation_statuses_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_protection_policy_operation_statuses_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -80,6 +79,8 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + request = build_get_request( vault_name=vault_name, @@ -87,12 +88,17 @@ async def get( subscription_id=self._config.subscription_id, policy_name=policy_name, operation_id=operation_id, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -106,5 +112,5 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName}/operations/{operationId}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName}/operations/{operationId}"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_recovery_points_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_recovery_points_operations.py index 82781c69d7b4..e953af188e7f 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_recovery_points_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_recovery_points_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -70,7 +69,7 @@ def list( :type container_name: str :param protected_item_name: Backed up item whose backup copies are to be fetched. :type protected_item_name: str - :param filter: OData filter options. + :param filter: OData filter options. Default value is None. :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either RecoveryPointResourceList or the result of @@ -79,6 +78,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicesbackup.activestamp.models.RecoveryPointResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.RecoveryPointResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -94,6 +95,7 @@ def prepare_request(next_link=None): fabric_name=fabric_name, container_name=container_name, protected_item_name=protected_item_name, + api_version=api_version, filter=filter, template_url=self.list.metadata['url'], ) @@ -109,6 +111,7 @@ def prepare_request(next_link=None): fabric_name=fabric_name, container_name=container_name, protected_item_name=protected_item_name, + api_version=api_version, filter=filter, template_url=next_link, ) @@ -127,7 +130,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -140,7 +147,7 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints"} # type: ignore @distributed_trace_async async def get( @@ -181,6 +188,8 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + request = build_get_request( vault_name=vault_name, @@ -190,12 +199,17 @@ async def get( container_name=container_name, protected_item_name=protected_item_name, recovery_point_id=recovery_point_id, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -209,5 +223,5 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_recovery_points_recommended_for_move_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_recovery_points_recommended_for_move_operations.py index fd1e4ac530d4..1cecc090375d 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_recovery_points_recommended_for_move_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_recovery_points_recommended_for_move_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -15,7 +14,6 @@ from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -80,6 +78,7 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicesbackup.activestamp.models.RecoveryPointResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType["_models.RecoveryPointResourceList"] @@ -98,6 +97,7 @@ def prepare_request(next_link=None): fabric_name=fabric_name, container_name=container_name, protected_item_name=protected_item_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.list.metadata['url'], @@ -115,6 +115,7 @@ def prepare_request(next_link=None): fabric_name=fabric_name, container_name=container_name, protected_item_name=protected_item_name, + api_version=api_version, content_type=content_type, json=_json, template_url=next_link, @@ -134,7 +135,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -147,4 +152,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPointsRecommendedForMove'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPointsRecommendedForMove"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_recovery_services_backup_client_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_recovery_services_backup_client_operations.py index 08ac6d06db32..4ff32aa405f2 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_recovery_services_backup_client_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_recovery_services_backup_client_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar, Union from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -54,18 +53,25 @@ async def get_operation_status( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + request = build_get_operation_status_request( vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, operation_id=operation_id, + api_version=api_version, template_url=self.get_operation_status.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -80,10 +86,10 @@ async def get_operation_status( return deserialized - get_operation_status.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig/operationStatus/{operationId}'} # type: ignore + get_operation_status.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig/operationStatus/{operationId}"} # type: ignore - async def _bms_prepare_data_move_initial( + async def _bms_prepare_data_move_initial( # pylint: disable=inconsistent-return-statements self, vault_name: str, resource_group_name: str, @@ -96,6 +102,7 @@ async def _bms_prepare_data_move_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'PrepareDataMoveRequest') @@ -104,6 +111,7 @@ async def _bms_prepare_data_move_initial( vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self._bms_prepare_data_move_initial.metadata['url'], @@ -111,7 +119,11 @@ async def _bms_prepare_data_move_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -121,11 +133,11 @@ async def _bms_prepare_data_move_initial( if cls: return cls(pipeline_response, None, {}) - _bms_prepare_data_move_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig/prepareDataMove'} # type: ignore + _bms_prepare_data_move_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig/prepareDataMove"} # type: ignore @distributed_trace_async - async def begin_bms_prepare_data_move( + async def begin_bms_prepare_data_move( # pylint: disable=inconsistent-return-statements self, vault_name: str, resource_group_name: str, @@ -153,8 +165,9 @@ async def begin_bms_prepare_data_move( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -166,6 +179,7 @@ async def begin_bms_prepare_data_move( vault_name=vault_name, resource_group_name=resource_group_name, parameters=parameters, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -187,12 +201,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_bms_prepare_data_move.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig/prepareDataMove'} # type: ignore + begin_bms_prepare_data_move.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig/prepareDataMove"} # type: ignore - async def _bms_trigger_data_move_initial( + async def _bms_trigger_data_move_initial( # pylint: disable=inconsistent-return-statements self, vault_name: str, resource_group_name: str, @@ -205,6 +218,7 @@ async def _bms_trigger_data_move_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'TriggerDataMoveRequest') @@ -213,6 +227,7 @@ async def _bms_trigger_data_move_initial( vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self._bms_trigger_data_move_initial.metadata['url'], @@ -220,7 +235,11 @@ async def _bms_trigger_data_move_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -230,11 +249,11 @@ async def _bms_trigger_data_move_initial( if cls: return cls(pipeline_response, None, {}) - _bms_trigger_data_move_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig/triggerDataMove'} # type: ignore + _bms_trigger_data_move_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig/triggerDataMove"} # type: ignore @distributed_trace_async - async def begin_bms_trigger_data_move( + async def begin_bms_trigger_data_move( # pylint: disable=inconsistent-return-statements self, vault_name: str, resource_group_name: str, @@ -262,8 +281,9 @@ async def begin_bms_trigger_data_move( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -275,6 +295,7 @@ async def begin_bms_trigger_data_move( vault_name=vault_name, resource_group_name=resource_group_name, parameters=parameters, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -296,12 +317,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_bms_trigger_data_move.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig/triggerDataMove'} # type: ignore + begin_bms_trigger_data_move.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig/triggerDataMove"} # type: ignore - async def _move_recovery_point_initial( + async def _move_recovery_point_initial( # pylint: disable=inconsistent-return-statements self, vault_name: str, resource_group_name: str, @@ -318,6 +338,7 @@ async def _move_recovery_point_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'MoveRPAcrossTiersRequest') @@ -330,6 +351,7 @@ async def _move_recovery_point_initial( container_name=container_name, protected_item_name=protected_item_name, recovery_point_id=recovery_point_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self._move_recovery_point_initial.metadata['url'], @@ -337,7 +359,11 @@ async def _move_recovery_point_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: @@ -347,11 +373,11 @@ async def _move_recovery_point_initial( if cls: return cls(pipeline_response, None, {}) - _move_recovery_point_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/move'} # type: ignore + _move_recovery_point_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/move"} # type: ignore @distributed_trace_async - async def begin_move_recovery_point( + async def begin_move_recovery_point( # pylint: disable=inconsistent-return-statements self, vault_name: str, resource_group_name: str, @@ -394,8 +420,9 @@ async def begin_move_recovery_point( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -411,6 +438,7 @@ async def begin_move_recovery_point( protected_item_name=protected_item_name, recovery_point_id=recovery_point_id, parameters=parameters, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -432,7 +460,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_move_recovery_point.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/move'} # type: ignore + begin_move_recovery_point.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/move"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_resource_guard_proxies_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_resource_guard_proxies_operations.py index 654ed3c80564..c8ced6a3ca0f 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_resource_guard_proxies_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_resource_guard_proxies_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -15,7 +14,6 @@ from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -67,6 +65,8 @@ def get( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicesbackup.activestamp.models.ResourceGuardProxyBaseResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGuardProxyBaseResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -79,6 +79,7 @@ def prepare_request(next_link=None): vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) @@ -90,6 +91,7 @@ def prepare_request(next_link=None): vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -107,7 +109,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -120,4 +126,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupResourceGuardProxies'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupResourceGuardProxies"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_resource_guard_proxy_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_resource_guard_proxy_operations.py index bd6333e503fb..d4672210ef02 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_resource_guard_proxy_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_resource_guard_proxy_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -72,18 +71,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + request = build_get_request( vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, resource_guard_proxy_name=resource_guard_proxy_name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -97,7 +103,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}"} # type: ignore @distributed_trace_async @@ -129,18 +135,25 @@ async def put( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + request = build_put_request( vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, resource_guard_proxy_name=resource_guard_proxy_name, + api_version=api_version, template_url=self.put.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -154,11 +167,11 @@ async def put( return deserialized - put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}'} # type: ignore + put.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}"} # type: ignore @distributed_trace_async - async def delete( + async def delete( # pylint: disable=inconsistent-return-statements self, vault_name: str, resource_group_name: str, @@ -185,18 +198,25 @@ async def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + request = build_delete_request( vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, resource_guard_proxy_name=resource_guard_proxy_name, + api_version=api_version, template_url=self.delete.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -206,7 +226,7 @@ async def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}"} # type: ignore @distributed_trace_async @@ -240,6 +260,7 @@ async def unlock_delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'UnlockDeleteRequest') @@ -249,6 +270,7 @@ async def unlock_delete( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, resource_guard_proxy_name=resource_guard_proxy_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.unlock_delete.metadata['url'], @@ -256,7 +278,11 @@ async def unlock_delete( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -270,5 +296,5 @@ async def unlock_delete( return deserialized - unlock_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}/unlockDelete'} # type: ignore + unlock_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}/unlockDelete"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_restores_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_restores_operations.py index 0d332f2422d5..96fe93af1d7d 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_restores_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_restores_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar, Union from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -46,7 +45,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - async def _trigger_initial( + async def _trigger_initial( # pylint: disable=inconsistent-return-statements self, vault_name: str, resource_group_name: str, @@ -63,6 +62,7 @@ async def _trigger_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'RestoreRequestResource') @@ -75,6 +75,7 @@ async def _trigger_initial( container_name=container_name, protected_item_name=protected_item_name, recovery_point_id=recovery_point_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self._trigger_initial.metadata['url'], @@ -82,7 +83,11 @@ async def _trigger_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: @@ -92,11 +97,11 @@ async def _trigger_initial( if cls: return cls(pipeline_response, None, {}) - _trigger_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/restore'} # type: ignore + _trigger_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/restore"} # type: ignore @distributed_trace_async - async def begin_trigger( + async def begin_trigger( # pylint: disable=inconsistent-return-statements self, vault_name: str, resource_group_name: str, @@ -138,8 +143,9 @@ async def begin_trigger( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -155,6 +161,7 @@ async def begin_trigger( protected_item_name=protected_item_name, recovery_point_id=recovery_point_id, parameters=parameters, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -176,7 +183,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_trigger.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/restore'} # type: ignore + begin_trigger.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/restore"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_security_pins_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_security_pins_operations.py index fe391577f47b..1fdab9d67b45 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_security_pins_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_security_pins_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -59,7 +58,7 @@ async def get( :param resource_group_name: The name of the resource group where the recovery services vault is present. :type resource_group_name: str - :param parameters: security pin request. + :param parameters: security pin request. Default value is None. :type parameters: ~azure.mgmt.recoveryservicesbackup.activestamp.models.SecurityPinBase :keyword callable cls: A custom type or function that will be passed the direct response :return: TokenInformation, or the result of cls(response) @@ -72,6 +71,7 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if parameters is not None: @@ -83,6 +83,7 @@ async def get( vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.get.metadata['url'], @@ -90,7 +91,11 @@ async def get( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -104,5 +109,5 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupSecurityPIN'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupSecurityPIN"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_validate_operation_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_validate_operation_operations.py index c0764842a7b8..ea989e714317 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_validate_operation_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_validate_operation_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar, Union from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -46,7 +45,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - async def _trigger_initial( + async def _trigger_initial( # pylint: disable=inconsistent-return-statements self, vault_name: str, resource_group_name: str, @@ -59,6 +58,7 @@ async def _trigger_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ValidateOperationRequest') @@ -67,6 +67,7 @@ async def _trigger_initial( vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self._trigger_initial.metadata['url'], @@ -74,7 +75,11 @@ async def _trigger_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: @@ -84,11 +89,11 @@ async def _trigger_initial( if cls: return cls(pipeline_response, None, {}) - _trigger_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupTriggerValidateOperation'} # type: ignore + _trigger_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupTriggerValidateOperation"} # type: ignore @distributed_trace_async - async def begin_trigger( + async def begin_trigger( # pylint: disable=inconsistent-return-statements self, vault_name: str, resource_group_name: str, @@ -118,8 +123,9 @@ async def begin_trigger( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -131,6 +137,7 @@ async def begin_trigger( vault_name=vault_name, resource_group_name=resource_group_name, parameters=parameters, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -152,7 +159,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_trigger.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupTriggerValidateOperation'} # type: ignore + begin_trigger.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupTriggerValidateOperation"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_validate_operation_results_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_validate_operation_results_operations.py index d2f7b9e2eeda..b1799d23f3fa 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_validate_operation_results_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_validate_operation_results_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -74,18 +73,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + request = build_get_request( vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, operation_id=operation_id, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -101,5 +107,5 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupValidateOperationResults/{operationId}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupValidateOperationResults/{operationId}"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_validate_operation_statuses_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_validate_operation_statuses_operations.py index 72fbf7fc31f6..f4d86cde0e4f 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_validate_operation_statuses_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/aio/operations/_validate_operation_statuses_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -76,18 +75,25 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + request = build_get_request( vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, operation_id=operation_id, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -101,5 +107,5 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupValidateOperationsStatuses/{operationId}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupValidateOperationsStatuses/{operationId}"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/models/__init__.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/models/__init__.py index 7bdebc0b0085..849582866966 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/models/__init__.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/models/__init__.py @@ -273,6 +273,7 @@ from ._models_py3 import SubProtectionPolicy from ._models_py3 import TargetAFSRestoreInfo from ._models_py3 import TargetRestoreInfo +from ._models_py3 import TieringPolicy from ._models_py3 import TokenInformation from ._models_py3 import TriggerDataMoveRequest from ._models_py3 import UnlockDeleteRequest @@ -358,6 +359,7 @@ StorageType, StorageTypeState, SupportStatus, + TieringMode, Type, UsagesUnit, ValidationStatus, @@ -635,6 +637,7 @@ 'SubProtectionPolicy', 'TargetAFSRestoreInfo', 'TargetRestoreInfo', + 'TieringPolicy', 'TokenInformation', 'TriggerDataMoveRequest', 'UnlockDeleteRequest', @@ -717,6 +720,7 @@ 'StorageType', 'StorageTypeState', 'SupportStatus', + 'TieringMode', 'Type', 'UsagesUnit', 'ValidationStatus', diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/models/_models_py3.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/models/_models_py3.py index 4dec77f36ad4..d94601987d04 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/models/_models_py3.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/models/_models_py3.py @@ -128,7 +128,7 @@ class ProtectionContainer(msrest.serialization.Model): } _subtype_map = { - 'container_type': {'AzureSqlContainer': 'AzureSqlContainer', 'AzureWorkloadContainer': 'AzureWorkloadContainer', 'DPMContainer': 'DpmContainer', 'GenericContainer': 'GenericContainer', 'IaaSVMContainer': 'IaaSVMContainer', 'StorageContainer': 'AzureStorageContainer', 'Windows': 'MabContainer'} + 'container_type': {'AzureSqlContainer': 'AzureSqlContainer', 'AzureWorkloadContainer': 'AzureWorkloadContainer', 'DPMContainer': 'DpmContainer', 'GenericContainer': 'GenericContainer', 'IaasVMContainer': 'IaaSVMContainer', 'StorageContainer': 'AzureStorageContainer', 'Windows': 'MabContainer'} } def __init__( @@ -1889,7 +1889,7 @@ def __init__( :paramtype resource_group: str """ super(IaaSVMContainer, self).__init__(friendly_name=friendly_name, backup_management_type=backup_management_type, registration_status=registration_status, health_status=health_status, protectable_object_type=protectable_object_type, **kwargs) - self.container_type = 'IaaSVMContainer' # type: str + self.container_type = 'IaasVMContainer' # type: str self.virtual_machine_id = virtual_machine_id self.virtual_machine_version = virtual_machine_version self.resource_group = resource_group @@ -3700,8 +3700,18 @@ def __init__( class AzureIaaSVMProtectedItemExtendedInfo(msrest.serialization.Model): """Additional information on Azure IaaS VM specific backup item. - :ivar oldest_recovery_point: The oldest backup copy available for this backup item. + :ivar oldest_recovery_point: The oldest backup copy available for this backup item across all + tiers. :vartype oldest_recovery_point: ~datetime.datetime + :ivar oldest_recovery_point_in_vault: The oldest backup copy available for this backup item in + vault tier. + :vartype oldest_recovery_point_in_vault: ~datetime.datetime + :ivar oldest_recovery_point_in_archive: The oldest backup copy available for this backup item + in archive tier. + :vartype oldest_recovery_point_in_archive: ~datetime.datetime + :ivar newest_recovery_point_in_archive: The latest backup copy available for this backup item + in archive tier. + :vartype newest_recovery_point_in_archive: ~datetime.datetime :ivar recovery_point_count: Number of backup copies available for this backup item. :vartype recovery_point_count: int :ivar policy_inconsistent: Specifies if backup policy associated with the backup item is @@ -3711,6 +3721,9 @@ class AzureIaaSVMProtectedItemExtendedInfo(msrest.serialization.Model): _attribute_map = { 'oldest_recovery_point': {'key': 'oldestRecoveryPoint', 'type': 'iso-8601'}, + 'oldest_recovery_point_in_vault': {'key': 'oldestRecoveryPointInVault', 'type': 'iso-8601'}, + 'oldest_recovery_point_in_archive': {'key': 'oldestRecoveryPointInArchive', 'type': 'iso-8601'}, + 'newest_recovery_point_in_archive': {'key': 'newestRecoveryPointInArchive', 'type': 'iso-8601'}, 'recovery_point_count': {'key': 'recoveryPointCount', 'type': 'int'}, 'policy_inconsistent': {'key': 'policyInconsistent', 'type': 'bool'}, } @@ -3719,13 +3732,26 @@ def __init__( self, *, oldest_recovery_point: Optional[datetime.datetime] = None, + oldest_recovery_point_in_vault: Optional[datetime.datetime] = None, + oldest_recovery_point_in_archive: Optional[datetime.datetime] = None, + newest_recovery_point_in_archive: Optional[datetime.datetime] = None, recovery_point_count: Optional[int] = None, policy_inconsistent: Optional[bool] = None, **kwargs ): """ - :keyword oldest_recovery_point: The oldest backup copy available for this backup item. + :keyword oldest_recovery_point: The oldest backup copy available for this backup item across + all tiers. :paramtype oldest_recovery_point: ~datetime.datetime + :keyword oldest_recovery_point_in_vault: The oldest backup copy available for this backup item + in vault tier. + :paramtype oldest_recovery_point_in_vault: ~datetime.datetime + :keyword oldest_recovery_point_in_archive: The oldest backup copy available for this backup + item in archive tier. + :paramtype oldest_recovery_point_in_archive: ~datetime.datetime + :keyword newest_recovery_point_in_archive: The latest backup copy available for this backup + item in archive tier. + :paramtype newest_recovery_point_in_archive: ~datetime.datetime :keyword recovery_point_count: Number of backup copies available for this backup item. :paramtype recovery_point_count: int :keyword policy_inconsistent: Specifies if backup policy associated with the backup item is @@ -3734,6 +3760,9 @@ def __init__( """ super(AzureIaaSVMProtectedItemExtendedInfo, self).__init__(**kwargs) self.oldest_recovery_point = oldest_recovery_point + self.oldest_recovery_point_in_vault = oldest_recovery_point_in_vault + self.oldest_recovery_point_in_archive = oldest_recovery_point_in_archive + self.newest_recovery_point_in_archive = newest_recovery_point_in_archive self.recovery_point_count = recovery_point_count self.policy_inconsistent = policy_inconsistent @@ -3758,6 +3787,11 @@ class AzureIaaSVMProtectionPolicy(ProtectionPolicy): :ivar retention_policy: Retention policy with the details on backup copy retention ranges. :vartype retention_policy: ~azure.mgmt.recoveryservicesbackup.activestamp.models.RetentionPolicy + :ivar tiering_policy: Tiering policy to automatically move RPs to another tier + Key is Target Tier, defined in RecoveryPointTierType enum. + Tiering policy specifies the criteria to move RP to the target tier. + :vartype tiering_policy: dict[str, + ~azure.mgmt.recoveryservicesbackup.activestamp.models.TieringPolicy] :ivar instant_rp_retention_range_in_days: Instant RP retention policy range in days. :vartype instant_rp_retention_range_in_days: int :ivar time_zone: TimeZone optional input as string. For example: TimeZone = "Pacific Standard @@ -3779,6 +3813,7 @@ class AzureIaaSVMProtectionPolicy(ProtectionPolicy): 'instant_rp_details': {'key': 'instantRPDetails', 'type': 'InstantRPAdditionalDetails'}, 'schedule_policy': {'key': 'schedulePolicy', 'type': 'SchedulePolicy'}, 'retention_policy': {'key': 'retentionPolicy', 'type': 'RetentionPolicy'}, + 'tiering_policy': {'key': 'tieringPolicy', 'type': '{TieringPolicy}'}, 'instant_rp_retention_range_in_days': {'key': 'instantRpRetentionRangeInDays', 'type': 'int'}, 'time_zone': {'key': 'timeZone', 'type': 'str'}, 'policy_type': {'key': 'policyType', 'type': 'str'}, @@ -3792,6 +3827,7 @@ def __init__( instant_rp_details: Optional["InstantRPAdditionalDetails"] = None, schedule_policy: Optional["SchedulePolicy"] = None, retention_policy: Optional["RetentionPolicy"] = None, + tiering_policy: Optional[Dict[str, "TieringPolicy"]] = None, instant_rp_retention_range_in_days: Optional[int] = None, time_zone: Optional[str] = None, policy_type: Optional[Union[str, "IAASVMPolicyType"]] = None, @@ -3811,6 +3847,11 @@ def __init__( :keyword retention_policy: Retention policy with the details on backup copy retention ranges. :paramtype retention_policy: ~azure.mgmt.recoveryservicesbackup.activestamp.models.RetentionPolicy + :keyword tiering_policy: Tiering policy to automatically move RPs to another tier + Key is Target Tier, defined in RecoveryPointTierType enum. + Tiering policy specifies the criteria to move RP to the target tier. + :paramtype tiering_policy: dict[str, + ~azure.mgmt.recoveryservicesbackup.activestamp.models.TieringPolicy] :keyword instant_rp_retention_range_in_days: Instant RP retention policy range in days. :paramtype instant_rp_retention_range_in_days: int :keyword time_zone: TimeZone optional input as string. For example: TimeZone = "Pacific @@ -3825,6 +3866,7 @@ def __init__( self.instant_rp_details = instant_rp_details self.schedule_policy = schedule_policy self.retention_policy = retention_policy + self.tiering_policy = tiering_policy self.instant_rp_retention_range_in_days = instant_rp_retention_range_in_days self.time_zone = time_zone self.policy_type = policy_type @@ -6037,8 +6079,18 @@ def __init__( class AzureVmWorkloadProtectedItemExtendedInfo(msrest.serialization.Model): """Additional information on Azure Workload for SQL specific backup item. - :ivar oldest_recovery_point: The oldest backup copy available for this backup item. + :ivar oldest_recovery_point: The oldest backup copy available for this backup item across all + tiers. :vartype oldest_recovery_point: ~datetime.datetime + :ivar oldest_recovery_point_in_vault: The oldest backup copy available for this backup item in + vault tier. + :vartype oldest_recovery_point_in_vault: ~datetime.datetime + :ivar oldest_recovery_point_in_archive: The oldest backup copy available for this backup item + in archive tier. + :vartype oldest_recovery_point_in_archive: ~datetime.datetime + :ivar newest_recovery_point_in_archive: The latest backup copy available for this backup item + in archive tier. + :vartype newest_recovery_point_in_archive: ~datetime.datetime :ivar recovery_point_count: Number of backup copies available for this backup item. :vartype recovery_point_count: int :ivar policy_state: Indicates consistency of policy object and policy applied to this backup @@ -6051,6 +6103,9 @@ class AzureVmWorkloadProtectedItemExtendedInfo(msrest.serialization.Model): _attribute_map = { 'oldest_recovery_point': {'key': 'oldestRecoveryPoint', 'type': 'iso-8601'}, + 'oldest_recovery_point_in_vault': {'key': 'oldestRecoveryPointInVault', 'type': 'iso-8601'}, + 'oldest_recovery_point_in_archive': {'key': 'oldestRecoveryPointInArchive', 'type': 'iso-8601'}, + 'newest_recovery_point_in_archive': {'key': 'newestRecoveryPointInArchive', 'type': 'iso-8601'}, 'recovery_point_count': {'key': 'recoveryPointCount', 'type': 'int'}, 'policy_state': {'key': 'policyState', 'type': 'str'}, 'recovery_model': {'key': 'recoveryModel', 'type': 'str'}, @@ -6060,14 +6115,27 @@ def __init__( self, *, oldest_recovery_point: Optional[datetime.datetime] = None, + oldest_recovery_point_in_vault: Optional[datetime.datetime] = None, + oldest_recovery_point_in_archive: Optional[datetime.datetime] = None, + newest_recovery_point_in_archive: Optional[datetime.datetime] = None, recovery_point_count: Optional[int] = None, policy_state: Optional[str] = None, recovery_model: Optional[str] = None, **kwargs ): """ - :keyword oldest_recovery_point: The oldest backup copy available for this backup item. + :keyword oldest_recovery_point: The oldest backup copy available for this backup item across + all tiers. :paramtype oldest_recovery_point: ~datetime.datetime + :keyword oldest_recovery_point_in_vault: The oldest backup copy available for this backup item + in vault tier. + :paramtype oldest_recovery_point_in_vault: ~datetime.datetime + :keyword oldest_recovery_point_in_archive: The oldest backup copy available for this backup + item in archive tier. + :paramtype oldest_recovery_point_in_archive: ~datetime.datetime + :keyword newest_recovery_point_in_archive: The latest backup copy available for this backup + item in archive tier. + :paramtype newest_recovery_point_in_archive: ~datetime.datetime :keyword recovery_point_count: Number of backup copies available for this backup item. :paramtype recovery_point_count: int :keyword policy_state: Indicates consistency of policy object and policy applied to this backup @@ -6079,6 +6147,9 @@ def __init__( """ super(AzureVmWorkloadProtectedItemExtendedInfo, self).__init__(**kwargs) self.oldest_recovery_point = oldest_recovery_point + self.oldest_recovery_point_in_vault = oldest_recovery_point_in_vault + self.oldest_recovery_point_in_archive = oldest_recovery_point_in_archive + self.newest_recovery_point_in_archive = newest_recovery_point_in_archive self.recovery_point_count = recovery_point_count self.policy_state = policy_state self.recovery_model = recovery_model @@ -18990,12 +19061,18 @@ class SubProtectionPolicy(msrest.serialization.Model): :ivar retention_policy: Retention policy with the details on backup copy retention ranges. :vartype retention_policy: ~azure.mgmt.recoveryservicesbackup.activestamp.models.RetentionPolicy + :ivar tiering_policy: Tiering policy to automatically move RPs to another tier. + Key is Target Tier, defined in RecoveryPointTierType enum. + Tiering policy specifies the criteria to move RP to the target tier. + :vartype tiering_policy: dict[str, + ~azure.mgmt.recoveryservicesbackup.activestamp.models.TieringPolicy] """ _attribute_map = { 'policy_type': {'key': 'policyType', 'type': 'str'}, 'schedule_policy': {'key': 'schedulePolicy', 'type': 'SchedulePolicy'}, 'retention_policy': {'key': 'retentionPolicy', 'type': 'RetentionPolicy'}, + 'tiering_policy': {'key': 'tieringPolicy', 'type': '{TieringPolicy}'}, } def __init__( @@ -19004,6 +19081,7 @@ def __init__( policy_type: Optional[Union[str, "PolicyType"]] = None, schedule_policy: Optional["SchedulePolicy"] = None, retention_policy: Optional["RetentionPolicy"] = None, + tiering_policy: Optional[Dict[str, "TieringPolicy"]] = None, **kwargs ): """ @@ -19016,11 +19094,17 @@ def __init__( :keyword retention_policy: Retention policy with the details on backup copy retention ranges. :paramtype retention_policy: ~azure.mgmt.recoveryservicesbackup.activestamp.models.RetentionPolicy + :keyword tiering_policy: Tiering policy to automatically move RPs to another tier. + Key is Target Tier, defined in RecoveryPointTierType enum. + Tiering policy specifies the criteria to move RP to the target tier. + :paramtype tiering_policy: dict[str, + ~azure.mgmt.recoveryservicesbackup.activestamp.models.TieringPolicy] """ super(SubProtectionPolicy, self).__init__(**kwargs) self.policy_type = policy_type self.schedule_policy = schedule_policy self.retention_policy = retention_policy + self.tiering_policy = tiering_policy class TargetAFSRestoreInfo(msrest.serialization.Model): @@ -19107,6 +19191,73 @@ def __init__( self.target_directory_for_file_restore = target_directory_for_file_restore +class TieringPolicy(msrest.serialization.Model): + """Tiering Policy for a target tier. +If the policy is not specified for a given target tier, service retains the existing configured tiering policy for that tier. + + :ivar tiering_mode: Tiering Mode to control automatic tiering of recovery points. Supported + values are: + + + #. TierRecommended: Tier all recovery points recommended to be tiered + #. TierAfter: Tier all recovery points after a fixed period, as specified in duration + + durationType below. + #. DoNotTier: Do not tier any recovery points. Possible values include: "Invalid", + "TierRecommended", "TierAfter", "DoNotTier". + :vartype tiering_mode: str or ~azure.mgmt.recoveryservicesbackup.activestamp.models.TieringMode + :ivar duration: Number of days/weeks/months/years to retain backups in current tier before + tiering. + Used only if TieringMode is set to TierAfter. + :vartype duration: int + :ivar duration_type: Retention duration type: days/weeks/months/years + Used only if TieringMode is set to TierAfter. Possible values include: "Invalid", "Days", + "Weeks", "Months", "Years". + :vartype duration_type: str or + ~azure.mgmt.recoveryservicesbackup.activestamp.models.RetentionDurationType + """ + + _attribute_map = { + 'tiering_mode': {'key': 'tieringMode', 'type': 'str'}, + 'duration': {'key': 'duration', 'type': 'int'}, + 'duration_type': {'key': 'durationType', 'type': 'str'}, + } + + def __init__( + self, + *, + tiering_mode: Optional[Union[str, "TieringMode"]] = None, + duration: Optional[int] = None, + duration_type: Optional[Union[str, "RetentionDurationType"]] = None, + **kwargs + ): + """ + :keyword tiering_mode: Tiering Mode to control automatic tiering of recovery points. Supported + values are: + + + #. TierRecommended: Tier all recovery points recommended to be tiered + #. TierAfter: Tier all recovery points after a fixed period, as specified in duration + + durationType below. + #. DoNotTier: Do not tier any recovery points. Possible values include: "Invalid", + "TierRecommended", "TierAfter", "DoNotTier". + :paramtype tiering_mode: str or + ~azure.mgmt.recoveryservicesbackup.activestamp.models.TieringMode + :keyword duration: Number of days/weeks/months/years to retain backups in current tier before + tiering. + Used only if TieringMode is set to TierAfter. + :paramtype duration: int + :keyword duration_type: Retention duration type: days/weeks/months/years + Used only if TieringMode is set to TierAfter. Possible values include: "Invalid", "Days", + "Weeks", "Months", "Years". + :paramtype duration_type: str or + ~azure.mgmt.recoveryservicesbackup.activestamp.models.RetentionDurationType + """ + super(TieringPolicy, self).__init__(**kwargs) + self.tiering_mode = tiering_mode + self.duration = duration + self.duration_type = duration_type + + class TokenInformation(msrest.serialization.Model): """The token information details. diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/models/_recovery_services_backup_client_enums.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/models/_recovery_services_backup_client_enums.py index 9786bcee9164..a36cd410d97d 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/models/_recovery_services_backup_client_enums.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/models/_recovery_services_backup_client_enums.py @@ -643,6 +643,21 @@ class SupportStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): DEFAULT_ON = "DefaultON" NOT_SUPPORTED = "NotSupported" +class TieringMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Tiering Mode to control automatic tiering of recovery points. Supported values are: + + + #. TierRecommended: Tier all recovery points recommended to be tiered + #. TierAfter: Tier all recovery points after a fixed period, as specified in duration + + durationType below. + #. DoNotTier: Do not tier any recovery points + """ + + INVALID = "Invalid" + TIER_RECOMMENDED = "TierRecommended" + TIER_AFTER = "TierAfter" + DO_NOT_TIER = "DoNotTier" + class Type(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Backup management type for this container. """ diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_engines_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_engines_operations.py index 063090369ad2..a2b2b38b2a2a 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_engines_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_engines_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -35,35 +35,36 @@ def build_list_request( skip_token: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-12-01" + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupEngines') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupEngines") # pylint: disable=line-too-long path_format_arguments = { "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if filter is not None: - query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') if skip_token is not None: - query_parameters['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, 'str') + _query_parameters['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -78,10 +79,11 @@ def build_get_request( skip_token: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-12-01" + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupEngines/{backupEngineName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupEngines/{backupEngineName}") # pylint: disable=line-too-long path_format_arguments = { "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -89,25 +91,25 @@ def build_get_request( "backupEngineName": _SERIALIZER.url("backup_engine_name", backup_engine_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if filter is not None: - query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') if skip_token is not None: - query_parameters['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, 'str') + _query_parameters['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -150,9 +152,9 @@ def list( :param resource_group_name: The name of the resource group where the recovery services vault is present. :type resource_group_name: str - :param filter: OData filter options. + :param filter: OData filter options. Default value is None. :type filter: str - :param skip_token: skipToken Filter. + :param skip_token: skipToken Filter. Default value is None. :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either BackupEngineBaseResourceList or the result of @@ -161,6 +163,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupEngineBaseResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupEngineBaseResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -173,6 +177,7 @@ def prepare_request(next_link=None): vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, filter=filter, skip_token=skip_token, template_url=self.list.metadata['url'], @@ -186,6 +191,7 @@ def prepare_request(next_link=None): vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, filter=filter, skip_token=skip_token, template_url=next_link, @@ -205,7 +211,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -218,7 +228,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupEngines'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupEngines"} # type: ignore @distributed_trace def get( @@ -239,9 +249,9 @@ def get( :type resource_group_name: str :param backup_engine_name: Name of the backup management server. :type backup_engine_name: str - :param filter: OData filter options. + :param filter: OData filter options. Default value is None. :type filter: str - :param skip_token: skipToken Filter. + :param skip_token: skipToken Filter. Default value is None. :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response :return: BackupEngineBaseResource, or the result of cls(response) @@ -254,12 +264,15 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + request = build_get_request( vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, backup_engine_name=backup_engine_name, + api_version=api_version, filter=filter, skip_token=skip_token, template_url=self.get.metadata['url'], @@ -267,7 +280,11 @@ def get( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -281,5 +298,5 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupEngines/{backupEngineName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupEngines/{backupEngineName}"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_jobs_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_jobs_operations.py index 9a444da36ea4..cfbcaad0327a 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_jobs_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_jobs_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -35,35 +35,36 @@ def build_list_request( skip_token: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-12-01" + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobs') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobs") # pylint: disable=line-too-long path_format_arguments = { "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if filter is not None: - query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') if skip_token is not None: - query_parameters['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, 'str') + _query_parameters['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -105,9 +106,9 @@ def list( :param resource_group_name: The name of the resource group where the recovery services vault is present. :type resource_group_name: str - :param filter: OData filter options. + :param filter: OData filter options. Default value is None. :type filter: str - :param skip_token: skipToken Filter. + :param skip_token: skipToken Filter. Default value is None. :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either JobResourceList or the result of cls(response) @@ -115,6 +116,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicesbackup.activestamp.models.JobResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.JobResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -127,6 +130,7 @@ def prepare_request(next_link=None): vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, filter=filter, skip_token=skip_token, template_url=self.list.metadata['url'], @@ -140,6 +144,7 @@ def prepare_request(next_link=None): vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, filter=filter, skip_token=skip_token, template_url=next_link, @@ -159,7 +164,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -172,4 +181,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobs'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobs"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_operation_results_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_operation_results_operations.py index deead08172cc..2a46be0206e0 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_operation_results_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_operation_results_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -15,7 +16,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -32,10 +32,11 @@ def build_get_request( operation_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-12-01" + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupOperationResults/{operationId}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupOperationResults/{operationId}") # pylint: disable=line-too-long path_format_arguments = { "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -43,21 +44,21 @@ def build_get_request( "operationId": _SERIALIZER.url("operation_id", operation_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -84,7 +85,7 @@ def __init__(self, client, config, serializer, deserializer): self._config = config @distributed_trace - def get( + def get( # pylint: disable=inconsistent-return-statements self, vault_name: str, resource_group_name: str, @@ -117,18 +118,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + request = build_get_request( vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, operation_id=operation_id, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -138,5 +146,5 @@ def get( if cls: return cls(pipeline_response, None, {}) - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupOperationResults/{operationId}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupOperationResults/{operationId}"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_operation_statuses_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_operation_statuses_operations.py index 9d499fb692d9..14b08c164a9a 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_operation_statuses_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_operation_statuses_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -15,7 +16,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -32,10 +32,11 @@ def build_get_request( operation_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-12-01" + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupOperations/{operationId}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupOperations/{operationId}") # pylint: disable=line-too-long path_format_arguments = { "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -43,21 +44,21 @@ def build_get_request( "operationId": _SERIALIZER.url("operation_id", operation_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -115,18 +116,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + request = build_get_request( vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, operation_id=operation_id, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -140,5 +148,5 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupOperations/{operationId}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupOperations/{operationId}"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_policies_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_policies_operations.py index 4f01fc30f277..a91715e26431 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_policies_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_policies_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -34,33 +34,34 @@ def build_list_request( filter: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-12-01" + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies") # pylint: disable=line-too-long path_format_arguments = { "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if filter is not None: - query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -103,7 +104,7 @@ def list( :param resource_group_name: The name of the resource group where the recovery services vault is present. :type resource_group_name: str - :param filter: OData filter options. + :param filter: OData filter options. Default value is None. :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ProtectionPolicyResourceList or the result of @@ -112,6 +113,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionPolicyResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProtectionPolicyResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -124,6 +127,7 @@ def prepare_request(next_link=None): vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, filter=filter, template_url=self.list.metadata['url'], ) @@ -136,6 +140,7 @@ def prepare_request(next_link=None): vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, filter=filter, template_url=next_link, ) @@ -154,7 +159,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -167,4 +176,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_protectable_items_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_protectable_items_operations.py index e97f3c00cb5b..a818eebb1e83 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_protectable_items_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_protectable_items_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -35,35 +35,36 @@ def build_list_request( skip_token: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-12-01" + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectableItems') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectableItems") # pylint: disable=line-too-long path_format_arguments = { "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if filter is not None: - query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') if skip_token is not None: - query_parameters['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, 'str') + _query_parameters['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -107,9 +108,9 @@ def list( :param resource_group_name: The name of the resource group where the recovery services vault is present. :type resource_group_name: str - :param filter: OData filter options. + :param filter: OData filter options. Default value is None. :type filter: str - :param skip_token: skipToken Filter. + :param skip_token: skipToken Filter. Default value is None. :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either WorkloadProtectableItemResourceList or the result @@ -118,6 +119,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicesbackup.activestamp.models.WorkloadProtectableItemResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadProtectableItemResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -130,6 +133,7 @@ def prepare_request(next_link=None): vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, filter=filter, skip_token=skip_token, template_url=self.list.metadata['url'], @@ -143,6 +147,7 @@ def prepare_request(next_link=None): vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, filter=filter, skip_token=skip_token, template_url=next_link, @@ -162,7 +167,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -175,4 +184,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectableItems'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectableItems"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_protected_items_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_protected_items_operations.py index 4d54fb0fbc87..8d209af63dc0 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_protected_items_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_protected_items_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -35,35 +35,36 @@ def build_list_request( skip_token: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-12-01" + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectedItems') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectedItems") # pylint: disable=line-too-long path_format_arguments = { "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if filter is not None: - query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') if skip_token is not None: - query_parameters['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, 'str') + _query_parameters['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -105,9 +106,9 @@ def list( :param resource_group_name: The name of the resource group where the recovery services vault is present. :type resource_group_name: str - :param filter: OData filter options. + :param filter: OData filter options. Default value is None. :type filter: str - :param skip_token: skipToken Filter. + :param skip_token: skipToken Filter. Default value is None. :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ProtectedItemResourceList or the result of @@ -116,6 +117,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectedItemResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProtectedItemResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -128,6 +131,7 @@ def prepare_request(next_link=None): vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, filter=filter, skip_token=skip_token, template_url=self.list.metadata['url'], @@ -141,6 +145,7 @@ def prepare_request(next_link=None): vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, filter=filter, skip_token=skip_token, template_url=next_link, @@ -160,7 +165,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -173,4 +182,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectedItems'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectedItems"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_protection_containers_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_protection_containers_operations.py index e56c40550f89..d3e762b9dbc6 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_protection_containers_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_protection_containers_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -34,33 +34,34 @@ def build_list_request( filter: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-12-01" + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectionContainers') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectionContainers") # pylint: disable=line-too-long path_format_arguments = { "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if filter is not None: - query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -101,7 +102,7 @@ def list( :param resource_group_name: The name of the resource group where the recovery services vault is present. :type resource_group_name: str - :param filter: OData filter options. + :param filter: OData filter options. Default value is None. :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ProtectionContainerResourceList or the result of @@ -110,6 +111,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionContainerResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProtectionContainerResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -122,6 +125,7 @@ def prepare_request(next_link=None): vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, filter=filter, template_url=self.list.metadata['url'], ) @@ -134,6 +138,7 @@ def prepare_request(next_link=None): vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, filter=filter, template_url=next_link, ) @@ -152,7 +157,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -165,4 +174,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectionContainers'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectionContainers"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_protection_intent_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_protection_intent_operations.py index 38d783557bf4..54d10eda1650 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_protection_intent_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_protection_intent_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -35,35 +35,36 @@ def build_list_request( skip_token: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-12-01" + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectionIntents') + _url = kwargs.pop("template_url", "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectionIntents") # pylint: disable=line-too-long path_format_arguments = { "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if filter is not None: - query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') if skip_token is not None: - query_parameters['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, 'str') + _query_parameters['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -105,9 +106,9 @@ def list( :param resource_group_name: The name of the resource group where the recovery services vault is present. :type resource_group_name: str - :param filter: OData filter options. + :param filter: OData filter options. Default value is None. :type filter: str - :param skip_token: skipToken Filter. + :param skip_token: skipToken Filter. Default value is None. :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ProtectionIntentResourceList or the result of @@ -116,6 +117,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectionIntentResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProtectionIntentResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -128,6 +131,7 @@ def prepare_request(next_link=None): vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, filter=filter, skip_token=skip_token, template_url=self.list.metadata['url'], @@ -141,6 +145,7 @@ def prepare_request(next_link=None): vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, filter=filter, skip_token=skip_token, template_url=next_link, @@ -160,7 +165,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -173,4 +182,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectionIntents'} # type: ignore + list.metadata = {'url': "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectionIntents"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_resource_encryption_configs_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_resource_encryption_configs_operations.py index fbba1c14642d..7e3531bf4ed9 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_resource_encryption_configs_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_resource_encryption_configs_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -15,7 +16,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -32,31 +32,32 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-12-01" + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupEncryptionConfigs/backupResourceEncryptionConfig') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupEncryptionConfigs/backupResourceEncryptionConfig") # pylint: disable=line-too-long path_format_arguments = { "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -70,35 +71,35 @@ def build_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupEncryptionConfigs/backupResourceEncryptionConfig') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupEncryptionConfigs/backupResourceEncryptionConfig") # pylint: disable=line-too-long path_format_arguments = { "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -152,17 +153,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + request = build_get_request( vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -177,11 +185,11 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupEncryptionConfigs/backupResourceEncryptionConfig'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupEncryptionConfigs/backupResourceEncryptionConfig"} # type: ignore @distributed_trace - def update( + def update( # pylint: disable=inconsistent-return-statements self, vault_name: str, resource_group_name: str, @@ -209,6 +217,7 @@ def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'BackupResourceEncryptionConfigResource') @@ -217,6 +226,7 @@ def update( vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.update.metadata['url'], @@ -224,7 +234,11 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -235,5 +249,5 @@ def update( if cls: return cls(pipeline_response, None, {}) - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupEncryptionConfigs/backupResourceEncryptionConfig'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupEncryptionConfigs/backupResourceEncryptionConfig"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_resource_storage_configs_non_crr_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_resource_storage_configs_non_crr_operations.py index 804a4bcccb25..b2c2ae1202b6 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_resource_storage_configs_non_crr_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_resource_storage_configs_non_crr_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -15,7 +16,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -32,31 +32,32 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-12-01" + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig') + _url = kwargs.pop("template_url", "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig") # pylint: disable=line-too-long path_format_arguments = { "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -70,35 +71,35 @@ def build_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig') + _url = kwargs.pop("template_url", "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig") # pylint: disable=line-too-long path_format_arguments = { "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -114,35 +115,35 @@ def build_patch_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig') + _url = kwargs.pop("template_url", "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig") # pylint: disable=line-too-long path_format_arguments = { "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -195,17 +196,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + request = build_get_request( vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -220,7 +228,7 @@ def get( return deserialized - get.metadata = {'url': '/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig'} # type: ignore + get.metadata = {'url': "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig"} # type: ignore @distributed_trace @@ -252,6 +260,7 @@ def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'BackupResourceConfigResource') @@ -260,6 +269,7 @@ def update( vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.update.metadata['url'], @@ -267,7 +277,11 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -282,11 +296,11 @@ def update( return deserialized - update.metadata = {'url': '/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig'} # type: ignore + update.metadata = {'url': "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig"} # type: ignore @distributed_trace - def patch( + def patch( # pylint: disable=inconsistent-return-statements self, vault_name: str, resource_group_name: str, @@ -314,6 +328,7 @@ def patch( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'BackupResourceConfigResource') @@ -322,6 +337,7 @@ def patch( vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.patch.metadata['url'], @@ -329,7 +345,11 @@ def patch( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [204]: @@ -340,5 +360,5 @@ def patch( if cls: return cls(pipeline_response, None, {}) - patch.metadata = {'url': '/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig'} # type: ignore + patch.metadata = {'url': "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_resource_vault_configs_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_resource_vault_configs_operations.py index 8f7ff43a703b..aae1b5fa7e01 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_resource_vault_configs_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_resource_vault_configs_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -15,7 +16,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -32,31 +32,32 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-12-01" + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupconfig/vaultconfig') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupconfig/vaultconfig") # pylint: disable=line-too-long path_format_arguments = { "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -70,35 +71,35 @@ def build_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupconfig/vaultconfig') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupconfig/vaultconfig") # pylint: disable=line-too-long path_format_arguments = { "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -114,35 +115,35 @@ def build_put_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupconfig/vaultconfig') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupconfig/vaultconfig") # pylint: disable=line-too-long path_format_arguments = { "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -195,17 +196,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + request = build_get_request( vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -220,7 +228,7 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupconfig/vaultconfig'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupconfig/vaultconfig"} # type: ignore @distributed_trace @@ -252,6 +260,7 @@ def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'BackupResourceVaultConfigResource') @@ -260,6 +269,7 @@ def update( vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.update.metadata['url'], @@ -267,7 +277,11 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -282,7 +296,7 @@ def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupconfig/vaultconfig'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupconfig/vaultconfig"} # type: ignore @distributed_trace @@ -314,6 +328,7 @@ def put( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'BackupResourceVaultConfigResource') @@ -322,6 +337,7 @@ def put( vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.put.metadata['url'], @@ -329,7 +345,11 @@ def put( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -344,5 +364,5 @@ def put( return deserialized - put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupconfig/vaultconfig'} # type: ignore + put.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupconfig/vaultconfig"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_status_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_status_operations.py index 3a3e388d310a..98d752a160d6 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_status_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_status_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -15,7 +16,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -34,34 +34,34 @@ def build_get_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/Subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupStatus') + _url = kwargs.pop("template_url", "/Subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupStatus") # pylint: disable=line-too-long path_format_arguments = { "azureRegion": _SERIALIZER.url("azure_region", azure_region, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -115,6 +115,7 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'BackupStatusRequest') @@ -122,6 +123,7 @@ def get( request = build_get_request( azure_region=azure_region, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.get.metadata['url'], @@ -129,7 +131,11 @@ def get( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -143,5 +149,5 @@ def get( return deserialized - get.metadata = {'url': '/Subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupStatus'} # type: ignore + get.metadata = {'url': "/Subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupStatus"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_usage_summaries_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_usage_summaries_operations.py index fe1b940ecbec..57177686009c 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_usage_summaries_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_usage_summaries_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -35,35 +35,36 @@ def build_list_request( skip_token: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-12-01" + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupUsageSummaries') + _url = kwargs.pop("template_url", "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupUsageSummaries") # pylint: disable=line-too-long path_format_arguments = { "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if filter is not None: - query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') if skip_token is not None: - query_parameters['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, 'str') + _query_parameters['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -105,9 +106,9 @@ def list( :param resource_group_name: The name of the resource group where the recovery services vault is present. :type resource_group_name: str - :param filter: OData filter options. + :param filter: OData filter options. Default value is None. :type filter: str - :param skip_token: skipToken Filter. + :param skip_token: skipToken Filter. Default value is None. :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either BackupManagementUsageList or the result of @@ -116,6 +117,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicesbackup.activestamp.models.BackupManagementUsageList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupManagementUsageList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -128,6 +131,7 @@ def prepare_request(next_link=None): vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, filter=filter, skip_token=skip_token, template_url=self.list.metadata['url'], @@ -141,6 +145,7 @@ def prepare_request(next_link=None): vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, filter=filter, skip_token=skip_token, template_url=next_link, @@ -160,7 +165,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -173,4 +182,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupUsageSummaries'} # type: ignore + list.metadata = {'url': "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupUsageSummaries"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_workload_items_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_workload_items_operations.py index 5c96080eb4b3..005dcf53eaed 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_workload_items_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backup_workload_items_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -37,10 +37,11 @@ def build_list_request( skip_token: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-12-01" + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/items') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/items") # pylint: disable=line-too-long path_format_arguments = { "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -49,25 +50,25 @@ def build_list_request( "containerName": _SERIALIZER.url("container_name", container_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if filter is not None: - query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') if skip_token is not None: - query_parameters['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, 'str') + _query_parameters['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -117,9 +118,9 @@ def list( :type fabric_name: str :param container_name: Name of the container. :type container_name: str - :param filter: OData filter options. + :param filter: OData filter options. Default value is None. :type filter: str - :param skip_token: skipToken Filter. + :param skip_token: skipToken Filter. Default value is None. :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either WorkloadItemResourceList or the result of @@ -128,6 +129,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicesbackup.activestamp.models.WorkloadItemResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.WorkloadItemResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -142,6 +145,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, fabric_name=fabric_name, container_name=container_name, + api_version=api_version, filter=filter, skip_token=skip_token, template_url=self.list.metadata['url'], @@ -157,6 +161,7 @@ def prepare_request(next_link=None): subscription_id=self._config.subscription_id, fabric_name=fabric_name, container_name=container_name, + api_version=api_version, filter=filter, skip_token=skip_token, template_url=next_link, @@ -176,7 +181,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -189,4 +198,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/items'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/items"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backups_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backups_operations.py index de550b08164d..b31ebfaa3407 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backups_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_backups_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -15,7 +16,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -38,12 +38,12 @@ def build_trigger_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/backup') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/backup") # pylint: disable=line-too-long path_format_arguments = { "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -53,23 +53,23 @@ def build_trigger_request( "protectedItemName": _SERIALIZER.url("protected_item_name", protected_item_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -98,7 +98,7 @@ def __init__(self, client, config, serializer, deserializer): self._config = config @distributed_trace - def trigger( + def trigger( # pylint: disable=inconsistent-return-statements self, vault_name: str, resource_group_name: str, @@ -136,6 +136,7 @@ def trigger( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'BackupRequestResource') @@ -147,6 +148,7 @@ def trigger( fabric_name=fabric_name, container_name=container_name, protected_item_name=protected_item_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.trigger.metadata['url'], @@ -154,7 +156,11 @@ def trigger( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: @@ -164,5 +170,5 @@ def trigger( if cls: return cls(pipeline_response, None, {}) - trigger.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/backup'} # type: ignore + trigger.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/backup"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_bms_prepare_data_move_operation_result_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_bms_prepare_data_move_operation_result_operations.py index 73ee06a27484..e369961c0248 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_bms_prepare_data_move_operation_result_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_bms_prepare_data_move_operation_result_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -15,7 +16,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -32,10 +32,11 @@ def build_get_request( operation_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-12-01" + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig/operationResults/{operationId}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig/operationResults/{operationId}") # pylint: disable=line-too-long path_format_arguments = { "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -43,21 +44,21 @@ def build_get_request( "operationId": _SERIALIZER.url("operation_id", operation_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -113,18 +114,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + request = build_get_request( vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, operation_id=operation_id, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -141,5 +149,5 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig/operationResults/{operationId}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig/operationResults/{operationId}"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_export_jobs_operation_results_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_export_jobs_operation_results_operations.py index ae42bba47cee..d17f4dc65c15 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_export_jobs_operation_results_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_export_jobs_operation_results_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -15,7 +16,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -32,10 +32,11 @@ def build_get_request( operation_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-12-01" + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobs/operationResults/{operationId}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobs/operationResults/{operationId}") # pylint: disable=line-too-long path_format_arguments = { "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -43,21 +44,21 @@ def build_get_request( "operationId": _SERIALIZER.url("operation_id", operation_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -114,18 +115,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + request = build_get_request( vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, operation_id=operation_id, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -143,5 +151,5 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobs/operationResults/{operationId}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobs/operationResults/{operationId}"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_feature_support_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_feature_support_operations.py index 8e94e34839f4..adaa4397baa9 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_feature_support_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_feature_support_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -15,7 +16,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -34,34 +34,34 @@ def build_validate_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/Subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupValidateFeatures') + _url = kwargs.pop("template_url", "/Subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupValidateFeatures") # pylint: disable=line-too-long path_format_arguments = { "azureRegion": _SERIALIZER.url("azure_region", azure_region, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -116,6 +116,7 @@ def validate( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'FeatureSupportRequest') @@ -123,6 +124,7 @@ def validate( request = build_validate_request( azure_region=azure_region, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.validate.metadata['url'], @@ -130,7 +132,11 @@ def validate( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -144,5 +150,5 @@ def validate( return deserialized - validate.metadata = {'url': '/Subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupValidateFeatures'} # type: ignore + validate.metadata = {'url': "/Subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupValidateFeatures"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_item_level_recovery_connections_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_item_level_recovery_connections_operations.py index 52c7cb5361e0..2d03662972a3 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_item_level_recovery_connections_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_item_level_recovery_connections_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -15,7 +16,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -39,12 +39,12 @@ def build_provision_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/provisionInstantItemRecovery') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/provisionInstantItemRecovery") # pylint: disable=line-too-long path_format_arguments = { "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -55,23 +55,23 @@ def build_provision_request( "recoveryPointId": _SERIALIZER.url("recovery_point_id", recovery_point_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -88,10 +88,11 @@ def build_revoke_request( recovery_point_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-12-01" + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/revokeInstantItemRecovery') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/revokeInstantItemRecovery") # pylint: disable=line-too-long path_format_arguments = { "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -102,21 +103,21 @@ def build_revoke_request( "recoveryPointId": _SERIALIZER.url("recovery_point_id", recovery_point_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -143,7 +144,7 @@ def __init__(self, client, config, serializer, deserializer): self._config = config @distributed_trace - def provision( + def provision( # pylint: disable=inconsistent-return-statements self, vault_name: str, resource_group_name: str, @@ -188,6 +189,7 @@ def provision( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ILRRequestResource') @@ -200,6 +202,7 @@ def provision( container_name=container_name, protected_item_name=protected_item_name, recovery_point_id=recovery_point_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.provision.metadata['url'], @@ -207,7 +210,11 @@ def provision( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: @@ -217,11 +224,11 @@ def provision( if cls: return cls(pipeline_response, None, {}) - provision.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/provisionInstantItemRecovery'} # type: ignore + provision.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/provisionInstantItemRecovery"} # type: ignore @distributed_trace - def revoke( + def revoke( # pylint: disable=inconsistent-return-statements self, vault_name: str, resource_group_name: str, @@ -261,6 +268,8 @@ def revoke( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + request = build_revoke_request( vault_name=vault_name, @@ -270,12 +279,17 @@ def revoke( container_name=container_name, protected_item_name=protected_item_name, recovery_point_id=recovery_point_id, + api_version=api_version, template_url=self.revoke.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: @@ -285,5 +299,5 @@ def revoke( if cls: return cls(pipeline_response, None, {}) - revoke.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/revokeInstantItemRecovery'} # type: ignore + revoke.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/revokeInstantItemRecovery"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_job_cancellations_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_job_cancellations_operations.py index 42e3e9d19fcf..a5e7997c7090 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_job_cancellations_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_job_cancellations_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -15,7 +16,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -32,10 +32,11 @@ def build_trigger_request( job_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-12-01" + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobs/{jobName}/cancel') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobs/{jobName}/cancel") # pylint: disable=line-too-long path_format_arguments = { "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -43,21 +44,21 @@ def build_trigger_request( "jobName": _SERIALIZER.url("job_name", job_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -84,7 +85,7 @@ def __init__(self, client, config, serializer, deserializer): self._config = config @distributed_trace - def trigger( + def trigger( # pylint: disable=inconsistent-return-statements self, vault_name: str, resource_group_name: str, @@ -112,18 +113,25 @@ def trigger( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + request = build_trigger_request( vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, job_name=job_name, + api_version=api_version, template_url=self.trigger.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: @@ -133,5 +141,5 @@ def trigger( if cls: return cls(pipeline_response, None, {}) - trigger.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobs/{jobName}/cancel'} # type: ignore + trigger.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobs/{jobName}/cancel"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_job_details_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_job_details_operations.py index f7efd23e8a6c..d53e3c4dc8f0 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_job_details_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_job_details_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -15,7 +16,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -32,10 +32,11 @@ def build_get_request( job_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-12-01" + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobs/{jobName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobs/{jobName}") # pylint: disable=line-too-long path_format_arguments = { "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -43,21 +44,21 @@ def build_get_request( "jobName": _SERIALIZER.url("job_name", job_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -111,18 +112,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + request = build_get_request( vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, job_name=job_name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -136,5 +144,5 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobs/{jobName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobs/{jobName}"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_job_operation_results_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_job_operation_results_operations.py index 6d60c83600a6..bce2cb585333 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_job_operation_results_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_job_operation_results_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -15,7 +16,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -33,10 +33,11 @@ def build_get_request( operation_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-12-01" + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobs/{jobName}/operationResults/{operationId}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobs/{jobName}/operationResults/{operationId}") # pylint: disable=line-too-long path_format_arguments = { "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -45,21 +46,21 @@ def build_get_request( "operationId": _SERIALIZER.url("operation_id", operation_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -86,7 +87,7 @@ def __init__(self, client, config, serializer, deserializer): self._config = config @distributed_trace - def get( + def get( # pylint: disable=inconsistent-return-statements self, vault_name: str, resource_group_name: str, @@ -116,6 +117,8 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + request = build_get_request( vault_name=vault_name, @@ -123,12 +126,17 @@ def get( subscription_id=self._config.subscription_id, job_name=job_name, operation_id=operation_id, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -138,5 +146,5 @@ def get( if cls: return cls(pipeline_response, None, {}) - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobs/{jobName}/operationResults/{operationId}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobs/{jobName}/operationResults/{operationId}"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_jobs_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_jobs_operations.py index 9b0db2eccb46..222ec9991bf7 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_jobs_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_jobs_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -15,7 +16,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -33,33 +33,34 @@ def build_export_request( filter: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-12-01" + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobsExport') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobsExport") # pylint: disable=line-too-long path_format_arguments = { "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if filter is not None: - query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -86,7 +87,7 @@ def __init__(self, client, config, serializer, deserializer): self._config = config @distributed_trace - def export( + def export( # pylint: disable=inconsistent-return-statements self, vault_name: str, resource_group_name: str, @@ -100,7 +101,7 @@ def export( :param resource_group_name: The name of the resource group where the recovery services vault is present. :type resource_group_name: str - :param filter: OData filter options. + :param filter: OData filter options. Default value is None. :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -113,18 +114,25 @@ def export( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + request = build_export_request( vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, filter=filter, template_url=self.export.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: @@ -134,5 +142,5 @@ def export( if cls: return cls(pipeline_response, None, {}) - export.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobsExport'} # type: ignore + export.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupJobsExport"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_operation_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_operation_operations.py index cc8c040396b1..f0032cc0a3bd 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_operation_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_operation_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -15,7 +16,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -35,35 +35,35 @@ def build_validate_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupValidateOperation') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupValidateOperation") # pylint: disable=line-too-long path_format_arguments = { "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -120,6 +120,7 @@ def validate( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ValidateOperationRequest') @@ -128,6 +129,7 @@ def validate( vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.validate.metadata['url'], @@ -135,7 +137,11 @@ def validate( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -149,5 +155,5 @@ def validate( return deserialized - validate.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupValidateOperation'} # type: ignore + validate.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupValidateOperation"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_operations.py index bebbebd5187d..16cb59492540 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request @@ -29,24 +29,25 @@ def build_list_request( **kwargs: Any ) -> HttpRequest: - api_version = "2021-12-01" + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/providers/Microsoft.RecoveryServices/operations') + _url = kwargs.pop("template_url", "/providers/Microsoft.RecoveryServices/operations") # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -86,6 +87,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicesbackup.activestamp.models.ClientDiscoveryResponse] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ClientDiscoveryResponse"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -95,6 +98,7 @@ def prepare_request(next_link=None): if not next_link: request = build_list_request( + api_version=api_version, template_url=self.list.metadata['url'], ) request = _convert_request(request) @@ -103,6 +107,7 @@ def prepare_request(next_link=None): else: request = build_list_request( + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -120,7 +125,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -133,4 +142,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/providers/Microsoft.RecoveryServices/operations'} # type: ignore + list.metadata = {'url': "/providers/Microsoft.RecoveryServices/operations"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_private_endpoint_connection_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_private_endpoint_connection_operations.py index 8f1ae2afcd28..206f10a6826b 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_private_endpoint_connection_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_private_endpoint_connection_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -17,7 +18,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -35,10 +35,11 @@ def build_get_request( private_endpoint_connection_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-12-01" + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -46,21 +47,21 @@ def build_get_request( "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -75,12 +76,12 @@ def build_put_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -88,23 +89,23 @@ def build_put_request_initial( "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -118,10 +119,11 @@ def build_delete_request_initial( private_endpoint_connection_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-12-01" + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}") # pylint: disable=line-too-long path_format_arguments = { "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -129,21 +131,21 @@ def build_delete_request_initial( "privateEndpointConnectionName": _SERIALIZER.url("private_endpoint_connection_name", private_endpoint_connection_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -197,18 +199,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + request = build_get_request( vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -223,7 +232,7 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore def _put_initial( @@ -240,6 +249,7 @@ def _put_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'PrivateEndpointConnectionResource') @@ -249,6 +259,7 @@ def _put_initial( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self._put_initial.metadata['url'], @@ -256,7 +267,11 @@ def _put_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 201]: @@ -274,7 +289,7 @@ def _put_initial( return deserialized - _put_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + _put_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace @@ -312,8 +327,9 @@ def begin_put( ~azure.core.polling.LROPoller[~azure.mgmt.recoveryservicesbackup.activestamp.models.PrivateEndpointConnectionResource] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.PrivateEndpointConnectionResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -326,6 +342,7 @@ def begin_put( resource_group_name=resource_group_name, private_endpoint_connection_name=private_endpoint_connection_name, parameters=parameters, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -350,12 +367,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + begin_put.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, vault_name: str, resource_group_name: str, @@ -368,18 +384,25 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + request = build_delete_request_initial( vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -389,11 +412,11 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, vault_name: str, resource_group_name: str, @@ -421,7 +444,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -433,6 +457,7 @@ def begin_delete( vault_name=vault_name, resource_group_name=resource_group_name, private_endpoint_connection_name=private_endpoint_connection_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -453,7 +478,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_private_endpoint_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_private_endpoint_operations.py index ba0f0787e0f4..c6fa818b1bda 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_private_endpoint_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_private_endpoint_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -15,7 +16,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -33,10 +33,11 @@ def build_get_operation_status_request( operation_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-12-01" + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}/operationsStatus/{operationId}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}/operationsStatus/{operationId}") # pylint: disable=line-too-long path_format_arguments = { "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -45,21 +46,21 @@ def build_get_operation_status_request( "operationId": _SERIALIZER.url("operation_id", operation_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -118,6 +119,8 @@ def get_operation_status( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + request = build_get_operation_status_request( vault_name=vault_name, @@ -125,12 +128,17 @@ def get_operation_status( subscription_id=self._config.subscription_id, private_endpoint_connection_name=private_endpoint_connection_name, operation_id=operation_id, + api_version=api_version, template_url=self.get_operation_status.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -145,5 +153,5 @@ def get_operation_status( return deserialized - get_operation_status.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}/operationsStatus/{operationId}'} # type: ignore + get_operation_status.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/privateEndpointConnections/{privateEndpointConnectionName}/operationsStatus/{operationId}"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protectable_containers_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protectable_containers_operations.py index cd48f4ebedb8..55c6b23ef50a 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protectable_containers_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protectable_containers_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -35,10 +35,11 @@ def build_list_request( filter: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-12-01" + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectableContainers') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectableContainers") # pylint: disable=line-too-long path_format_arguments = { "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -46,23 +47,23 @@ def build_list_request( "fabricName": _SERIALIZER.url("fabric_name", fabric_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if filter is not None: - query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -106,7 +107,7 @@ def list( :type resource_group_name: str :param fabric_name: :type fabric_name: str - :param filter: OData filter options. + :param filter: OData filter options. Default value is None. :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ProtectableContainerResourceList or the result of @@ -115,6 +116,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicesbackup.activestamp.models.ProtectableContainerResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProtectableContainerResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -128,6 +131,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, fabric_name=fabric_name, + api_version=api_version, filter=filter, template_url=self.list.metadata['url'], ) @@ -141,6 +145,7 @@ def prepare_request(next_link=None): resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, fabric_name=fabric_name, + api_version=api_version, filter=filter, template_url=next_link, ) @@ -159,7 +164,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -172,4 +181,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectableContainers'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectableContainers"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protected_item_operation_results_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protected_item_operation_results_operations.py index 4dcde5123d84..4adf887dc3eb 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protected_item_operation_results_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protected_item_operation_results_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -15,7 +16,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -35,10 +35,11 @@ def build_get_request( operation_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-12-01" + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/operationResults/{operationId}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/operationResults/{operationId}") # pylint: disable=line-too-long path_format_arguments = { "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -49,21 +50,21 @@ def build_get_request( "operationId": _SERIALIZER.url("operation_id", operation_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -127,6 +128,8 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + request = build_get_request( vault_name=vault_name, @@ -136,12 +139,17 @@ def get( container_name=container_name, protected_item_name=protected_item_name, operation_id=operation_id, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -157,5 +165,5 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/operationResults/{operationId}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/operationResults/{operationId}"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protected_item_operation_statuses_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protected_item_operation_statuses_operations.py index 3bb064672ca4..ccafe3ef7663 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protected_item_operation_statuses_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protected_item_operation_statuses_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -15,7 +16,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -35,10 +35,11 @@ def build_get_request( operation_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-12-01" + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/operationsStatus/{operationId}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/operationsStatus/{operationId}") # pylint: disable=line-too-long path_format_arguments = { "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -49,21 +50,21 @@ def build_get_request( "operationId": _SERIALIZER.url("operation_id", operation_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -130,6 +131,8 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + request = build_get_request( vault_name=vault_name, @@ -139,12 +142,17 @@ def get( container_name=container_name, protected_item_name=protected_item_name, operation_id=operation_id, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -158,5 +166,5 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/operationsStatus/{operationId}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/operationsStatus/{operationId}"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protected_items_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protected_items_operations.py index 4dc3208bf61d..2703c885bb75 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protected_items_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protected_items_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -15,7 +16,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -37,10 +37,11 @@ def build_get_request( filter: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-12-01" + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}") # pylint: disable=line-too-long path_format_arguments = { "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -50,23 +51,23 @@ def build_get_request( "protectedItemName": _SERIALIZER.url("protected_item_name", protected_item_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if filter is not None: - query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -83,12 +84,12 @@ def build_create_or_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}") # pylint: disable=line-too-long path_format_arguments = { "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -98,23 +99,23 @@ def build_create_or_update_request( "protectedItemName": _SERIALIZER.url("protected_item_name", protected_item_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -130,10 +131,11 @@ def build_delete_request( protected_item_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-12-01" + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}") # pylint: disable=line-too-long path_format_arguments = { "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -143,21 +145,21 @@ def build_delete_request( "protectedItemName": _SERIALIZER.url("protected_item_name", protected_item_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -209,7 +211,7 @@ def get( :type container_name: str :param protected_item_name: Backed up item name whose details are to be fetched. :type protected_item_name: str - :param filter: OData filter options. + :param filter: OData filter options. Default value is None. :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ProtectedItemResource, or the result of cls(response) @@ -222,6 +224,8 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + request = build_get_request( vault_name=vault_name, @@ -230,13 +234,18 @@ def get( fabric_name=fabric_name, container_name=container_name, protected_item_name=protected_item_name, + api_version=api_version, filter=filter, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -250,7 +259,7 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}"} # type: ignore @distributed_trace @@ -293,6 +302,7 @@ def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ProtectedItemResource') @@ -304,6 +314,7 @@ def create_or_update( fabric_name=fabric_name, container_name=container_name, protected_item_name=protected_item_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], @@ -311,7 +322,11 @@ def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -327,11 +342,11 @@ def create_or_update( return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}'} # type: ignore + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, vault_name: str, resource_group_name: str, @@ -366,6 +381,8 @@ def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + request = build_delete_request( vault_name=vault_name, @@ -374,12 +391,17 @@ def delete( fabric_name=fabric_name, container_name=container_name, protected_item_name=protected_item_name, + api_version=api_version, template_url=self.delete.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -389,5 +411,5 @@ def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protection_container_operation_results_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protection_container_operation_results_operations.py index 8d3fe91716b3..73d60532ac7e 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protection_container_operation_results_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protection_container_operation_results_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -15,7 +16,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -34,10 +34,11 @@ def build_get_request( operation_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-12-01" + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/operationResults/{operationId}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/operationResults/{operationId}") # pylint: disable=line-too-long path_format_arguments = { "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -47,21 +48,21 @@ def build_get_request( "operationId": _SERIALIZER.url("operation_id", operation_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -123,6 +124,8 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + request = build_get_request( vault_name=vault_name, @@ -131,12 +134,17 @@ def get( fabric_name=fabric_name, container_name=container_name, operation_id=operation_id, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -152,5 +160,5 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/operationResults/{operationId}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/operationResults/{operationId}"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protection_container_refresh_operation_results_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protection_container_refresh_operation_results_operations.py index 11de712c0cee..f508afc05840 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protection_container_refresh_operation_results_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protection_container_refresh_operation_results_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -15,7 +16,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -33,10 +33,11 @@ def build_get_request( operation_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-12-01" + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/operationResults/{operationId}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/operationResults/{operationId}") # pylint: disable=line-too-long path_format_arguments = { "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -45,21 +46,21 @@ def build_get_request( "operationId": _SERIALIZER.url("operation_id", operation_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -86,7 +87,7 @@ def __init__(self, client, config, serializer, deserializer): self._config = config @distributed_trace - def get( + def get( # pylint: disable=inconsistent-return-statements self, vault_name: str, resource_group_name: str, @@ -117,6 +118,8 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + request = build_get_request( vault_name=vault_name, @@ -124,12 +127,17 @@ def get( subscription_id=self._config.subscription_id, fabric_name=fabric_name, operation_id=operation_id, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202, 204]: @@ -139,5 +147,5 @@ def get( if cls: return cls(pipeline_response, None, {}) - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/operationResults/{operationId}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/operationResults/{operationId}"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protection_containers_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protection_containers_operations.py index 36d1711110c6..1ab1a1f170f8 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protection_containers_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protection_containers_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -15,7 +16,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -34,10 +34,11 @@ def build_get_request( container_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-12-01" + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}") # pylint: disable=line-too-long path_format_arguments = { "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -46,21 +47,21 @@ def build_get_request( "containerName": _SERIALIZER.url("container_name", container_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -76,12 +77,12 @@ def build_register_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}") # pylint: disable=line-too-long path_format_arguments = { "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -90,23 +91,23 @@ def build_register_request( "containerName": _SERIALIZER.url("container_name", container_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -121,10 +122,11 @@ def build_unregister_request( container_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-12-01" + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}") # pylint: disable=line-too-long path_format_arguments = { "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -133,21 +135,21 @@ def build_unregister_request( "containerName": _SERIALIZER.url("container_name", container_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -162,10 +164,11 @@ def build_inquire_request( filter: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-12-01" + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/inquire') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/inquire") # pylint: disable=line-too-long path_format_arguments = { "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -174,23 +177,23 @@ def build_inquire_request( "containerName": _SERIALIZER.url("container_name", container_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if filter is not None: - query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -204,10 +207,11 @@ def build_refresh_request( filter: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-12-01" + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/refreshContainers') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/refreshContainers") # pylint: disable=line-too-long path_format_arguments = { "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -215,23 +219,23 @@ def build_refresh_request( "fabricName": _SERIALIZER.url("fabric_name", fabric_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if filter is not None: - query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -288,6 +292,8 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + request = build_get_request( vault_name=vault_name, @@ -295,12 +301,17 @@ def get( subscription_id=self._config.subscription_id, fabric_name=fabric_name, container_name=container_name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -314,7 +325,7 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}"} # type: ignore @distributed_trace @@ -356,6 +367,7 @@ def register( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ProtectionContainerResource') @@ -366,6 +378,7 @@ def register( subscription_id=self._config.subscription_id, fabric_name=fabric_name, container_name=container_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.register.metadata['url'], @@ -373,7 +386,11 @@ def register( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -389,11 +406,11 @@ def register( return deserialized - register.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}'} # type: ignore + register.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}"} # type: ignore @distributed_trace - def unregister( + def unregister( # pylint: disable=inconsistent-return-statements self, vault_name: str, resource_group_name: str, @@ -427,6 +444,8 @@ def unregister( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + request = build_unregister_request( vault_name=vault_name, @@ -434,12 +453,17 @@ def unregister( subscription_id=self._config.subscription_id, fabric_name=fabric_name, container_name=container_name, + api_version=api_version, template_url=self.unregister.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202, 204]: @@ -449,11 +473,11 @@ def unregister( if cls: return cls(pipeline_response, None, {}) - unregister.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}'} # type: ignore + unregister.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}"} # type: ignore @distributed_trace - def inquire( + def inquire( # pylint: disable=inconsistent-return-statements self, vault_name: str, resource_group_name: str, @@ -476,7 +500,7 @@ def inquire( :type fabric_name: str :param container_name: Name of the container in which inquiry needs to be triggered. :type container_name: str - :param filter: OData filter options. + :param filter: OData filter options. Default value is None. :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -489,6 +513,8 @@ def inquire( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + request = build_inquire_request( vault_name=vault_name, @@ -496,13 +522,18 @@ def inquire( subscription_id=self._config.subscription_id, fabric_name=fabric_name, container_name=container_name, + api_version=api_version, filter=filter, template_url=self.inquire.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: @@ -512,11 +543,11 @@ def inquire( if cls: return cls(pipeline_response, None, {}) - inquire.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/inquire'} # type: ignore + inquire.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/inquire"} # type: ignore @distributed_trace - def refresh( + def refresh( # pylint: disable=inconsistent-return-statements self, vault_name: str, resource_group_name: str, @@ -536,7 +567,7 @@ def refresh( :type resource_group_name: str :param fabric_name: Fabric name associated the container. :type fabric_name: str - :param filter: OData filter options. + :param filter: OData filter options. Default value is None. :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response :return: None, or the result of cls(response) @@ -549,19 +580,26 @@ def refresh( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + request = build_refresh_request( vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, fabric_name=fabric_name, + api_version=api_version, filter=filter, template_url=self.refresh.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: @@ -571,5 +609,5 @@ def refresh( if cls: return cls(pipeline_response, None, {}) - refresh.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/refreshContainers'} # type: ignore + refresh.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/refreshContainers"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protection_intent_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protection_intent_operations.py index c04563629562..2d67885a455a 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protection_intent_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protection_intent_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -15,7 +16,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -34,34 +34,34 @@ def build_validate_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/Subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupPreValidateProtection') + _url = kwargs.pop("template_url", "/Subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupPreValidateProtection") # pylint: disable=line-too-long path_format_arguments = { "azureRegion": _SERIALIZER.url("azure_region", azure_region, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -76,10 +76,11 @@ def build_get_request( intent_object_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-12-01" + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/backupProtectionIntent/{intentObjectName}') + _url = kwargs.pop("template_url", "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/backupProtectionIntent/{intentObjectName}") # pylint: disable=line-too-long path_format_arguments = { "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -88,21 +89,21 @@ def build_get_request( "intentObjectName": _SERIALIZER.url("intent_object_name", intent_object_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -118,12 +119,12 @@ def build_create_or_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/backupProtectionIntent/{intentObjectName}') + _url = kwargs.pop("template_url", "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/backupProtectionIntent/{intentObjectName}") # pylint: disable=line-too-long path_format_arguments = { "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -132,23 +133,23 @@ def build_create_or_update_request( "intentObjectName": _SERIALIZER.url("intent_object_name", intent_object_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -163,9 +164,10 @@ def build_delete_request( intent_object_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-12-01" + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + # Construct URL - url = kwargs.pop("template_url", '/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/backupProtectionIntent/{intentObjectName}') + _url = kwargs.pop("template_url", "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/backupProtectionIntent/{intentObjectName}") # pylint: disable=line-too-long path_format_arguments = { "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -174,16 +176,16 @@ def build_delete_request( "intentObjectName": _SERIALIZER.url("intent_object_name", intent_object_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') return HttpRequest( method="DELETE", - url=url, - params=query_parameters, + url=_url, + params=_query_parameters, **kwargs ) @@ -246,6 +248,7 @@ def validate( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'PreValidateEnableBackupRequest') @@ -253,6 +256,7 @@ def validate( request = build_validate_request( azure_region=azure_region, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.validate.metadata['url'], @@ -260,7 +264,11 @@ def validate( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -274,7 +282,7 @@ def validate( return deserialized - validate.metadata = {'url': '/Subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupPreValidateProtection'} # type: ignore + validate.metadata = {'url': "/Subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupPreValidateProtection"} # type: ignore @distributed_trace @@ -310,6 +318,8 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + request = build_get_request( vault_name=vault_name, @@ -317,12 +327,17 @@ def get( subscription_id=self._config.subscription_id, fabric_name=fabric_name, intent_object_name=intent_object_name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -336,7 +351,7 @@ def get( return deserialized - get.metadata = {'url': '/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/backupProtectionIntent/{intentObjectName}'} # type: ignore + get.metadata = {'url': "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/backupProtectionIntent/{intentObjectName}"} # type: ignore @distributed_trace @@ -374,6 +389,7 @@ def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ProtectionIntentResource') @@ -384,6 +400,7 @@ def create_or_update( subscription_id=self._config.subscription_id, fabric_name=fabric_name, intent_object_name=intent_object_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], @@ -391,7 +408,11 @@ def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -405,11 +426,11 @@ def create_or_update( return deserialized - create_or_update.metadata = {'url': '/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/backupProtectionIntent/{intentObjectName}'} # type: ignore + create_or_update.metadata = {'url': "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/backupProtectionIntent/{intentObjectName}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, vault_name: str, resource_group_name: str, @@ -439,6 +460,8 @@ def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + request = build_delete_request( vault_name=vault_name, @@ -446,12 +469,17 @@ def delete( subscription_id=self._config.subscription_id, fabric_name=fabric_name, intent_object_name=intent_object_name, + api_version=api_version, template_url=self.delete.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [204]: @@ -461,5 +489,5 @@ def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/backupProtectionIntent/{intentObjectName}'} # type: ignore + delete.metadata = {'url': "/Subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/backupProtectionIntent/{intentObjectName}"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protection_policies_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protection_policies_operations.py index 6d5eb9ade1d4..7cce07b69b1b 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protection_policies_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protection_policies_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -17,7 +18,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -35,10 +35,11 @@ def build_get_request( policy_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-12-01" + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName}") # pylint: disable=line-too-long path_format_arguments = { "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -46,21 +47,21 @@ def build_get_request( "policyName": _SERIALIZER.url("policy_name", policy_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -75,12 +76,12 @@ def build_create_or_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName}") # pylint: disable=line-too-long path_format_arguments = { "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -88,23 +89,23 @@ def build_create_or_update_request( "policyName": _SERIALIZER.url("policy_name", policy_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -118,10 +119,11 @@ def build_delete_request_initial( policy_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-12-01" + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName}") # pylint: disable=line-too-long path_format_arguments = { "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -129,21 +131,21 @@ def build_delete_request_initial( "policyName": _SERIALIZER.url("policy_name", policy_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -199,18 +201,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + request = build_get_request( vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, policy_name=policy_name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -224,7 +233,7 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName}"} # type: ignore @distributed_trace @@ -261,6 +270,7 @@ def create_or_update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ProtectionPolicyResource') @@ -270,6 +280,7 @@ def create_or_update( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, policy_name=policy_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.create_or_update.metadata['url'], @@ -277,7 +288,11 @@ def create_or_update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -293,10 +308,10 @@ def create_or_update( return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName}'} # type: ignore + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, vault_name: str, resource_group_name: str, @@ -309,18 +324,25 @@ def _delete_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + request = build_delete_request_initial( vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, policy_name=policy_name, + api_version=api_version, template_url=self._delete_initial.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -330,11 +352,11 @@ def _delete_initial( if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName}"} # type: ignore @distributed_trace - def begin_delete( + def begin_delete( # pylint: disable=inconsistent-return-statements self, vault_name: str, resource_group_name: str, @@ -364,7 +386,8 @@ def begin_delete( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -376,6 +399,7 @@ def begin_delete( vault_name=vault_name, resource_group_name=resource_group_name, policy_name=policy_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) @@ -396,7 +420,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName}'} # type: ignore + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName}"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protection_policy_operation_results_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protection_policy_operation_results_operations.py index 15cfb4ad9384..25b88d0c119b 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protection_policy_operation_results_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protection_policy_operation_results_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -15,7 +16,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -33,10 +33,11 @@ def build_get_request( operation_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-12-01" + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName}/operationResults/{operationId}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName}/operationResults/{operationId}") # pylint: disable=line-too-long path_format_arguments = { "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -45,21 +46,21 @@ def build_get_request( "operationId": _SERIALIZER.url("operation_id", operation_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -117,6 +118,8 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + request = build_get_request( vault_name=vault_name, @@ -124,12 +127,17 @@ def get( subscription_id=self._config.subscription_id, policy_name=policy_name, operation_id=operation_id, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -143,5 +151,5 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName}/operationResults/{operationId}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName}/operationResults/{operationId}"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protection_policy_operation_statuses_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protection_policy_operation_statuses_operations.py index 4e02b928ee95..500a42727a71 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protection_policy_operation_statuses_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_protection_policy_operation_statuses_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -15,7 +16,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -33,10 +33,11 @@ def build_get_request( operation_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-12-01" + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName}/operations/{operationId}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName}/operations/{operationId}") # pylint: disable=line-too-long path_format_arguments = { "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -45,21 +46,21 @@ def build_get_request( "operationId": _SERIALIZER.url("operation_id", operation_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -121,6 +122,8 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + request = build_get_request( vault_name=vault_name, @@ -128,12 +131,17 @@ def get( subscription_id=self._config.subscription_id, policy_name=policy_name, operation_id=operation_id, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -147,5 +155,5 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName}/operations/{operationId}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupPolicies/{policyName}/operations/{operationId}"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_recovery_points_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_recovery_points_operations.py index 461311e3f7d8..2180a7997f93 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_recovery_points_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_recovery_points_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -37,10 +37,11 @@ def build_list_request( filter: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-12-01" + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints") # pylint: disable=line-too-long path_format_arguments = { "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -50,23 +51,23 @@ def build_list_request( "protectedItemName": _SERIALIZER.url("protected_item_name", protected_item_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if filter is not None: - query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -81,10 +82,11 @@ def build_get_request( recovery_point_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-12-01" + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}") # pylint: disable=line-too-long path_format_arguments = { "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -95,21 +97,21 @@ def build_get_request( "recoveryPointId": _SERIALIZER.url("recovery_point_id", recovery_point_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -159,7 +161,7 @@ def list( :type container_name: str :param protected_item_name: Backed up item whose backup copies are to be fetched. :type protected_item_name: str - :param filter: OData filter options. + :param filter: OData filter options. Default value is None. :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either RecoveryPointResourceList or the result of @@ -168,6 +170,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicesbackup.activestamp.models.RecoveryPointResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.RecoveryPointResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -183,6 +187,7 @@ def prepare_request(next_link=None): fabric_name=fabric_name, container_name=container_name, protected_item_name=protected_item_name, + api_version=api_version, filter=filter, template_url=self.list.metadata['url'], ) @@ -198,6 +203,7 @@ def prepare_request(next_link=None): fabric_name=fabric_name, container_name=container_name, protected_item_name=protected_item_name, + api_version=api_version, filter=filter, template_url=next_link, ) @@ -216,7 +222,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -229,7 +239,7 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints"} # type: ignore @distributed_trace def get( @@ -270,6 +280,8 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + request = build_get_request( vault_name=vault_name, @@ -279,12 +291,17 @@ def get( container_name=container_name, protected_item_name=protected_item_name, recovery_point_id=recovery_point_id, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -298,5 +315,5 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_recovery_points_recommended_for_move_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_recovery_points_recommended_for_move_operations.py index a7e3aa5931f3..11a01101f109 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_recovery_points_recommended_for_move_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_recovery_points_recommended_for_move_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -39,12 +39,12 @@ def build_list_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPointsRecommendedForMove') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPointsRecommendedForMove") # pylint: disable=line-too-long path_format_arguments = { "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -54,23 +54,23 @@ def build_list_request( "protectedItemName": _SERIALIZER.url("protected_item_name", protected_item_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -132,6 +132,7 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicesbackup.activestamp.models.RecoveryPointResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType["_models.RecoveryPointResourceList"] @@ -150,6 +151,7 @@ def prepare_request(next_link=None): fabric_name=fabric_name, container_name=container_name, protected_item_name=protected_item_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.list.metadata['url'], @@ -167,6 +169,7 @@ def prepare_request(next_link=None): fabric_name=fabric_name, container_name=container_name, protected_item_name=protected_item_name, + api_version=api_version, content_type=content_type, json=_json, template_url=next_link, @@ -186,7 +189,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -199,4 +206,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPointsRecommendedForMove'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPointsRecommendedForMove"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_recovery_services_backup_client_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_recovery_services_backup_client_operations.py index 4f7e6888fd12..f138f9d715bc 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_recovery_services_backup_client_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_recovery_services_backup_client_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -17,7 +18,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -35,10 +35,11 @@ def build_get_operation_status_request( operation_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-12-01" + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig/operationStatus/{operationId}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig/operationStatus/{operationId}") # pylint: disable=line-too-long path_format_arguments = { "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -46,21 +47,21 @@ def build_get_operation_status_request( "operationId": _SERIALIZER.url("operation_id", operation_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -74,35 +75,35 @@ def build_bms_prepare_data_move_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig/prepareDataMove') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig/prepareDataMove") # pylint: disable=line-too-long path_format_arguments = { "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -118,35 +119,35 @@ def build_bms_trigger_data_move_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig/triggerDataMove') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig/triggerDataMove") # pylint: disable=line-too-long path_format_arguments = { "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -166,12 +167,12 @@ def build_move_recovery_point_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/move') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/move") # pylint: disable=line-too-long path_format_arguments = { "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -182,23 +183,23 @@ def build_move_recovery_point_request_initial( "recoveryPointId": _SERIALIZER.url("recovery_point_id", recovery_point_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -234,18 +235,25 @@ def get_operation_status( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + request = build_get_operation_status_request( vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, operation_id=operation_id, + api_version=api_version, template_url=self.get_operation_status.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -260,10 +268,10 @@ def get_operation_status( return deserialized - get_operation_status.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig/operationStatus/{operationId}'} # type: ignore + get_operation_status.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig/operationStatus/{operationId}"} # type: ignore - def _bms_prepare_data_move_initial( + def _bms_prepare_data_move_initial( # pylint: disable=inconsistent-return-statements self, vault_name: str, resource_group_name: str, @@ -276,6 +284,7 @@ def _bms_prepare_data_move_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'PrepareDataMoveRequest') @@ -284,6 +293,7 @@ def _bms_prepare_data_move_initial( vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self._bms_prepare_data_move_initial.metadata['url'], @@ -291,7 +301,11 @@ def _bms_prepare_data_move_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -301,11 +315,11 @@ def _bms_prepare_data_move_initial( if cls: return cls(pipeline_response, None, {}) - _bms_prepare_data_move_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig/prepareDataMove'} # type: ignore + _bms_prepare_data_move_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig/prepareDataMove"} # type: ignore @distributed_trace - def begin_bms_prepare_data_move( + def begin_bms_prepare_data_move( # pylint: disable=inconsistent-return-statements self, vault_name: str, resource_group_name: str, @@ -333,8 +347,9 @@ def begin_bms_prepare_data_move( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -346,6 +361,7 @@ def begin_bms_prepare_data_move( vault_name=vault_name, resource_group_name=resource_group_name, parameters=parameters, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -367,12 +383,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_bms_prepare_data_move.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig/prepareDataMove'} # type: ignore + begin_bms_prepare_data_move.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig/prepareDataMove"} # type: ignore - def _bms_trigger_data_move_initial( + def _bms_trigger_data_move_initial( # pylint: disable=inconsistent-return-statements self, vault_name: str, resource_group_name: str, @@ -385,6 +400,7 @@ def _bms_trigger_data_move_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'TriggerDataMoveRequest') @@ -393,6 +409,7 @@ def _bms_trigger_data_move_initial( vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self._bms_trigger_data_move_initial.metadata['url'], @@ -400,7 +417,11 @@ def _bms_trigger_data_move_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -410,11 +431,11 @@ def _bms_trigger_data_move_initial( if cls: return cls(pipeline_response, None, {}) - _bms_trigger_data_move_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig/triggerDataMove'} # type: ignore + _bms_trigger_data_move_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig/triggerDataMove"} # type: ignore @distributed_trace - def begin_bms_trigger_data_move( + def begin_bms_trigger_data_move( # pylint: disable=inconsistent-return-statements self, vault_name: str, resource_group_name: str, @@ -442,8 +463,9 @@ def begin_bms_trigger_data_move( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -455,6 +477,7 @@ def begin_bms_trigger_data_move( vault_name=vault_name, resource_group_name=resource_group_name, parameters=parameters, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -476,12 +499,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_bms_trigger_data_move.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig/triggerDataMove'} # type: ignore + begin_bms_trigger_data_move.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig/triggerDataMove"} # type: ignore - def _move_recovery_point_initial( + def _move_recovery_point_initial( # pylint: disable=inconsistent-return-statements self, vault_name: str, resource_group_name: str, @@ -498,6 +520,7 @@ def _move_recovery_point_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'MoveRPAcrossTiersRequest') @@ -510,6 +533,7 @@ def _move_recovery_point_initial( container_name=container_name, protected_item_name=protected_item_name, recovery_point_id=recovery_point_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self._move_recovery_point_initial.metadata['url'], @@ -517,7 +541,11 @@ def _move_recovery_point_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: @@ -527,11 +555,11 @@ def _move_recovery_point_initial( if cls: return cls(pipeline_response, None, {}) - _move_recovery_point_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/move'} # type: ignore + _move_recovery_point_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/move"} # type: ignore @distributed_trace - def begin_move_recovery_point( + def begin_move_recovery_point( # pylint: disable=inconsistent-return-statements self, vault_name: str, resource_group_name: str, @@ -574,8 +602,9 @@ def begin_move_recovery_point( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -591,6 +620,7 @@ def begin_move_recovery_point( protected_item_name=protected_item_name, recovery_point_id=recovery_point_id, parameters=parameters, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -612,7 +642,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_move_recovery_point.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/move'} # type: ignore + begin_move_recovery_point.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/move"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_resource_guard_proxies_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_resource_guard_proxies_operations.py index 6fe621ea4bb5..2df901c16e84 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_resource_guard_proxies_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_resource_guard_proxies_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -32,31 +32,32 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-12-01" + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupResourceGuardProxies') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupResourceGuardProxies") # pylint: disable=line-too-long path_format_arguments = { "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -103,6 +104,8 @@ def get( ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicesbackup.activestamp.models.ResourceGuardProxyBaseResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ResourceGuardProxyBaseResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -115,6 +118,7 @@ def prepare_request(next_link=None): vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) @@ -126,6 +130,7 @@ def prepare_request(next_link=None): vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=next_link, ) request = _convert_request(request) @@ -143,7 +148,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -156,4 +165,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupResourceGuardProxies'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupResourceGuardProxies"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_resource_guard_proxy_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_resource_guard_proxy_operations.py index 1beba4553c22..cafec8e023e1 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_resource_guard_proxy_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_resource_guard_proxy_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -15,7 +16,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -33,10 +33,11 @@ def build_get_request( resource_guard_proxy_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-12-01" + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}") # pylint: disable=line-too-long path_format_arguments = { "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -44,21 +45,21 @@ def build_get_request( "resourceGuardProxyName": _SERIALIZER.url("resource_guard_proxy_name", resource_guard_proxy_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -70,10 +71,11 @@ def build_put_request( resource_guard_proxy_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-12-01" + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}") # pylint: disable=line-too-long path_format_arguments = { "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -81,21 +83,21 @@ def build_put_request( "resourceGuardProxyName": _SERIALIZER.url("resource_guard_proxy_name", resource_guard_proxy_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -107,10 +109,11 @@ def build_delete_request( resource_guard_proxy_name: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-12-01" + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}") # pylint: disable=line-too-long path_format_arguments = { "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -118,21 +121,21 @@ def build_delete_request( "resourceGuardProxyName": _SERIALIZER.url("resource_guard_proxy_name", resource_guard_proxy_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="DELETE", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -147,12 +150,12 @@ def build_unlock_delete_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}/unlockDelete') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}/unlockDelete") # pylint: disable=line-too-long path_format_arguments = { "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -160,23 +163,23 @@ def build_unlock_delete_request( "resourceGuardProxyName": _SERIALIZER.url("resource_guard_proxy_name", resource_guard_proxy_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -232,18 +235,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + request = build_get_request( vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, resource_guard_proxy_name=resource_guard_proxy_name, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -257,7 +267,7 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}"} # type: ignore @distributed_trace @@ -289,18 +299,25 @@ def put( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + request = build_put_request( vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, resource_guard_proxy_name=resource_guard_proxy_name, + api_version=api_version, template_url=self.put.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -314,11 +331,11 @@ def put( return deserialized - put.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}'} # type: ignore + put.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}"} # type: ignore @distributed_trace - def delete( + def delete( # pylint: disable=inconsistent-return-statements self, vault_name: str, resource_group_name: str, @@ -345,18 +362,25 @@ def delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + request = build_delete_request( vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, resource_guard_proxy_name=resource_guard_proxy_name, + api_version=api_version, template_url=self.delete.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: @@ -366,7 +390,7 @@ def delete( if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}"} # type: ignore @distributed_trace @@ -400,6 +424,7 @@ def unlock_delete( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'UnlockDeleteRequest') @@ -409,6 +434,7 @@ def unlock_delete( resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, resource_guard_proxy_name=resource_guard_proxy_name, + api_version=api_version, content_type=content_type, json=_json, template_url=self.unlock_delete.metadata['url'], @@ -416,7 +442,11 @@ def unlock_delete( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -430,5 +460,5 @@ def unlock_delete( return deserialized - unlock_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}/unlockDelete'} # type: ignore + unlock_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupResourceGuardProxies/{resourceGuardProxyName}/unlockDelete"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_restores_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_restores_operations.py index 228671332412..e62184809cf9 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_restores_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_restores_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -17,7 +18,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -41,12 +41,12 @@ def build_trigger_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/restore') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/restore") # pylint: disable=line-too-long path_format_arguments = { "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -57,23 +57,23 @@ def build_trigger_request_initial( "recoveryPointId": _SERIALIZER.url("recovery_point_id", recovery_point_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -101,7 +101,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config - def _trigger_initial( + def _trigger_initial( # pylint: disable=inconsistent-return-statements self, vault_name: str, resource_group_name: str, @@ -118,6 +118,7 @@ def _trigger_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'RestoreRequestResource') @@ -130,6 +131,7 @@ def _trigger_initial( container_name=container_name, protected_item_name=protected_item_name, recovery_point_id=recovery_point_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self._trigger_initial.metadata['url'], @@ -137,7 +139,11 @@ def _trigger_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: @@ -147,11 +153,11 @@ def _trigger_initial( if cls: return cls(pipeline_response, None, {}) - _trigger_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/restore'} # type: ignore + _trigger_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/restore"} # type: ignore @distributed_trace - def begin_trigger( + def begin_trigger( # pylint: disable=inconsistent-return-statements self, vault_name: str, resource_group_name: str, @@ -193,8 +199,9 @@ def begin_trigger( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -210,6 +217,7 @@ def begin_trigger( protected_item_name=protected_item_name, recovery_point_id=recovery_point_id, parameters=parameters, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -231,7 +239,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_trigger.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/restore'} # type: ignore + begin_trigger.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/restore"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_security_pins_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_security_pins_operations.py index ab45481a0383..46063f2425da 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_security_pins_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_security_pins_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -15,7 +16,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -35,35 +35,35 @@ def build_get_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupSecurityPIN') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupSecurityPIN") # pylint: disable=line-too-long path_format_arguments = { "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -106,7 +106,7 @@ def get( :param resource_group_name: The name of the resource group where the recovery services vault is present. :type resource_group_name: str - :param parameters: security pin request. + :param parameters: security pin request. Default value is None. :type parameters: ~azure.mgmt.recoveryservicesbackup.activestamp.models.SecurityPinBase :keyword callable cls: A custom type or function that will be passed the direct response :return: TokenInformation, or the result of cls(response) @@ -119,6 +119,7 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] if parameters is not None: @@ -130,6 +131,7 @@ def get( vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.get.metadata['url'], @@ -137,7 +139,11 @@ def get( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -151,5 +157,5 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupSecurityPIN'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupSecurityPIN"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_validate_operation_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_validate_operation_operations.py index 023df5682751..a7d36519b1e7 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_validate_operation_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_validate_operation_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -17,7 +18,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -37,35 +37,35 @@ def build_trigger_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-12-01" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupTriggerValidateOperation') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupTriggerValidateOperation") # pylint: disable=line-too-long path_format_arguments = { "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -93,7 +93,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config - def _trigger_initial( + def _trigger_initial( # pylint: disable=inconsistent-return-statements self, vault_name: str, resource_group_name: str, @@ -106,6 +106,7 @@ def _trigger_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'ValidateOperationRequest') @@ -114,6 +115,7 @@ def _trigger_initial( vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self._trigger_initial.metadata['url'], @@ -121,7 +123,11 @@ def _trigger_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: @@ -131,11 +137,11 @@ def _trigger_initial( if cls: return cls(pipeline_response, None, {}) - _trigger_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupTriggerValidateOperation'} # type: ignore + _trigger_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupTriggerValidateOperation"} # type: ignore @distributed_trace - def begin_trigger( + def begin_trigger( # pylint: disable=inconsistent-return-statements self, vault_name: str, resource_group_name: str, @@ -165,8 +171,9 @@ def begin_trigger( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-12-01") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -178,6 +185,7 @@ def begin_trigger( vault_name=vault_name, resource_group_name=resource_group_name, parameters=parameters, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -199,7 +207,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_trigger.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupTriggerValidateOperation'} # type: ignore + begin_trigger.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupTriggerValidateOperation"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_validate_operation_results_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_validate_operation_results_operations.py index bf6a322674bc..0d5a80b2a090 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_validate_operation_results_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_validate_operation_results_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -15,7 +16,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -32,10 +32,11 @@ def build_get_request( operation_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-12-01" + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupValidateOperationResults/{operationId}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupValidateOperationResults/{operationId}") # pylint: disable=line-too-long path_format_arguments = { "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -43,21 +44,21 @@ def build_get_request( "operationId": _SERIALIZER.url("operation_id", operation_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -113,18 +114,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + request = build_get_request( vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, operation_id=operation_id, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -140,5 +148,5 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupValidateOperationResults/{operationId}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupValidateOperationResults/{operationId}"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_validate_operation_statuses_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_validate_operation_statuses_operations.py index ff096da677e9..f43d32ee3129 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_validate_operation_statuses_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/activestamp/operations/_validate_operation_statuses_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -15,7 +16,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -32,10 +32,11 @@ def build_get_request( operation_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-12-01" + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupValidateOperationsStatuses/{operationId}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupValidateOperationsStatuses/{operationId}") # pylint: disable=line-too-long path_format_arguments = { "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -43,21 +44,21 @@ def build_get_request( "operationId": _SERIALIZER.url("operation_id", operation_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -115,18 +116,25 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-12-01") # type: str + request = build_get_request( vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, operation_id=operation_id, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -140,5 +148,5 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupValidateOperationsStatuses/{operationId}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupValidateOperationsStatuses/{operationId}"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/_configuration.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/_configuration.py index ab7f8ea69cf4..e00c358e98dc 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/_configuration.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/_configuration.py @@ -19,7 +19,7 @@ from azure.core.credentials import TokenCredential -class RecoveryServicesBackupPassiveClientConfiguration(Configuration): +class RecoveryServicesBackupPassiveClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for RecoveryServicesBackupPassiveClient. Note that all parameters used to create this instance are saved as instance @@ -29,6 +29,9 @@ class RecoveryServicesBackupPassiveClientConfiguration(Configuration): :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The subscription Id. :type subscription_id: str + :keyword api_version: Api Version. Default value is "2021-11-15". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +41,8 @@ def __init__( **kwargs: Any ) -> None: super(RecoveryServicesBackupPassiveClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2021-11-15") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +50,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2021-11-15" + self.api_version = api_version self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-recoveryservicesbackup/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/_metadata.json b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/_metadata.json index adaa9299ebcc..58baf143e380 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/_metadata.json +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/_metadata.json @@ -10,8 +10,8 @@ "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"RecoveryServicesBackupPassiveClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"RecoveryServicesBackupPassiveClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"RecoveryServicesBackupPassiveClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"RecoveryServicesBackupPassiveClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/_recovery_services_backup_passive_client.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/_recovery_services_backup_passive_client.py index de0b87704625..5e2ceb7590e3 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/_recovery_services_backup_passive_client.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/_recovery_services_backup_passive_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Optional, TYPE_CHECKING +from typing import Any, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient -from msrest import Deserializer, Serializer from . import models from ._configuration import RecoveryServicesBackupPassiveClientConfiguration @@ -21,7 +22,7 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class RecoveryServicesBackupPassiveClient: +class RecoveryServicesBackupPassiveClient: # pylint: disable=too-many-instance-attributes """Open API 2.0 Specs for Azure RecoveryServices Backup service. :ivar backup_usage_summaries_crr: BackupUsageSummariesCRROperations operations @@ -61,8 +62,11 @@ class RecoveryServicesBackupPassiveClient: :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The subscription Id. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2021-11-15". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ @@ -96,7 +100,7 @@ def __init__( def _send_request( self, - request, # type: HttpRequest + request: HttpRequest, **kwargs: Any ) -> HttpResponse: """Runs the network request through the client's chained policies. diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/_version.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/_version.py index 83801515a450..0a3e80c7ba62 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/_version.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "4.1.1" +VERSION = "4.2.0" diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/_configuration.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/_configuration.py index 4029379960e8..788c7f059d6c 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/_configuration.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/_configuration.py @@ -19,7 +19,7 @@ from azure.core.credentials_async import AsyncTokenCredential -class RecoveryServicesBackupPassiveClientConfiguration(Configuration): +class RecoveryServicesBackupPassiveClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for RecoveryServicesBackupPassiveClient. Note that all parameters used to create this instance are saved as instance @@ -29,6 +29,9 @@ class RecoveryServicesBackupPassiveClientConfiguration(Configuration): :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The subscription Id. :type subscription_id: str + :keyword api_version: Api Version. Default value is "2021-11-15". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -38,6 +41,8 @@ def __init__( **kwargs: Any ) -> None: super(RecoveryServicesBackupPassiveClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2021-11-15") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -45,7 +50,7 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.api_version = "2021-11-15" + self.api_version = api_version self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-recoveryservicesbackup/{}'.format(VERSION)) self._configure(**kwargs) diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/_recovery_services_backup_passive_client.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/_recovery_services_backup_passive_client.py index 091a7867903b..c2cf1c2de13b 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/_recovery_services_backup_passive_client.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/_recovery_services_backup_passive_client.py @@ -7,11 +7,12 @@ # -------------------------------------------------------------------------- from copy import deepcopy -from typing import Any, Awaitable, Optional, TYPE_CHECKING +from typing import Any, Awaitable, TYPE_CHECKING + +from msrest import Deserializer, Serializer from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient -from msrest import Deserializer, Serializer from .. import models from ._configuration import RecoveryServicesBackupPassiveClientConfiguration @@ -21,7 +22,7 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class RecoveryServicesBackupPassiveClient: +class RecoveryServicesBackupPassiveClient: # pylint: disable=too-many-instance-attributes """Open API 2.0 Specs for Azure RecoveryServices Backup service. :ivar backup_usage_summaries_crr: BackupUsageSummariesCRROperations operations @@ -61,8 +62,11 @@ class RecoveryServicesBackupPassiveClient: :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The subscription Id. :type subscription_id: str - :param base_url: Service URL. Default value is 'https://management.azure.com'. + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str + :keyword api_version: Api Version. Default value is "2021-11-15". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_aad_properties_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_aad_properties_operations.py index 4c6802c4888d..8a6e4af07ba9 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_aad_properties_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_aad_properties_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -57,7 +56,7 @@ async def get( :param azure_region: Azure region to hit Api. :type azure_region: str - :param filter: OData filter options. + :param filter: OData filter options. Default value is None. :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response :return: AADPropertiesResource, or the result of cls(response) @@ -70,17 +69,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-15") # type: str + request = build_get_request( azure_region=azure_region, subscription_id=self._config.subscription_id, + api_version=api_version, filter=filter, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -95,5 +101,5 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupAadProperties'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupAadProperties"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_backup_crr_job_details_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_backup_crr_job_details_operations.py index 6f73a7828d24..c1ba7e8193eb 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_backup_crr_job_details_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_backup_crr_job_details_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -70,6 +69,7 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-15") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'CrrJobRequest') @@ -77,6 +77,7 @@ async def get( request = build_get_request( azure_region=azure_region, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.get.metadata['url'], @@ -84,7 +85,11 @@ async def get( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -99,5 +104,5 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupCrrJob'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupCrrJob"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_backup_crr_jobs_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_backup_crr_jobs_operations.py index 54bf05af55fd..c66b041be077 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_backup_crr_jobs_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_backup_crr_jobs_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -15,7 +14,6 @@ from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -63,9 +61,9 @@ def list( :type azure_region: str :param parameters: Backup CRR Job request. :type parameters: ~azure.mgmt.recoveryservicesbackup.passivestamp.models.CrrJobRequest - :param filter: OData filter options. + :param filter: OData filter options. Default value is None. :type filter: str - :param skip_token: skipToken Filter. + :param skip_token: skipToken Filter. Default value is None. :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either JobResourceList or the result of cls(response) @@ -73,6 +71,7 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicesbackup.passivestamp.models.JobResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-15") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType["_models.JobResourceList"] @@ -87,6 +86,7 @@ def prepare_request(next_link=None): request = build_list_request( azure_region=azure_region, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, filter=filter, @@ -102,6 +102,7 @@ def prepare_request(next_link=None): request = build_list_request( azure_region=azure_region, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, filter=filter, @@ -123,7 +124,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -137,4 +142,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupCrrJobs'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupCrrJobs"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_backup_protected_items_crr_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_backup_protected_items_crr_operations.py index 668a5df02e8f..78a047c95d36 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_backup_protected_items_crr_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_backup_protected_items_crr_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -15,7 +14,6 @@ from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -62,9 +60,9 @@ def list( :param resource_group_name: The name of the resource group where the recovery services vault is present. :type resource_group_name: str - :param filter: OData filter options. + :param filter: OData filter options. Default value is None. :type filter: str - :param skip_token: skipToken Filter. + :param skip_token: skipToken Filter. Default value is None. :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ProtectedItemResourceList or the result of @@ -73,6 +71,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicesbackup.passivestamp.models.ProtectedItemResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-15") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProtectedItemResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -85,6 +85,7 @@ def prepare_request(next_link=None): vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, filter=filter, skip_token=skip_token, template_url=self.list.metadata['url'], @@ -98,6 +99,7 @@ def prepare_request(next_link=None): vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, filter=filter, skip_token=skip_token, template_url=next_link, @@ -117,7 +119,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -131,4 +137,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectedItems/'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectedItems/"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_backup_resource_storage_configs_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_backup_resource_storage_configs_operations.py index 1f74de2fc940..674258d525f3 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_backup_resource_storage_configs_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_backup_resource_storage_configs_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -69,17 +68,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-15") # type: str + request = build_get_request( vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -94,7 +100,7 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig"} # type: ignore @distributed_trace_async @@ -126,6 +132,7 @@ async def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-15") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'BackupResourceConfigResource') @@ -134,6 +141,7 @@ async def update( vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.update.metadata['url'], @@ -141,7 +149,11 @@ async def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -156,11 +168,11 @@ async def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig"} # type: ignore @distributed_trace_async - async def patch( + async def patch( # pylint: disable=inconsistent-return-statements self, vault_name: str, resource_group_name: str, @@ -188,6 +200,7 @@ async def patch( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-15") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'BackupResourceConfigResource') @@ -196,6 +209,7 @@ async def patch( vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.patch.metadata['url'], @@ -203,7 +217,11 @@ async def patch( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [204]: @@ -214,5 +232,5 @@ async def patch( if cls: return cls(pipeline_response, None, {}) - patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig'} # type: ignore + patch.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_backup_usage_summaries_crr_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_backup_usage_summaries_crr_operations.py index f5ee7ec87b30..98cf725a5206 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_backup_usage_summaries_crr_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_backup_usage_summaries_crr_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -15,7 +14,6 @@ from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -62,9 +60,9 @@ def list( :param resource_group_name: The name of the resource group where the recovery services vault is present. :type resource_group_name: str - :param filter: OData filter options. + :param filter: OData filter options. Default value is None. :type filter: str - :param skip_token: skipToken Filter. + :param skip_token: skipToken Filter. Default value is None. :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either BackupManagementUsageList or the result of @@ -73,6 +71,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicesbackup.passivestamp.models.BackupManagementUsageList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-15") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupManagementUsageList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -85,6 +85,7 @@ def prepare_request(next_link=None): vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, filter=filter, skip_token=skip_token, template_url=self.list.metadata['url'], @@ -98,6 +99,7 @@ def prepare_request(next_link=None): vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, filter=filter, skip_token=skip_token, template_url=next_link, @@ -117,7 +119,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -131,4 +137,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupUsageSummaries'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupUsageSummaries"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_cross_region_restore_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_cross_region_restore_operations.py index 60a67ea5f89d..89cb89b4e68f 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_cross_region_restore_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_cross_region_restore_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar, Union from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -46,7 +45,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config - async def _trigger_initial( + async def _trigger_initial( # pylint: disable=inconsistent-return-statements self, azure_region: str, parameters: "_models.CrossRegionRestoreRequest", @@ -58,6 +57,7 @@ async def _trigger_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-15") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'CrossRegionRestoreRequest') @@ -65,6 +65,7 @@ async def _trigger_initial( request = build_trigger_request_initial( azure_region=azure_region, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self._trigger_initial.metadata['url'], @@ -72,7 +73,11 @@ async def _trigger_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -82,11 +87,11 @@ async def _trigger_initial( if cls: return cls(pipeline_response, None, {}) - _trigger_initial.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupCrossRegionRestore'} # type: ignore + _trigger_initial.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupCrossRegionRestore"} # type: ignore @distributed_trace_async - async def begin_trigger( + async def begin_trigger( # pylint: disable=inconsistent-return-statements self, azure_region: str, parameters: "_models.CrossRegionRestoreRequest", @@ -115,8 +120,9 @@ async def begin_trigger( :rtype: ~azure.core.polling.AsyncLROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-15") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -127,6 +133,7 @@ async def begin_trigger( raw_result = await self._trigger_initial( azure_region=azure_region, parameters=parameters, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -148,7 +155,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_trigger.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupCrossRegionRestore'} # type: ignore + begin_trigger.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupCrossRegionRestore"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_crr_operation_results_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_crr_operation_results_operations.py index c7aa83f3d5c0..8a5f7e0c807e 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_crr_operation_results_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_crr_operation_results_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -45,7 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._config = config @distributed_trace_async - async def get( + async def get( # pylint: disable=inconsistent-return-statements self, azure_region: str, operation_id: str, @@ -68,17 +67,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-15") # type: str + request = build_get_request( azure_region=azure_region, subscription_id=self._config.subscription_id, operation_id=operation_id, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -89,5 +95,5 @@ async def get( if cls: return cls(pipeline_response, None, {}) - get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupCrrOperationResults/{operationId}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupCrrOperationResults/{operationId}"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_crr_operation_status_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_crr_operation_status_operations.py index d9830ee8d705..d1d6219543fe 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_crr_operation_status_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_crr_operation_status_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -68,17 +67,24 @@ async def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-15") # type: str + request = build_get_request( azure_region=azure_region, subscription_id=self._config.subscription_id, operation_id=operation_id, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -93,5 +99,5 @@ async def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupCrrOperationsStatus/{operationId}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupCrrOperationsStatus/{operationId}"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_recovery_points_crr_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_recovery_points_crr_operations.py index 7fead857df18..0f5ee85efecb 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_recovery_points_crr_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_recovery_points_crr_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error @@ -15,7 +14,6 @@ from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models @@ -70,7 +68,7 @@ def list( :type container_name: str :param protected_item_name: Backed up item whose backup copies are to be fetched. :type protected_item_name: str - :param filter: OData filter options. + :param filter: OData filter options. Default value is None. :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either RecoveryPointResourceList or the result of @@ -79,6 +77,8 @@ def list( ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.recoveryservicesbackup.passivestamp.models.RecoveryPointResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-15") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.RecoveryPointResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -94,6 +94,7 @@ def prepare_request(next_link=None): fabric_name=fabric_name, container_name=container_name, protected_item_name=protected_item_name, + api_version=api_version, filter=filter, template_url=self.list.metadata['url'], ) @@ -109,6 +110,7 @@ def prepare_request(next_link=None): fabric_name=fabric_name, container_name=container_name, protected_item_name=protected_item_name, + api_version=api_version, filter=filter, template_url=next_link, ) @@ -127,7 +129,11 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -141,4 +147,4 @@ async def get_next(next_link=None): return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_recovery_points_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_recovery_points_operations.py index 9a99414c7562..a1851f1f4408 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_recovery_points_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/aio/operations/_recovery_points_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,7 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -86,6 +85,7 @@ async def get_access_token( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-15") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'AADPropertiesResource') @@ -98,6 +98,7 @@ async def get_access_token( container_name=container_name, protected_item_name=protected_item_name, recovery_point_id=recovery_point_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.get_access_token.metadata['url'], @@ -105,7 +106,11 @@ async def get_access_token( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -120,5 +125,5 @@ async def get_access_token( return deserialized - get_access_token.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/accessToken'} # type: ignore + get_access_token.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/accessToken"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_aad_properties_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_aad_properties_operations.py index bf95d3e2eb84..7c754f4f4639 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_aad_properties_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_aad_properties_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -15,7 +16,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -32,32 +32,33 @@ def build_get_request( filter: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-15" + api_version = kwargs.pop('api_version', "2021-11-15") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupAadProperties') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupAadProperties") # pylint: disable=line-too-long path_format_arguments = { "azureRegion": _SERIALIZER.url("azure_region", azure_region, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if filter is not None: - query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -96,7 +97,7 @@ def get( :param azure_region: Azure region to hit Api. :type azure_region: str - :param filter: OData filter options. + :param filter: OData filter options. Default value is None. :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response :return: AADPropertiesResource, or the result of cls(response) @@ -109,17 +110,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-15") # type: str + request = build_get_request( azure_region=azure_region, subscription_id=self._config.subscription_id, + api_version=api_version, filter=filter, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -134,5 +142,5 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupAadProperties'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupAadProperties"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_backup_crr_job_details_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_backup_crr_job_details_operations.py index bdba963a8b68..06c2f639184b 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_backup_crr_job_details_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_backup_crr_job_details_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -15,7 +16,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -34,34 +34,34 @@ def build_get_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-11-15") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-11-15" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupCrrJob') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupCrrJob") # pylint: disable=line-too-long path_format_arguments = { "azureRegion": _SERIALIZER.url("azure_region", azure_region, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -115,6 +115,7 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-15") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'CrrJobRequest') @@ -122,6 +123,7 @@ def get( request = build_get_request( azure_region=azure_region, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.get.metadata['url'], @@ -129,7 +131,11 @@ def get( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -144,5 +150,5 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupCrrJob'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupCrrJob"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_backup_crr_jobs_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_backup_crr_jobs_operations.py index bda9ac9865c2..beeaf77c9305 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_backup_crr_jobs_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_backup_crr_jobs_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -37,38 +37,38 @@ def build_list_request( skip_token: Optional[str] = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-11-15") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-11-15" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupCrrJobs') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupCrrJobs") # pylint: disable=line-too-long path_format_arguments = { "azureRegion": _SERIALIZER.url("azure_region", azure_region, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if filter is not None: - query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') if skip_token is not None: - query_parameters['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, 'str') + _query_parameters['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -113,9 +113,9 @@ def list( :type azure_region: str :param parameters: Backup CRR Job request. :type parameters: ~azure.mgmt.recoveryservicesbackup.passivestamp.models.CrrJobRequest - :param filter: OData filter options. + :param filter: OData filter options. Default value is None. :type filter: str - :param skip_token: skipToken Filter. + :param skip_token: skipToken Filter. Default value is None. :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either JobResourceList or the result of cls(response) @@ -123,6 +123,7 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicesbackup.passivestamp.models.JobResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-15") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] cls = kwargs.pop('cls', None) # type: ClsType["_models.JobResourceList"] @@ -137,6 +138,7 @@ def prepare_request(next_link=None): request = build_list_request( azure_region=azure_region, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, filter=filter, @@ -152,6 +154,7 @@ def prepare_request(next_link=None): request = build_list_request( azure_region=azure_region, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, filter=filter, @@ -173,7 +176,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -187,4 +194,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupCrrJobs'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupCrrJobs"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_backup_protected_items_crr_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_backup_protected_items_crr_operations.py index 8d56760eae2b..d70b4e4ee65a 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_backup_protected_items_crr_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_backup_protected_items_crr_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -35,35 +35,36 @@ def build_list_request( skip_token: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-15" + api_version = kwargs.pop('api_version', "2021-11-15") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectedItems/') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectedItems/") # pylint: disable=line-too-long path_format_arguments = { "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if filter is not None: - query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') if skip_token is not None: - query_parameters['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, 'str') + _query_parameters['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -105,9 +106,9 @@ def list( :param resource_group_name: The name of the resource group where the recovery services vault is present. :type resource_group_name: str - :param filter: OData filter options. + :param filter: OData filter options. Default value is None. :type filter: str - :param skip_token: skipToken Filter. + :param skip_token: skipToken Filter. Default value is None. :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ProtectedItemResourceList or the result of @@ -116,6 +117,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicesbackup.passivestamp.models.ProtectedItemResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-15") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.ProtectedItemResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -128,6 +131,7 @@ def prepare_request(next_link=None): vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, filter=filter, skip_token=skip_token, template_url=self.list.metadata['url'], @@ -141,6 +145,7 @@ def prepare_request(next_link=None): vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, filter=filter, skip_token=skip_token, template_url=next_link, @@ -160,7 +165,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -174,4 +183,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectedItems/'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupProtectedItems/"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_backup_resource_storage_configs_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_backup_resource_storage_configs_operations.py index 2008b7110eac..911bd41bbd28 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_backup_resource_storage_configs_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_backup_resource_storage_configs_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -15,7 +16,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -32,31 +32,32 @@ def build_get_request( subscription_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-15" + api_version = kwargs.pop('api_version', "2021-11-15") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig") # pylint: disable=line-too-long path_format_arguments = { "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -70,35 +71,35 @@ def build_update_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-11-15") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-11-15" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig") # pylint: disable=line-too-long path_format_arguments = { "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PUT", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -114,35 +115,35 @@ def build_patch_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-11-15") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-11-15" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig") # pylint: disable=line-too-long path_format_arguments = { "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="PATCH", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -195,17 +196,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-15") # type: str + request = build_get_request( vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -220,7 +228,7 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig"} # type: ignore @distributed_trace @@ -252,6 +260,7 @@ def update( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-15") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'BackupResourceConfigResource') @@ -260,6 +269,7 @@ def update( vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.update.metadata['url'], @@ -267,7 +277,11 @@ def update( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -282,11 +296,11 @@ def update( return deserialized - update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig'} # type: ignore + update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig"} # type: ignore @distributed_trace - def patch( + def patch( # pylint: disable=inconsistent-return-statements self, vault_name: str, resource_group_name: str, @@ -314,6 +328,7 @@ def patch( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-15") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'BackupResourceConfigResource') @@ -322,6 +337,7 @@ def patch( vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.patch.metadata['url'], @@ -329,7 +345,11 @@ def patch( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [204]: @@ -340,5 +360,5 @@ def patch( if cls: return cls(pipeline_response, None, {}) - patch.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig'} # type: ignore + patch.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupstorageconfig/vaultstorageconfig"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_backup_usage_summaries_crr_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_backup_usage_summaries_crr_operations.py index 81abb5d2180c..79a7b5d02029 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_backup_usage_summaries_crr_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_backup_usage_summaries_crr_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -35,35 +35,36 @@ def build_list_request( skip_token: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-15" + api_version = kwargs.pop('api_version', "2021-11-15") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupUsageSummaries') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupUsageSummaries") # pylint: disable=line-too-long path_format_arguments = { "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if filter is not None: - query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') if skip_token is not None: - query_parameters['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, 'str') + _query_parameters['$skipToken'] = _SERIALIZER.query("skip_token", skip_token, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -105,9 +106,9 @@ def list( :param resource_group_name: The name of the resource group where the recovery services vault is present. :type resource_group_name: str - :param filter: OData filter options. + :param filter: OData filter options. Default value is None. :type filter: str - :param skip_token: skipToken Filter. + :param skip_token: skipToken Filter. Default value is None. :type skip_token: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either BackupManagementUsageList or the result of @@ -116,6 +117,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicesbackup.passivestamp.models.BackupManagementUsageList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-15") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.BackupManagementUsageList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -128,6 +131,7 @@ def prepare_request(next_link=None): vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, filter=filter, skip_token=skip_token, template_url=self.list.metadata['url'], @@ -141,6 +145,7 @@ def prepare_request(next_link=None): vault_name=vault_name, resource_group_name=resource_group_name, subscription_id=self._config.subscription_id, + api_version=api_version, filter=filter, skip_token=skip_token, template_url=next_link, @@ -160,7 +165,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -174,4 +183,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupUsageSummaries'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupUsageSummaries"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_cross_region_restore_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_cross_region_restore_operations.py index 8eec0bc6e660..bbba09dc26a6 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_cross_region_restore_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_cross_region_restore_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -17,7 +18,6 @@ from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -36,34 +36,34 @@ def build_trigger_request_initial( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-11-15") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-11-15" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupCrossRegionRestore') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupCrossRegionRestore") # pylint: disable=line-too-long path_format_arguments = { "azureRegion": _SERIALIZER.url("azure_region", azure_region, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -91,7 +91,7 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config - def _trigger_initial( + def _trigger_initial( # pylint: disable=inconsistent-return-statements self, azure_region: str, parameters: "_models.CrossRegionRestoreRequest", @@ -103,6 +103,7 @@ def _trigger_initial( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-15") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'CrossRegionRestoreRequest') @@ -110,6 +111,7 @@ def _trigger_initial( request = build_trigger_request_initial( azure_region=azure_region, subscription_id=self._config.subscription_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self._trigger_initial.metadata['url'], @@ -117,7 +119,11 @@ def _trigger_initial( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -127,11 +133,11 @@ def _trigger_initial( if cls: return cls(pipeline_response, None, {}) - _trigger_initial.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupCrossRegionRestore'} # type: ignore + _trigger_initial.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupCrossRegionRestore"} # type: ignore @distributed_trace - def begin_trigger( + def begin_trigger( # pylint: disable=inconsistent-return-statements self, azure_region: str, parameters: "_models.CrossRegionRestoreRequest", @@ -160,8 +166,9 @@ def begin_trigger( :rtype: ~azure.core.polling.LROPoller[None] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-15") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -172,6 +179,7 @@ def begin_trigger( raw_result = self._trigger_initial( azure_region=azure_region, parameters=parameters, + api_version=api_version, content_type=content_type, cls=lambda x,y,z: x, **kwargs @@ -193,7 +201,6 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_trigger.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupCrossRegionRestore'} # type: ignore + begin_trigger.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupCrossRegionRestore"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_crr_operation_results_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_crr_operation_results_operations.py index 2bad83cac11e..b5ebcda3823f 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_crr_operation_results_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_crr_operation_results_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -15,7 +16,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -31,31 +31,32 @@ def build_get_request( operation_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-15" + api_version = kwargs.pop('api_version', "2021-11-15") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupCrrOperationResults/{operationId}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupCrrOperationResults/{operationId}") # pylint: disable=line-too-long path_format_arguments = { "azureRegion": _SERIALIZER.url("azure_region", azure_region, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "operationId": _SERIALIZER.url("operation_id", operation_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -82,7 +83,7 @@ def __init__(self, client, config, serializer, deserializer): self._config = config @distributed_trace - def get( + def get( # pylint: disable=inconsistent-return-statements self, azure_region: str, operation_id: str, @@ -105,17 +106,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-15") # type: str + request = build_get_request( azure_region=azure_region, subscription_id=self._config.subscription_id, operation_id=operation_id, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: @@ -126,5 +134,5 @@ def get( if cls: return cls(pipeline_response, None, {}) - get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupCrrOperationResults/{operationId}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupCrrOperationResults/{operationId}"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_crr_operation_status_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_crr_operation_status_operations.py index 6af088ef8eb1..3b041c1f4740 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_crr_operation_status_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_crr_operation_status_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -15,7 +16,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -31,31 +31,32 @@ def build_get_request( operation_id: str, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-15" + api_version = kwargs.pop('api_version', "2021-11-15") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupCrrOperationsStatus/{operationId}') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupCrrOperationsStatus/{operationId}") # pylint: disable=line-too-long path_format_arguments = { "azureRegion": _SERIALIZER.url("azure_region", azure_region, 'str'), "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), "operationId": _SERIALIZER.url("operation_id", operation_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -105,17 +106,24 @@ def get( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-15") # type: str + request = build_get_request( azure_region=azure_region, subscription_id=self._config.subscription_id, operation_id=operation_id, + api_version=api_version, template_url=self.get.metadata['url'], ) request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -130,5 +138,5 @@ def get( return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupCrrOperationsStatus/{operationId}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.RecoveryServices/locations/{azureRegion}/backupCrrOperationsStatus/{operationId}"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_recovery_points_crr_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_recovery_points_crr_operations.py index ea89d9bf48b7..f9812d2d2321 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_recovery_points_crr_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_recovery_points_crr_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged @@ -16,7 +17,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -37,10 +37,11 @@ def build_list_request( filter: Optional[str] = None, **kwargs: Any ) -> HttpRequest: - api_version = "2021-11-15" + api_version = kwargs.pop('api_version', "2021-11-15") # type: str + accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/") # pylint: disable=line-too-long path_format_arguments = { "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -50,23 +51,23 @@ def build_list_request( "protectedItemName": _SERIALIZER.url("protected_item_name", protected_item_name, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') if filter is not None: - query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') + _query_parameters['$filter'] = _SERIALIZER.query("filter", filter, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="GET", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, **kwargs ) @@ -116,7 +117,7 @@ def list( :type container_name: str :param protected_item_name: Backed up item whose backup copies are to be fetched. :type protected_item_name: str - :param filter: OData filter options. + :param filter: OData filter options. Default value is None. :type filter: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either RecoveryPointResourceList or the result of @@ -125,6 +126,8 @@ def list( ~azure.core.paging.ItemPaged[~azure.mgmt.recoveryservicesbackup.passivestamp.models.RecoveryPointResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-11-15") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.RecoveryPointResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError @@ -140,6 +143,7 @@ def prepare_request(next_link=None): fabric_name=fabric_name, container_name=container_name, protected_item_name=protected_item_name, + api_version=api_version, filter=filter, template_url=self.list.metadata['url'], ) @@ -155,6 +159,7 @@ def prepare_request(next_link=None): fabric_name=fabric_name, container_name=container_name, protected_item_name=protected_item_name, + api_version=api_version, filter=filter, template_url=next_link, ) @@ -173,7 +178,11 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -187,4 +196,4 @@ def get_next(next_link=None): return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/"} # type: ignore diff --git a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_recovery_points_operations.py b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_recovery_points_operations.py index be50688b611d..a390df713f38 100644 --- a/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_recovery_points_operations.py +++ b/sdk/recoveryservices/azure-mgmt-recoveryservicesbackup/azure/mgmt/recoveryservicesbackup/passivestamp/operations/_recovery_points_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,9 +6,9 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -import functools -from typing import Any, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse @@ -15,7 +16,6 @@ from azure.core.rest import HttpRequest from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat -from msrest import Serializer from .. import models as _models from .._vendor import _convert_request, _format_url_section @@ -39,12 +39,12 @@ def build_get_access_token_request( content: Any = None, **kwargs: Any ) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-11-15") # type: str content_type = kwargs.pop('content_type', None) # type: Optional[str] - api_version = "2021-11-15" accept = "application/json" # Construct URL - url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/accessToken') + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/accessToken") # pylint: disable=line-too-long path_format_arguments = { "vaultName": _SERIALIZER.url("vault_name", vault_name, 'str'), "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), @@ -55,23 +55,23 @@ def build_get_access_token_request( "recoveryPointId": _SERIALIZER.url("recovery_point_id", recovery_point_id, 'str'), } - url = _format_url_section(url, **path_format_arguments) + _url = _format_url_section(_url, **path_format_arguments) # Construct parameters - query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] - query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') # Construct headers - header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] if content_type is not None: - header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') - header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') return HttpRequest( method="POST", - url=url, - params=query_parameters, - headers=header_parameters, + url=_url, + params=_query_parameters, + headers=_header_parameters, json=json, content=content, **kwargs @@ -141,6 +141,7 @@ def get_access_token( } error_map.update(kwargs.pop('error_map', {})) + api_version = kwargs.pop('api_version', "2021-11-15") # type: str content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] _json = self._serialize.body(parameters, 'AADPropertiesResource') @@ -153,6 +154,7 @@ def get_access_token( container_name=container_name, protected_item_name=protected_item_name, recovery_point_id=recovery_point_id, + api_version=api_version, content_type=content_type, json=_json, template_url=self.get_access_token.metadata['url'], @@ -160,7 +162,11 @@ def get_access_token( request = _convert_request(request) request.url = self._client.format_url(request.url) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: @@ -175,5 +181,5 @@ def get_access_token( return deserialized - get_access_token.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/accessToken'} # type: ignore + get_access_token.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/backupFabrics/{fabricName}/protectionContainers/{containerName}/protectedItems/{protectedItemName}/recoveryPoints/{recoveryPointId}/accessToken"} # type: ignore diff --git a/sdk/servicefabric/azure-mgmt-servicefabric/_meta.json b/sdk/servicefabric/azure-mgmt-servicefabric/_meta.json index cafc58d3eeea..d0e6c8903365 100644 --- a/sdk/servicefabric/azure-mgmt-servicefabric/_meta.json +++ b/sdk/servicefabric/azure-mgmt-servicefabric/_meta.json @@ -1,11 +1,11 @@ { - "autorest": "3.4.5", + "autorest": "3.7.2", "use": [ - "@autorest/python@5.8.4", - "@autorest/modelerfour@4.19.2" + "@autorest/python@5.13.0", + "@autorest/modelerfour@4.19.3" ], - "commit": "4272591f9214235c325d8e49ff3eedc7cd022f6a", + "commit": "55090ea4342b5dac48bc2e9706e3a59465ffa34c", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest_command": "autorest specification/servicefabric/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --track2 --use=@autorest/python@5.8.4 --use=@autorest/modelerfour@4.19.2 --version=3.4.5", - "readme": "specification/servicefabric/resource-manager/readme.md" + "autorest_command": "autorest servicefabric/resource-manager/readme.md --multiapi --python --python-sdks-folder=/sdk-repo/sdk --python3-only --use=@autorest/python@5.13.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2", + "readme": "servicefabric/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/__init__.py b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/__init__.py index 4757f3109a7c..5de202ff4388 100644 --- a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/__init__.py +++ b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['ServiceFabricManagementClient'] -try: - from ._patch import patch_sdk # type: ignore - patch_sdk() -except ImportError: - pass +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/_configuration.py b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/_configuration.py index 208b027514b2..3d00d2253fea 100644 --- a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/_configuration.py +++ b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/_configuration.py @@ -6,22 +6,20 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential -class ServiceFabricManagementClientConfiguration(Configuration): +class ServiceFabricManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for ServiceFabricManagementClient. Note that all parameters used to create this instance are saved as instance @@ -31,24 +29,28 @@ class ServiceFabricManagementClientConfiguration(Configuration): :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The customer subscription identifier. :type subscription_id: str + :keyword api_version: Api Version. Default value is "2021-06-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(ServiceFabricManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2021-06-01") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(ServiceFabricManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id - self.api_version = "2021-06-01" + self.api_version = api_version self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-servicefabric/{}'.format(VERSION)) self._configure(**kwargs) @@ -68,4 +70,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/_metadata.json b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/_metadata.json index e2d072b58bc8..4eb8e26fd8b0 100644 --- a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/_metadata.json +++ b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/_metadata.json @@ -5,13 +5,13 @@ "name": "ServiceFabricManagementClient", "filename": "_service_fabric_management_client", "description": "Service Fabric Management Client.", - "base_url": "\u0027https://management.azure.com\u0027", - "custom_base_url": null, + "host_value": "\"https://management.azure.com\"", + "parameterized_host_template": null, "azure_arm": true, "has_lro_operations": true, "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ServiceFabricManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ServiceFabricManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" + "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ServiceFabricManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}", + "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"], \"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ServiceFabricManagementClientConfiguration\"]}, \"thirdparty\": {\"msrest\": [\"Deserializer\", \"Serializer\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}}" }, "global_parameters": { "sync": { @@ -54,7 +54,7 @@ "required": false }, "base_url": { - "signature": "base_url=None, # type: Optional[str]", + "signature": "base_url=\"https://management.azure.com\", # type: str", "description": "Service URL", "docstring_type": "str", "required": false @@ -74,7 +74,7 @@ "required": false }, "base_url": { - "signature": "base_url: Optional[str] = None,", + "signature": "base_url: str = \"https://management.azure.com\",", "description": "Service URL", "docstring_type": "str", "required": false @@ -91,11 +91,10 @@ "config": { "credential": true, "credential_scopes": ["https://management.azure.com/.default"], - "credential_default_policy_type": "BearerTokenCredentialPolicy", - "credential_default_policy_type_has_async_version": true, - "credential_key_header_name": null, - "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" + "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", + "sync_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", + "async_imports": "{\"regular\": {\"azurecore\": {\"azure.core.configuration\": [\"Configuration\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" }, "operation_groups": { "clusters": "ClustersOperations", diff --git a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/_patch.py b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/_service_fabric_management_client.py b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/_service_fabric_management_client.py index 1a50f2e95575..9fcfaca474b4 100644 --- a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/_service_fabric_management_client.py +++ b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/_service_fabric_management_client.py @@ -6,30 +6,23 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from copy import deepcopy +from typing import Any, TYPE_CHECKING -from azure.mgmt.core import ARMPipelineClient from msrest import Deserializer, Serializer -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - - from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.mgmt.core import ARMPipelineClient -from ._configuration import ServiceFabricManagementClientConfiguration -from .operations import ClustersOperations -from .operations import ClusterVersionsOperations -from .operations import Operations -from .operations import ApplicationTypesOperations -from .operations import ApplicationTypeVersionsOperations -from .operations import ApplicationsOperations -from .operations import ServicesOperations from . import models +from ._configuration import ServiceFabricManagementClientConfiguration +from .operations import ApplicationTypeVersionsOperations, ApplicationTypesOperations, ApplicationsOperations, ClusterVersionsOperations, ClustersOperations, Operations, ServicesOperations +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential -class ServiceFabricManagementClient(object): +class ServiceFabricManagementClient: # pylint: disable=too-many-instance-attributes """Service Fabric Management Client. :ivar clusters: ClustersOperations operations @@ -41,7 +34,8 @@ class ServiceFabricManagementClient(object): :ivar application_types: ApplicationTypesOperations operations :vartype application_types: azure.mgmt.servicefabric.operations.ApplicationTypesOperations :ivar application_type_versions: ApplicationTypeVersionsOperations operations - :vartype application_type_versions: azure.mgmt.servicefabric.operations.ApplicationTypeVersionsOperations + :vartype application_type_versions: + azure.mgmt.servicefabric.operations.ApplicationTypeVersionsOperations :ivar applications: ApplicationsOperations operations :vartype applications: azure.mgmt.servicefabric.operations.ApplicationsOperations :ivar services: ServicesOperations operations @@ -50,60 +44,63 @@ class ServiceFabricManagementClient(object): :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The customer subscription identifier. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is "https://management.azure.com". + :type base_url: str + :keyword api_version: Api Version. Default value is "2021-06-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - base_url=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = ServiceFabricManagementClientConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = ServiceFabricManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.clusters = ClustersOperations(self._client, self._config, self._serialize, self._deserialize) + self.cluster_versions = ClusterVersionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.application_types = ApplicationTypesOperations(self._client, self._config, self._serialize, self._deserialize) + self.application_type_versions = ApplicationTypeVersionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.applications = ApplicationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.services = ServicesOperations(self._client, self._config, self._serialize, self._deserialize) + - self.clusters = ClustersOperations( - self._client, self._config, self._serialize, self._deserialize) - self.cluster_versions = ClusterVersionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.application_types = ApplicationTypesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.application_type_versions = ApplicationTypeVersionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.applications = ApplicationsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.services = ServicesOperations( - self._client, self._config, self._serialize, self._deserialize) - - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> HttpResponse: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.HttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) def close(self): # type: () -> None diff --git a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/_vendor.py b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/_version.py b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/_version.py index 48944bf3938a..e5754a47ce68 100644 --- a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/_version.py +++ b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/aio/__init__.py b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/aio/__init__.py index 2f0d7de874fd..d3ddfd01816e 100644 --- a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/aio/__init__.py +++ b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/aio/__init__.py @@ -8,3 +8,8 @@ from ._service_fabric_management_client import ServiceFabricManagementClient __all__ = ['ServiceFabricManagementClient'] + +# `._patch.py` is used for handwritten extensions to the generated code +# Example: https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +from ._patch import patch_sdk +patch_sdk() diff --git a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/aio/_configuration.py b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/aio/_configuration.py index cba0c3a330ce..967db0471633 100644 --- a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/aio/_configuration.py +++ b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/aio/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION @@ -19,7 +19,7 @@ from azure.core.credentials_async import AsyncTokenCredential -class ServiceFabricManagementClientConfiguration(Configuration): +class ServiceFabricManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for ServiceFabricManagementClient. Note that all parameters used to create this instance are saved as instance @@ -29,6 +29,9 @@ class ServiceFabricManagementClientConfiguration(Configuration): :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The customer subscription identifier. :type subscription_id: str + :keyword api_version: Api Version. Default value is "2021-06-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -37,15 +40,17 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(ServiceFabricManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2021-06-01") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(ServiceFabricManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id - self.api_version = "2021-06-01" + self.api_version = api_version self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-servicefabric/{}'.format(VERSION)) self._configure(**kwargs) @@ -64,4 +69,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/aio/_patch.py b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/aio/_patch.py new file mode 100644 index 000000000000..74e48ecd07cf --- /dev/null +++ b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/aio/_patch.py @@ -0,0 +1,31 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# +# Copyright (c) Microsoft Corporation. All rights reserved. +# +# The MIT License (MIT) +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the ""Software""), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +# IN THE SOFTWARE. +# +# -------------------------------------------------------------------------- + +# This file is used for handwritten extensions to the generated code. Example: +# https://github.com/Azure/azure-sdk-for-python/blob/main/doc/dev/customize_code/how-to-patch-sdk-code.md +def patch_sdk(): + pass \ No newline at end of file diff --git a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/aio/_service_fabric_management_client.py b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/aio/_service_fabric_management_client.py index f9db8bc059c1..52fe01b0224c 100644 --- a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/aio/_service_fabric_management_client.py +++ b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/aio/_service_fabric_management_client.py @@ -6,28 +6,23 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest -from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient -from ._configuration import ServiceFabricManagementClientConfiguration -from .operations import ClustersOperations -from .operations import ClusterVersionsOperations -from .operations import Operations -from .operations import ApplicationTypesOperations -from .operations import ApplicationTypeVersionsOperations -from .operations import ApplicationsOperations -from .operations import ServicesOperations from .. import models +from ._configuration import ServiceFabricManagementClientConfiguration +from .operations import ApplicationTypeVersionsOperations, ApplicationTypesOperations, ApplicationsOperations, ClusterVersionsOperations, ClustersOperations, Operations, ServicesOperations +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential -class ServiceFabricManagementClient(object): +class ServiceFabricManagementClient: # pylint: disable=too-many-instance-attributes """Service Fabric Management Client. :ivar clusters: ClustersOperations operations @@ -39,7 +34,8 @@ class ServiceFabricManagementClient(object): :ivar application_types: ApplicationTypesOperations operations :vartype application_types: azure.mgmt.servicefabric.aio.operations.ApplicationTypesOperations :ivar application_type_versions: ApplicationTypeVersionsOperations operations - :vartype application_type_versions: azure.mgmt.servicefabric.aio.operations.ApplicationTypeVersionsOperations + :vartype application_type_versions: + azure.mgmt.servicefabric.aio.operations.ApplicationTypeVersionsOperations :ivar applications: ApplicationsOperations operations :vartype applications: azure.mgmt.servicefabric.aio.operations.ApplicationsOperations :ivar services: ServicesOperations operations @@ -48,58 +44,63 @@ class ServiceFabricManagementClient(object): :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The customer subscription identifier. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is "https://management.azure.com". + :type base_url: str + :keyword api_version: Api Version. Default value is "2021-06-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, - base_url: Optional[str] = None, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = ServiceFabricManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = ServiceFabricManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.clusters = ClustersOperations(self._client, self._config, self._serialize, self._deserialize) + self.cluster_versions = ClusterVersionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.application_types = ApplicationTypesOperations(self._client, self._config, self._serialize, self._deserialize) + self.application_type_versions = ApplicationTypeVersionsOperations(self._client, self._config, self._serialize, self._deserialize) + self.applications = ApplicationsOperations(self._client, self._config, self._serialize, self._deserialize) + self.services = ServicesOperations(self._client, self._config, self._serialize, self._deserialize) - self.clusters = ClustersOperations( - self._client, self._config, self._serialize, self._deserialize) - self.cluster_versions = ClusterVersionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.application_types = ApplicationTypesOperations( - self._client, self._config, self._serialize, self._deserialize) - self.application_type_versions = ApplicationTypeVersionsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.applications = ApplicationsOperations( - self._client, self._config, self._serialize, self._deserialize) - self.services = ServicesOperations( - self._client, self._config, self._serialize, self._deserialize) - - async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.AsyncHttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) async def close(self) -> None: await self._client.close() diff --git a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/aio/operations/_application_type_versions_operations.py b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/aio/operations/_application_type_versions_operations.py index 24ad457214c3..c7056780ea51 100644 --- a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/aio/operations/_application_type_versions_operations.py +++ b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/aio/operations/_application_type_versions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,18 +6,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar, Union from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._application_type_versions_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -42,6 +45,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -73,35 +77,32 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'applicationTypeName': self._serialize.url("application_type_name", application_type_name, 'str'), - 'version': self._serialize.url("version", version, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2021-06-01") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_type_name=application_type_name, + version=version, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ApplicationTypeVersionResource', pipeline_response) @@ -110,7 +111,9 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}/versions/{version}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}/versions/{version}"} # type: ignore + async def _create_or_update_initial( self, @@ -126,41 +129,36 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - 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'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'applicationTypeName': self._serialize.url("application_type_name", application_type_name, 'str'), - 'version': self._serialize.url("version", version, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ApplicationTypeVersionResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-06-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ApplicationTypeVersionResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_type_name=application_type_name, + version=version, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = self._deserialize('ApplicationTypeVersionResource', pipeline_response) @@ -168,8 +166,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}/versions/{version}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}/versions/{version}"} # type: ignore + + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -195,14 +196,20 @@ async def begin_create_or_update( :type parameters: ~azure.mgmt.servicefabric.models.ApplicationTypeVersionResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ApplicationTypeVersionResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicefabric.models.ApplicationTypeVersionResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ApplicationTypeVersionResource or + the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicefabric.models.ApplicationTypeVersionResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-06-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationTypeVersionResource"] lro_delay = kwargs.pop( @@ -217,29 +224,22 @@ async def begin_create_or_update( application_type_name=application_type_name, version=version, parameters=parameters, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ApplicationTypeVersionResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - 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'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'applicationTypeName': self._serialize.url("application_type_name", application_type_name, 'str'), - 'version': self._serialize.url("version", version, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -249,11 +249,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}/versions/{version}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}/versions/{version}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cluster_name: str, @@ -266,43 +266,41 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - 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'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'applicationTypeName': self._serialize.url("application_type_name", application_type_name, 'str'), - 'version': self._serialize.url("version", version, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2021-06-01") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_type_name=application_type_name, + version=version, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}/versions/{version}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}/versions/{version}"} # type: ignore - async def begin_delete( + + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cluster_name: str, @@ -324,14 +322,17 @@ async def begin_delete( :type version: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-06-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -345,26 +346,18 @@ async def begin_delete( cluster_name=cluster_name, application_type_name=application_type_name, version=version, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - 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'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'applicationTypeName': self._serialize.url("application_type_name", application_type_name, 'str'), - 'version': self._serialize.url("version", version, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -374,10 +367,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}/versions/{version}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}/versions/{version}"} # type: ignore + + @distributed_trace_async async def list( self, resource_group_name: str, @@ -385,7 +379,8 @@ async def list( application_type_name: str, **kwargs: Any ) -> "_models.ApplicationTypeVersionResourceList": - """Gets the list of application type version resources created in the specified Service Fabric application type name resource. + """Gets the list of application type version resources created in the specified Service Fabric + application type name resource. Gets all application type version resources created or in the process of being created in the Service Fabric application type name resource. @@ -406,34 +401,31 @@ async def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.list.metadata['url'] # type: ignore - 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'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'applicationTypeName': self._serialize.url("application_type_name", application_type_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2021-06-01") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_type_name=application_type_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ApplicationTypeVersionResourceList', pipeline_response) @@ -442,4 +434,6 @@ async def list( return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}/versions'} # type: ignore + + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}/versions"} # type: ignore + diff --git a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/aio/operations/_application_types_operations.py b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/aio/operations/_application_types_operations.py index 16ea77c9b92b..2c5bbe362f64 100644 --- a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/aio/operations/_application_types_operations.py +++ b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/aio/operations/_application_types_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,18 +6,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar, Union from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._application_types_operations import build_create_or_update_request, build_delete_request_initial, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -42,6 +45,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -70,34 +74,31 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'applicationTypeName': self._serialize.url("application_type_name", application_type_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2021-06-01") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_type_name=application_type_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ApplicationTypeResource', pipeline_response) @@ -106,8 +107,11 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}"} # type: ignore + + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, @@ -138,39 +142,35 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - 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'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'applicationTypeName': self._serialize.url("application_type_name", application_type_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ApplicationTypeResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-06-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ApplicationTypeResource') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_type_name=application_type_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ApplicationTypeResource', pipeline_response) @@ -179,9 +179,11 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}'} # type: ignore - async def _delete_initial( + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}"} # type: ignore + + + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cluster_name: str, @@ -193,42 +195,40 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - 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'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'applicationTypeName': self._serialize.url("application_type_name", application_type_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2021-06-01") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_type_name=application_type_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}"} # type: ignore - async def begin_delete( + + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cluster_name: str, @@ -247,14 +247,17 @@ async def begin_delete( :type application_type_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-06-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -267,25 +270,18 @@ async def begin_delete( resource_group_name=resource_group_name, cluster_name=cluster_name, application_type_name=application_type_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - 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'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'applicationTypeName': self._serialize.url("application_type_name", application_type_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -295,17 +291,19 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}"} # type: ignore + @distributed_trace_async async def list( self, resource_group_name: str, cluster_name: str, **kwargs: Any ) -> "_models.ApplicationTypeResourceList": - """Gets the list of application type name resources created in the specified Service Fabric cluster resource. + """Gets the list of application type name resources created in the specified Service Fabric + cluster resource. Gets all application type name resources created or in the process of being created in the Service Fabric cluster resource. @@ -324,33 +322,30 @@ async def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.list.metadata['url'] # type: ignore - 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'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2021-06-01") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ApplicationTypeResourceList', pipeline_response) @@ -359,4 +354,6 @@ async def list( return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes'} # type: ignore + + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes"} # type: ignore + diff --git a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/aio/operations/_applications_operations.py b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/aio/operations/_applications_operations.py index 5dbd2c7b4986..84f95afa633b 100644 --- a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/aio/operations/_applications_operations.py +++ b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/aio/operations/_applications_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,18 +6,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar, Union from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._applications_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -42,6 +45,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -70,34 +74,31 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'applicationName': self._serialize.url("application_name", application_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2021-06-01") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_name=application_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ApplicationResource', pipeline_response) @@ -106,7 +107,9 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}"} # type: ignore + async def _create_or_update_initial( self, @@ -121,40 +124,35 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - 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'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'applicationName': self._serialize.url("application_name", application_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ApplicationResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-06-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ApplicationResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_name=application_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = self._deserialize('ApplicationResource', pipeline_response) @@ -162,8 +160,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}"} # type: ignore + + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -186,14 +187,20 @@ async def begin_create_or_update( :type parameters: ~azure.mgmt.servicefabric.models.ApplicationResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ApplicationResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicefabric.models.ApplicationResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ApplicationResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicefabric.models.ApplicationResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-06-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationResource"] lro_delay = kwargs.pop( @@ -207,28 +214,22 @@ async def begin_create_or_update( cluster_name=cluster_name, application_name=application_name, parameters=parameters, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ApplicationResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - 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'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'applicationName': self._serialize.url("application_name", application_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -238,9 +239,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}"} # type: ignore async def _update_initial( self, @@ -255,40 +256,35 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - 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'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'applicationName': self._serialize.url("application_name", application_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ApplicationResourceUpdate') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-06-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ApplicationResourceUpdate') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_name=application_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = self._deserialize('ApplicationResource', pipeline_response) @@ -296,8 +292,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}"} # type: ignore + + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -320,14 +319,20 @@ async def begin_update( :type parameters: ~azure.mgmt.servicefabric.models.ApplicationResourceUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ApplicationResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicefabric.models.ApplicationResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ApplicationResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicefabric.models.ApplicationResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-06-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationResource"] lro_delay = kwargs.pop( @@ -341,28 +346,22 @@ async def begin_update( cluster_name=cluster_name, application_name=application_name, parameters=parameters, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ApplicationResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - 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'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'applicationName': self._serialize.url("application_name", application_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -372,11 +371,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _delete_initial( + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}"} # type: ignore + + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cluster_name: str, @@ -388,42 +387,40 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - 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'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'applicationName': self._serialize.url("application_name", application_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2021-06-01") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_name=application_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}"} # type: ignore + - async def begin_delete( + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cluster_name: str, @@ -442,14 +439,17 @@ async def begin_delete( :type application_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-06-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -462,25 +462,18 @@ async def begin_delete( resource_group_name=resource_group_name, cluster_name=cluster_name, application_name=application_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - 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'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'applicationName': self._serialize.url("application_name", application_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -490,17 +483,19 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}"} # type: ignore + + @distributed_trace_async async def list( self, resource_group_name: str, cluster_name: str, **kwargs: Any ) -> "_models.ApplicationResourceList": - """Gets the list of application resources created in the specified Service Fabric cluster resource. + """Gets the list of application resources created in the specified Service Fabric cluster + resource. Gets all application resources created or in the process of being created in the Service Fabric cluster resource. @@ -519,33 +514,30 @@ async def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.list.metadata['url'] # type: ignore - 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'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2021-06-01") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ApplicationResourceList', pipeline_response) @@ -554,4 +546,6 @@ async def list( return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications'} # type: ignore + + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications"} # type: ignore + diff --git a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/aio/operations/_cluster_versions_operations.py b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/aio/operations/_cluster_versions_operations.py index 242e960af2ae..9c3f91dd6152 100644 --- a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/aio/operations/_cluster_versions_operations.py +++ b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/aio/operations/_cluster_versions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,16 +6,18 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar, Union from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._cluster_versions_operations import build_get_by_environment_request, build_get_request, build_list_by_environment_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -40,13 +43,15 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, location: str, cluster_version: str, **kwargs: Any ) -> "_models.ClusterCodeVersionsListResult": - """Gets information about a Service Fabric cluster code version available in the specified location. + """Gets information about a Service Fabric cluster code version available in the specified + location. Gets information about an available Service Fabric cluster code version. @@ -65,33 +70,30 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'location': self._serialize.url("location", location, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'clusterVersion': self._serialize.url("cluster_version", cluster_version, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + api_version = kwargs.pop('api_version', "2021-06-01") # type: str + + + request = build_get_request( + location=location, + subscription_id=self._config.subscription_id, + cluster_version=cluster_version, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ClusterCodeVersionsListResult', pipeline_response) @@ -100,16 +102,20 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/clusterVersions/{clusterVersion}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/clusterVersions/{clusterVersion}"} # type: ignore + + + @distributed_trace_async async def get_by_environment( self, location: str, - environment: Union[str, "_models.Enum14"], + environment: Union[str, "_models.ClusterVersionsEnvironment"], cluster_version: str, **kwargs: Any ) -> "_models.ClusterCodeVersionsListResult": - """Gets information about a Service Fabric cluster code version available for the specified environment. + """Gets information about a Service Fabric cluster code version available for the specified + environment. Gets information about an available Service Fabric cluster code version by environment. @@ -117,7 +123,7 @@ async def get_by_environment( location. :type location: str :param environment: The operating system of the cluster. The default means all. - :type environment: str or ~azure.mgmt.servicefabric.models.Enum14 + :type environment: str or ~azure.mgmt.servicefabric.models.ClusterVersionsEnvironment :param cluster_version: The cluster code version. :type cluster_version: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -130,34 +136,31 @@ async def get_by_environment( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get_by_environment.metadata['url'] # type: ignore - path_format_arguments = { - 'location': self._serialize.url("location", location, 'str'), - 'environment': self._serialize.url("environment", environment, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'clusterVersion': self._serialize.url("cluster_version", cluster_version, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + api_version = kwargs.pop('api_version', "2021-06-01") # type: str + + + request = build_get_by_environment_request( + location=location, + environment=environment, + subscription_id=self._config.subscription_id, + cluster_version=cluster_version, + api_version=api_version, + template_url=self.get_by_environment.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ClusterCodeVersionsListResult', pipeline_response) @@ -166,8 +169,11 @@ async def get_by_environment( return cls(pipeline_response, deserialized, {}) return deserialized - get_by_environment.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/environments/{environment}/clusterVersions/{clusterVersion}'} # type: ignore + get_by_environment.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/environments/{environment}/clusterVersions/{clusterVersion}"} # type: ignore + + + @distributed_trace_async async def list( self, location: str, @@ -190,32 +196,29 @@ async def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'location': self._serialize.url("location", location, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + api_version = kwargs.pop('api_version', "2021-06-01") # type: str + + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ClusterCodeVersionsListResult', pipeline_response) @@ -224,12 +227,15 @@ async def list( return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/clusterVersions'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/clusterVersions"} # type: ignore + + + @distributed_trace_async async def list_by_environment( self, location: str, - environment: Union[str, "_models.Enum14"], + environment: Union[str, "_models.ClusterVersionsEnvironment"], **kwargs: Any ) -> "_models.ClusterCodeVersionsListResult": """Gets the list of Service Fabric cluster code versions available for the specified environment. @@ -240,7 +246,7 @@ async def list_by_environment( location. :type location: str :param environment: The operating system of the cluster. The default means all. - :type environment: str or ~azure.mgmt.servicefabric.models.Enum14 + :type environment: str or ~azure.mgmt.servicefabric.models.ClusterVersionsEnvironment :keyword callable cls: A custom type or function that will be passed the direct response :return: ClusterCodeVersionsListResult, or the result of cls(response) :rtype: ~azure.mgmt.servicefabric.models.ClusterCodeVersionsListResult @@ -251,33 +257,30 @@ async def list_by_environment( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.list_by_environment.metadata['url'] # type: ignore - path_format_arguments = { - 'location': self._serialize.url("location", location, 'str'), - 'environment': self._serialize.url("environment", environment, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + api_version = kwargs.pop('api_version', "2021-06-01") # type: str + + + request = build_list_by_environment_request( + location=location, + environment=environment, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_environment.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ClusterCodeVersionsListResult', pipeline_response) @@ -286,4 +289,6 @@ async def list_by_environment( return cls(pipeline_response, deserialized, {}) return deserialized - list_by_environment.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/environments/{environment}/clusterVersions'} # type: ignore + + list_by_environment.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/environments/{environment}/clusterVersions"} # type: ignore + diff --git a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/aio/operations/_clusters_operations.py b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/aio/operations/_clusters_operations.py index 3b05f0764ef3..3cfac20613f6 100644 --- a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/aio/operations/_clusters_operations.py +++ b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/aio/operations/_clusters_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,18 +6,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar, Union from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._clusters_operations import build_create_or_update_request_initial, build_delete_request, build_get_request, build_list_by_resource_group_request, build_list_request, build_list_upgradable_versions_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -42,6 +45,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -67,33 +71,30 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2021-06-01") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Cluster', pipeline_response) @@ -102,7 +103,9 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}"} # type: ignore + async def _create_or_update_initial( self, @@ -116,39 +119,34 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'Cluster') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-06-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'Cluster') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('Cluster', pipeline_response) @@ -160,8 +158,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}"} # type: ignore + + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -181,14 +182,19 @@ async def begin_create_or_update( :type parameters: ~azure.mgmt.servicefabric.models.Cluster :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Cluster or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Cluster or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicefabric.models.Cluster] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-06-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Cluster"] lro_delay = kwargs.pop( @@ -201,27 +207,22 @@ async def begin_create_or_update( resource_group_name=resource_group_name, cluster_name=cluster_name, parameters=parameters, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Cluster', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -231,9 +232,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}"} # type: ignore async def _update_initial( self, @@ -247,39 +248,34 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ClusterUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-06-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ClusterUpdateParameters') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('Cluster', pipeline_response) @@ -291,8 +287,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}"} # type: ignore + + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -313,14 +312,19 @@ async def begin_update( :type parameters: ~azure.mgmt.servicefabric.models.ClusterUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Cluster or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Cluster or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicefabric.models.Cluster] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-06-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Cluster"] lro_delay = kwargs.pop( @@ -333,27 +337,22 @@ async def begin_update( resource_group_name=resource_group_name, cluster_name=cluster_name, parameters=parameters, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Cluster', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -363,11 +362,12 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}"} # type: ignore - async def delete( + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cluster_name: str, @@ -391,40 +391,39 @@ async def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2021-06-01") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}"} # type: ignore + + @distributed_trace_async async def list_by_resource_group( self, resource_group_name: str, @@ -447,32 +446,29 @@ async def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2021-06-01") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ClusterListResult', pipeline_response) @@ -481,8 +477,11 @@ async def list_by_resource_group( return cls(pipeline_response, deserialized, {}) return deserialized - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters"} # type: ignore + + + @distributed_trace_async async def list( self, **kwargs: Any @@ -502,31 +501,28 @@ async def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2021-06-01") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ClusterListResult', pipeline_response) @@ -535,8 +531,11 @@ async def list( return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/clusters'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/clusters"} # type: ignore + + + @distributed_trace_async async def list_upgradable_versions( self, resource_group_name: str, @@ -544,7 +543,8 @@ async def list_upgradable_versions( versions_description: Optional["_models.UpgradableVersionsDescription"] = None, **kwargs: Any ) -> "_models.UpgradableVersionPathResult": - """Operation to get the minimum and maximum upgradable version from the current cluster version, or the required path to get to the an specific target version. + """Operation to get the minimum and maximum upgradable version from the current cluster version, + or the required path to get to the an specific target version. If a target is not provided, it will get the minimum and maximum versions available from the current cluster version. If a target is given, it will provide the required path to get from @@ -554,7 +554,8 @@ async def list_upgradable_versions( :type resource_group_name: str :param cluster_name: The name of the cluster resource. :type cluster_name: str - :param versions_description: The upgrade path description with target version. + :param versions_description: The upgrade path description with target version. Default value is + None. :type versions_description: ~azure.mgmt.servicefabric.models.UpgradableVersionsDescription :keyword callable cls: A custom type or function that will be passed the direct response :return: UpgradableVersionPathResult, or the result of cls(response) @@ -566,41 +567,37 @@ async def list_upgradable_versions( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.list_upgradable_versions.metadata['url'] # type: ignore - 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'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2021-06-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if versions_description is not None: - body_content = self._serialize.body(versions_description, 'UpgradableVersionsDescription') + _json = self._serialize.body(versions_description, 'UpgradableVersionsDescription') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + _json = None + + request = build_list_upgradable_versions_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.list_upgradable_versions.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('UpgradableVersionPathResult', pipeline_response) @@ -609,4 +606,6 @@ async def list_upgradable_versions( return cls(pipeline_response, deserialized, {}) return deserialized - list_upgradable_versions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/listUpgradableVersions'} # type: ignore + + list_upgradable_versions.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/listUpgradableVersions"} # type: ignore + diff --git a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/aio/operations/_operations.py b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/aio/operations/_operations.py index 9a03647156cf..5c3c51ce0729 100644 --- a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/aio/operations/_operations.py +++ b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/aio/operations/_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,17 +6,19 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,6 +44,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, **kwargs: Any @@ -51,38 +55,40 @@ def list( :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either OperationListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicefabric.models.OperationListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicefabric.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('OperationListResult', pipeline_response) + deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -91,17 +97,22 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/providers/Microsoft.ServiceFabric/operations'} # type: ignore + list.metadata = {'url': "/providers/Microsoft.ServiceFabric/operations"} # type: ignore diff --git a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/aio/operations/_services_operations.py b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/aio/operations/_services_operations.py index 34709800f371..1d3aeefdaaf3 100644 --- a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/aio/operations/_services_operations.py +++ b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/aio/operations/_services_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,18 +6,20 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar, Union from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._services_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -42,6 +45,7 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace_async async def get( self, resource_group_name: str, @@ -74,35 +78,32 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'applicationName': self._serialize.url("application_name", application_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2021-06-01") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_name=application_name, + service_name=service_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ServiceResource', pipeline_response) @@ -111,7 +112,9 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}/services/{serviceName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}/services/{serviceName}"} # type: ignore + async def _create_or_update_initial( self, @@ -127,41 +130,36 @@ async def _create_or_update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - 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'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'applicationName': self._serialize.url("application_name", application_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ServiceResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-06-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ServiceResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_name=application_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = self._deserialize('ServiceResource', pipeline_response) @@ -169,8 +167,11 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}/services/{serviceName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}/services/{serviceName}"} # type: ignore + + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -197,14 +198,19 @@ async def begin_create_or_update( :type parameters: ~azure.mgmt.servicefabric.models.ServiceResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicefabric.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-06-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] lro_delay = kwargs.pop( @@ -219,29 +225,22 @@ async def begin_create_or_update( application_name=application_name, service_name=service_name, parameters=parameters, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ServiceResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - 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'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'applicationName': self._serialize.url("application_name", application_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -251,9 +250,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}/services/{serviceName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}/services/{serviceName}"} # type: ignore async def _update_initial( self, @@ -269,41 +268,36 @@ async def _update_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - 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'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'applicationName': self._serialize.url("application_name", application_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ServiceResourceUpdate') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-06-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ServiceResourceUpdate') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_name=application_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = self._deserialize('ServiceResource', pipeline_response) @@ -311,8 +305,11 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}/services/{serviceName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}/services/{serviceName}"} # type: ignore + + + @distributed_trace_async async def begin_update( self, resource_group_name: str, @@ -339,14 +336,19 @@ async def begin_update( :type parameters: ~azure.mgmt.servicefabric.models.ServiceResourceUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicefabric.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-06-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] lro_delay = kwargs.pop( @@ -361,29 +363,22 @@ async def begin_update( application_name=application_name, service_name=service_name, parameters=parameters, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ServiceResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - 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'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'applicationName': self._serialize.url("application_name", application_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -393,11 +388,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}/services/{serviceName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}/services/{serviceName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cluster_name: str, @@ -410,43 +405,41 @@ async def _delete_initial( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - 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'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'applicationName': self._serialize.url("application_name", application_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2021-06-01") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_name=application_name, + service_name=service_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}/services/{serviceName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}/services/{serviceName}"} # type: ignore + - async def begin_delete( + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cluster_name: str, @@ -469,14 +462,17 @@ async def begin_delete( :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-06-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -490,26 +486,18 @@ async def begin_delete( cluster_name=cluster_name, application_name=application_name, service_name=service_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - 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'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'applicationName': self._serialize.url("application_name", application_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -519,10 +507,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}/services/{serviceName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}/services/{serviceName}"} # type: ignore + + @distributed_trace_async async def list( self, resource_group_name: str, @@ -530,7 +519,8 @@ async def list( application_name: str, **kwargs: Any ) -> "_models.ServiceResourceList": - """Gets the list of service resources created in the specified Service Fabric application resource. + """Gets the list of service resources created in the specified Service Fabric application + resource. Gets all service resources created or in the process of being created in the Service Fabric application resource. @@ -551,34 +541,31 @@ async def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.list.metadata['url'] # type: ignore - 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'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'applicationName': self._serialize.url("application_name", application_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2021-06-01") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_name=application_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ServiceResourceList', pipeline_response) @@ -587,4 +574,6 @@ async def list( return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}/services'} # type: ignore + + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}/services"} # type: ignore + diff --git a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/models/__init__.py b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/models/__init__.py index 8491cd577bf6..25b33e91a257 100644 --- a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/models/__init__.py +++ b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/models/__init__.py @@ -6,150 +6,78 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import ApplicationDeltaHealthPolicy - from ._models_py3 import ApplicationHealthPolicy - from ._models_py3 import ApplicationMetricDescription - from ._models_py3 import ApplicationResource - from ._models_py3 import ApplicationResourceList - from ._models_py3 import ApplicationResourceProperties - from ._models_py3 import ApplicationResourceUpdate - from ._models_py3 import ApplicationResourceUpdateProperties - from ._models_py3 import ApplicationTypeResource - from ._models_py3 import ApplicationTypeResourceList - from ._models_py3 import ApplicationTypeVersionResource - from ._models_py3 import ApplicationTypeVersionResourceList - from ._models_py3 import ApplicationTypeVersionsCleanupPolicy - from ._models_py3 import ApplicationUpgradePolicy - from ._models_py3 import ApplicationUserAssignedIdentity - from ._models_py3 import ArmApplicationHealthPolicy - from ._models_py3 import ArmRollingUpgradeMonitoringPolicy - from ._models_py3 import ArmServiceTypeHealthPolicy - from ._models_py3 import AvailableOperationDisplay - from ._models_py3 import AzureActiveDirectory - from ._models_py3 import CertificateDescription - from ._models_py3 import ClientCertificateCommonName - from ._models_py3 import ClientCertificateThumbprint - from ._models_py3 import Cluster - from ._models_py3 import ClusterCodeVersionsListResult - from ._models_py3 import ClusterCodeVersionsResult - from ._models_py3 import ClusterHealthPolicy - from ._models_py3 import ClusterListResult - from ._models_py3 import ClusterUpdateParameters - from ._models_py3 import ClusterUpgradeDeltaHealthPolicy - from ._models_py3 import ClusterUpgradePolicy - from ._models_py3 import ClusterVersionDetails - from ._models_py3 import DiagnosticsStorageAccountConfig - from ._models_py3 import EndpointRangeDescription - from ._models_py3 import ErrorModel - from ._models_py3 import ErrorModelError - from ._models_py3 import ManagedIdentity - from ._models_py3 import NamedPartitionSchemeDescription - from ._models_py3 import NodeTypeDescription - from ._models_py3 import Notification - from ._models_py3 import NotificationTarget - from ._models_py3 import OperationListResult - from ._models_py3 import OperationResult - from ._models_py3 import PartitionSchemeDescription - from ._models_py3 import ProxyResource - from ._models_py3 import Resource - from ._models_py3 import ServerCertificateCommonName - from ._models_py3 import ServerCertificateCommonNames - from ._models_py3 import ServiceCorrelationDescription - from ._models_py3 import ServiceLoadMetricDescription - from ._models_py3 import ServicePlacementPolicyDescription - from ._models_py3 import ServiceResource - from ._models_py3 import ServiceResourceList - from ._models_py3 import ServiceResourceProperties - from ._models_py3 import ServiceResourcePropertiesBase - from ._models_py3 import ServiceResourceUpdate - from ._models_py3 import ServiceResourceUpdateProperties - from ._models_py3 import ServiceTypeDeltaHealthPolicy - from ._models_py3 import ServiceTypeHealthPolicy - from ._models_py3 import SettingsParameterDescription - from ._models_py3 import SettingsSectionDescription - from ._models_py3 import SingletonPartitionSchemeDescription - from ._models_py3 import StatefulServiceProperties - from ._models_py3 import StatefulServiceUpdateProperties - from ._models_py3 import StatelessServiceProperties - from ._models_py3 import StatelessServiceUpdateProperties - from ._models_py3 import SystemData - from ._models_py3 import UniformInt64RangePartitionSchemeDescription - from ._models_py3 import UpgradableVersionPathResult - from ._models_py3 import UpgradableVersionsDescription - from ._models_py3 import UserAssignedIdentity -except (SyntaxError, ImportError): - from ._models import ApplicationDeltaHealthPolicy # type: ignore - from ._models import ApplicationHealthPolicy # type: ignore - from ._models import ApplicationMetricDescription # type: ignore - from ._models import ApplicationResource # type: ignore - from ._models import ApplicationResourceList # type: ignore - from ._models import ApplicationResourceProperties # type: ignore - from ._models import ApplicationResourceUpdate # type: ignore - from ._models import ApplicationResourceUpdateProperties # type: ignore - from ._models import ApplicationTypeResource # type: ignore - from ._models import ApplicationTypeResourceList # type: ignore - from ._models import ApplicationTypeVersionResource # type: ignore - from ._models import ApplicationTypeVersionResourceList # type: ignore - from ._models import ApplicationTypeVersionsCleanupPolicy # type: ignore - from ._models import ApplicationUpgradePolicy # type: ignore - from ._models import ApplicationUserAssignedIdentity # type: ignore - from ._models import ArmApplicationHealthPolicy # type: ignore - from ._models import ArmRollingUpgradeMonitoringPolicy # type: ignore - from ._models import ArmServiceTypeHealthPolicy # type: ignore - from ._models import AvailableOperationDisplay # type: ignore - from ._models import AzureActiveDirectory # type: ignore - from ._models import CertificateDescription # type: ignore - from ._models import ClientCertificateCommonName # type: ignore - from ._models import ClientCertificateThumbprint # type: ignore - from ._models import Cluster # type: ignore - from ._models import ClusterCodeVersionsListResult # type: ignore - from ._models import ClusterCodeVersionsResult # type: ignore - from ._models import ClusterHealthPolicy # type: ignore - from ._models import ClusterListResult # type: ignore - from ._models import ClusterUpdateParameters # type: ignore - from ._models import ClusterUpgradeDeltaHealthPolicy # type: ignore - from ._models import ClusterUpgradePolicy # type: ignore - from ._models import ClusterVersionDetails # type: ignore - from ._models import DiagnosticsStorageAccountConfig # type: ignore - from ._models import EndpointRangeDescription # type: ignore - from ._models import ErrorModel # type: ignore - from ._models import ErrorModelError # type: ignore - from ._models import ManagedIdentity # type: ignore - from ._models import NamedPartitionSchemeDescription # type: ignore - from ._models import NodeTypeDescription # type: ignore - from ._models import Notification # type: ignore - from ._models import NotificationTarget # type: ignore - from ._models import OperationListResult # type: ignore - from ._models import OperationResult # type: ignore - from ._models import PartitionSchemeDescription # type: ignore - from ._models import ProxyResource # type: ignore - from ._models import Resource # type: ignore - from ._models import ServerCertificateCommonName # type: ignore - from ._models import ServerCertificateCommonNames # type: ignore - from ._models import ServiceCorrelationDescription # type: ignore - from ._models import ServiceLoadMetricDescription # type: ignore - from ._models import ServicePlacementPolicyDescription # type: ignore - from ._models import ServiceResource # type: ignore - from ._models import ServiceResourceList # type: ignore - from ._models import ServiceResourceProperties # type: ignore - from ._models import ServiceResourcePropertiesBase # type: ignore - from ._models import ServiceResourceUpdate # type: ignore - from ._models import ServiceResourceUpdateProperties # type: ignore - from ._models import ServiceTypeDeltaHealthPolicy # type: ignore - from ._models import ServiceTypeHealthPolicy # type: ignore - from ._models import SettingsParameterDescription # type: ignore - from ._models import SettingsSectionDescription # type: ignore - from ._models import SingletonPartitionSchemeDescription # type: ignore - from ._models import StatefulServiceProperties # type: ignore - from ._models import StatefulServiceUpdateProperties # type: ignore - from ._models import StatelessServiceProperties # type: ignore - from ._models import StatelessServiceUpdateProperties # type: ignore - from ._models import SystemData # type: ignore - from ._models import UniformInt64RangePartitionSchemeDescription # type: ignore - from ._models import UpgradableVersionPathResult # type: ignore - from ._models import UpgradableVersionsDescription # type: ignore - from ._models import UserAssignedIdentity # type: ignore +from ._models_py3 import ApplicationDeltaHealthPolicy +from ._models_py3 import ApplicationHealthPolicy +from ._models_py3 import ApplicationMetricDescription +from ._models_py3 import ApplicationResource +from ._models_py3 import ApplicationResourceList +from ._models_py3 import ApplicationResourceProperties +from ._models_py3 import ApplicationResourceUpdate +from ._models_py3 import ApplicationResourceUpdateProperties +from ._models_py3 import ApplicationTypeResource +from ._models_py3 import ApplicationTypeResourceList +from ._models_py3 import ApplicationTypeVersionResource +from ._models_py3 import ApplicationTypeVersionResourceList +from ._models_py3 import ApplicationTypeVersionsCleanupPolicy +from ._models_py3 import ApplicationUpgradePolicy +from ._models_py3 import ApplicationUserAssignedIdentity +from ._models_py3 import ArmApplicationHealthPolicy +from ._models_py3 import ArmRollingUpgradeMonitoringPolicy +from ._models_py3 import ArmServiceTypeHealthPolicy +from ._models_py3 import AvailableOperationDisplay +from ._models_py3 import AzureActiveDirectory +from ._models_py3 import CertificateDescription +from ._models_py3 import ClientCertificateCommonName +from ._models_py3 import ClientCertificateThumbprint +from ._models_py3 import Cluster +from ._models_py3 import ClusterCodeVersionsListResult +from ._models_py3 import ClusterCodeVersionsResult +from ._models_py3 import ClusterHealthPolicy +from ._models_py3 import ClusterListResult +from ._models_py3 import ClusterUpdateParameters +from ._models_py3 import ClusterUpgradeDeltaHealthPolicy +from ._models_py3 import ClusterUpgradePolicy +from ._models_py3 import ClusterVersionDetails +from ._models_py3 import DiagnosticsStorageAccountConfig +from ._models_py3 import EndpointRangeDescription +from ._models_py3 import ErrorModel +from ._models_py3 import ErrorModelError +from ._models_py3 import ManagedIdentity +from ._models_py3 import NamedPartitionSchemeDescription +from ._models_py3 import NodeTypeDescription +from ._models_py3 import Notification +from ._models_py3 import NotificationTarget +from ._models_py3 import OperationListResult +from ._models_py3 import OperationResult +from ._models_py3 import PartitionSchemeDescription +from ._models_py3 import ProxyResource +from ._models_py3 import Resource +from ._models_py3 import ServerCertificateCommonName +from ._models_py3 import ServerCertificateCommonNames +from ._models_py3 import ServiceCorrelationDescription +from ._models_py3 import ServiceLoadMetricDescription +from ._models_py3 import ServicePlacementPolicyDescription +from ._models_py3 import ServiceResource +from ._models_py3 import ServiceResourceList +from ._models_py3 import ServiceResourceProperties +from ._models_py3 import ServiceResourcePropertiesBase +from ._models_py3 import ServiceResourceUpdate +from ._models_py3 import ServiceResourceUpdateProperties +from ._models_py3 import ServiceTypeDeltaHealthPolicy +from ._models_py3 import ServiceTypeHealthPolicy +from ._models_py3 import SettingsParameterDescription +from ._models_py3 import SettingsSectionDescription +from ._models_py3 import SingletonPartitionSchemeDescription +from ._models_py3 import StatefulServiceProperties +from ._models_py3 import StatefulServiceUpdateProperties +from ._models_py3 import StatelessServiceProperties +from ._models_py3 import StatelessServiceUpdateProperties +from ._models_py3 import SystemData +from ._models_py3 import UniformInt64RangePartitionSchemeDescription +from ._models_py3 import UpgradableVersionPathResult +from ._models_py3 import UpgradableVersionsDescription +from ._models_py3 import UserAssignedIdentity + from ._service_fabric_management_client_enums import ( AddOnFeatures, @@ -158,8 +86,8 @@ ClusterEnvironment, ClusterState, ClusterUpgradeCadence, + ClusterVersionsEnvironment, DurabilityLevel, - Enum14, ManagedIdentityType, MoveCost, NotificationCategory, @@ -257,8 +185,8 @@ 'ClusterEnvironment', 'ClusterState', 'ClusterUpgradeCadence', + 'ClusterVersionsEnvironment', 'DurabilityLevel', - 'Enum14', 'ManagedIdentityType', 'MoveCost', 'NotificationCategory', diff --git a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/models/_models.py b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/models/_models.py deleted file mode 100644 index 7c24715734c0..000000000000 --- a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/models/_models.py +++ /dev/null @@ -1,3507 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.core.exceptions import HttpResponseError -import msrest.serialization - - -class ApplicationDeltaHealthPolicy(msrest.serialization.Model): - """Defines a delta health policy used to evaluate the health of an application or one of its child entities when upgrading the cluster. - - :param default_service_type_delta_health_policy: The delta health policy used by default to - evaluate the health of a service type when upgrading the cluster. - :type default_service_type_delta_health_policy: - ~azure.mgmt.servicefabric.models.ServiceTypeDeltaHealthPolicy - :param service_type_delta_health_policies: The map with service type delta health policy per - service type name. The map is empty by default. - :type service_type_delta_health_policies: dict[str, - ~azure.mgmt.servicefabric.models.ServiceTypeDeltaHealthPolicy] - """ - - _attribute_map = { - 'default_service_type_delta_health_policy': {'key': 'defaultServiceTypeDeltaHealthPolicy', 'type': 'ServiceTypeDeltaHealthPolicy'}, - 'service_type_delta_health_policies': {'key': 'serviceTypeDeltaHealthPolicies', 'type': '{ServiceTypeDeltaHealthPolicy}'}, - } - - def __init__( - self, - **kwargs - ): - super(ApplicationDeltaHealthPolicy, self).__init__(**kwargs) - self.default_service_type_delta_health_policy = kwargs.get('default_service_type_delta_health_policy', None) - self.service_type_delta_health_policies = kwargs.get('service_type_delta_health_policies', None) - - -class ApplicationHealthPolicy(msrest.serialization.Model): - """Defines a health policy used to evaluate the health of an application or one of its children entities. - - :param default_service_type_health_policy: The health policy used by default to evaluate the - health of a service type. - :type default_service_type_health_policy: - ~azure.mgmt.servicefabric.models.ServiceTypeHealthPolicy - :param service_type_health_policies: The map with service type health policy per service type - name. The map is empty by default. - :type service_type_health_policies: dict[str, - ~azure.mgmt.servicefabric.models.ServiceTypeHealthPolicy] - """ - - _attribute_map = { - 'default_service_type_health_policy': {'key': 'defaultServiceTypeHealthPolicy', 'type': 'ServiceTypeHealthPolicy'}, - 'service_type_health_policies': {'key': 'serviceTypeHealthPolicies', 'type': '{ServiceTypeHealthPolicy}'}, - } - - def __init__( - self, - **kwargs - ): - super(ApplicationHealthPolicy, self).__init__(**kwargs) - self.default_service_type_health_policy = kwargs.get('default_service_type_health_policy', None) - self.service_type_health_policies = kwargs.get('service_type_health_policies', None) - - -class ApplicationMetricDescription(msrest.serialization.Model): - """Describes capacity information for a custom resource balancing metric. This can be used to limit the total consumption of this metric by the services of this application. - - :param name: The name of the metric. - :type name: str - :param maximum_capacity: The maximum node capacity for Service Fabric application. - This is the maximum Load for an instance of this application on a single node. Even if the - capacity of node is greater than this value, Service Fabric will limit the total load of - services within the application on each node to this value. - If set to zero, capacity for this metric is unlimited on each node. - When creating a new application with application capacity defined, the product of MaximumNodes - and this value must always be smaller than or equal to TotalApplicationCapacity. - When updating existing application with application capacity, the product of MaximumNodes and - this value must always be smaller than or equal to TotalApplicationCapacity. - :type maximum_capacity: long - :param reservation_capacity: The node reservation capacity for Service Fabric application. - This is the amount of load which is reserved on nodes which have instances of this - application. - If MinimumNodes is specified, then the product of these values will be the capacity reserved - in the cluster for the application. - If set to zero, no capacity is reserved for this metric. - When setting application capacity or when updating application capacity; this value must be - smaller than or equal to MaximumCapacity for each metric. - :type reservation_capacity: long - :param total_application_capacity: The total metric capacity for Service Fabric application. - This is the total metric capacity for this application in the cluster. Service Fabric will try - to limit the sum of loads of services within the application to this value. - When creating a new application with application capacity defined, the product of MaximumNodes - and MaximumCapacity must always be smaller than or equal to this value. - :type total_application_capacity: long - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'maximum_capacity': {'key': 'maximumCapacity', 'type': 'long'}, - 'reservation_capacity': {'key': 'reservationCapacity', 'type': 'long'}, - 'total_application_capacity': {'key': 'totalApplicationCapacity', 'type': 'long'}, - } - - def __init__( - self, - **kwargs - ): - super(ApplicationMetricDescription, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.maximum_capacity = kwargs.get('maximum_capacity', None) - self.reservation_capacity = kwargs.get('reservation_capacity', None) - self.total_application_capacity = kwargs.get('total_application_capacity', None) - - -class ProxyResource(msrest.serialization.Model): - """The resource model definition for proxy-only resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Azure resource identifier. - :vartype id: str - :ivar name: Azure resource name. - :vartype name: str - :ivar type: Azure resource type. - :vartype type: str - :param location: It will be deprecated in New API, resource location depends on the parent - resource. - :type location: str - :param tags: A set of tags. Azure resource tags. - :type tags: dict[str, str] - :ivar etag: Azure resource etag. - :vartype etag: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.servicefabric.models.SystemData - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'etag': {'readonly': True}, - 'system_data': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - } - - def __init__( - self, - **kwargs - ): - super(ProxyResource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.location = kwargs.get('location', None) - self.tags = kwargs.get('tags', None) - self.etag = None - self.system_data = None - - -class ApplicationResource(ProxyResource): - """The application resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Azure resource identifier. - :vartype id: str - :ivar name: Azure resource name. - :vartype name: str - :ivar type: Azure resource type. - :vartype type: str - :param location: It will be deprecated in New API, resource location depends on the parent - resource. - :type location: str - :param tags: A set of tags. Azure resource tags. - :type tags: dict[str, str] - :ivar etag: Azure resource etag. - :vartype etag: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.servicefabric.models.SystemData - :param identity: Describes the managed identities for an Azure resource. - :type identity: ~azure.mgmt.servicefabric.models.ManagedIdentity - :param type_version: The version of the application type as defined in the application - manifest. - :type type_version: str - :param parameters: List of application parameters with overridden values from their default - values specified in the application manifest. - :type parameters: dict[str, str] - :param upgrade_policy: Describes the policy for a monitored application upgrade. - :type upgrade_policy: ~azure.mgmt.servicefabric.models.ApplicationUpgradePolicy - :param minimum_nodes: The minimum number of nodes where Service Fabric will reserve capacity - for this application. Note that this does not mean that the services of this application will - be placed on all of those nodes. If this property is set to zero, no capacity will be reserved. - The value of this property cannot be more than the value of the MaximumNodes property. - :type minimum_nodes: long - :param maximum_nodes: The maximum number of nodes where Service Fabric will reserve capacity - for this application. Note that this does not mean that the services of this application will - be placed on all of those nodes. By default, the value of this property is zero and it means - that the services can be placed on any node. - :type maximum_nodes: long - :param remove_application_capacity: Remove the current application capacity settings. - :type remove_application_capacity: bool - :param metrics: List of application capacity metric description. - :type metrics: list[~azure.mgmt.servicefabric.models.ApplicationMetricDescription] - :param managed_identities: List of user assigned identities for the application, each mapped to - a friendly name. - :type managed_identities: - list[~azure.mgmt.servicefabric.models.ApplicationUserAssignedIdentity] - :ivar provisioning_state: The current deployment or provisioning state, which only appears in - the response. - :vartype provisioning_state: str - :param type_name: The application type name as defined in the application manifest. - :type type_name: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'etag': {'readonly': True}, - 'system_data': {'readonly': True}, - 'minimum_nodes': {'minimum': 0}, - 'maximum_nodes': {'minimum': 0}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'identity': {'key': 'identity', 'type': 'ManagedIdentity'}, - 'type_version': {'key': 'properties.typeVersion', 'type': 'str'}, - 'parameters': {'key': 'properties.parameters', 'type': '{str}'}, - 'upgrade_policy': {'key': 'properties.upgradePolicy', 'type': 'ApplicationUpgradePolicy'}, - 'minimum_nodes': {'key': 'properties.minimumNodes', 'type': 'long'}, - 'maximum_nodes': {'key': 'properties.maximumNodes', 'type': 'long'}, - 'remove_application_capacity': {'key': 'properties.removeApplicationCapacity', 'type': 'bool'}, - 'metrics': {'key': 'properties.metrics', 'type': '[ApplicationMetricDescription]'}, - 'managed_identities': {'key': 'properties.managedIdentities', 'type': '[ApplicationUserAssignedIdentity]'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'type_name': {'key': 'properties.typeName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ApplicationResource, self).__init__(**kwargs) - self.identity = kwargs.get('identity', None) - self.type_version = kwargs.get('type_version', None) - self.parameters = kwargs.get('parameters', None) - self.upgrade_policy = kwargs.get('upgrade_policy', None) - self.minimum_nodes = kwargs.get('minimum_nodes', None) - self.maximum_nodes = kwargs.get('maximum_nodes', 0) - self.remove_application_capacity = kwargs.get('remove_application_capacity', None) - self.metrics = kwargs.get('metrics', None) - self.managed_identities = kwargs.get('managed_identities', None) - self.provisioning_state = None - self.type_name = kwargs.get('type_name', None) - - -class ApplicationResourceList(msrest.serialization.Model): - """The list of application resources. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param value: - :type value: list[~azure.mgmt.servicefabric.models.ApplicationResource] - :ivar next_link: URL to get the next set of application list results if there are any. - :vartype next_link: str - """ - - _validation = { - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ApplicationResource]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ApplicationResourceList, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = None - - -class ApplicationResourceUpdateProperties(msrest.serialization.Model): - """The application resource properties for patch operations. - - :param type_version: The version of the application type as defined in the application - manifest. - :type type_version: str - :param parameters: List of application parameters with overridden values from their default - values specified in the application manifest. - :type parameters: dict[str, str] - :param upgrade_policy: Describes the policy for a monitored application upgrade. - :type upgrade_policy: ~azure.mgmt.servicefabric.models.ApplicationUpgradePolicy - :param minimum_nodes: The minimum number of nodes where Service Fabric will reserve capacity - for this application. Note that this does not mean that the services of this application will - be placed on all of those nodes. If this property is set to zero, no capacity will be reserved. - The value of this property cannot be more than the value of the MaximumNodes property. - :type minimum_nodes: long - :param maximum_nodes: The maximum number of nodes where Service Fabric will reserve capacity - for this application. Note that this does not mean that the services of this application will - be placed on all of those nodes. By default, the value of this property is zero and it means - that the services can be placed on any node. - :type maximum_nodes: long - :param remove_application_capacity: Remove the current application capacity settings. - :type remove_application_capacity: bool - :param metrics: List of application capacity metric description. - :type metrics: list[~azure.mgmt.servicefabric.models.ApplicationMetricDescription] - :param managed_identities: List of user assigned identities for the application, each mapped to - a friendly name. - :type managed_identities: - list[~azure.mgmt.servicefabric.models.ApplicationUserAssignedIdentity] - """ - - _validation = { - 'minimum_nodes': {'minimum': 0}, - 'maximum_nodes': {'minimum': 0}, - } - - _attribute_map = { - 'type_version': {'key': 'typeVersion', 'type': 'str'}, - 'parameters': {'key': 'parameters', 'type': '{str}'}, - 'upgrade_policy': {'key': 'upgradePolicy', 'type': 'ApplicationUpgradePolicy'}, - 'minimum_nodes': {'key': 'minimumNodes', 'type': 'long'}, - 'maximum_nodes': {'key': 'maximumNodes', 'type': 'long'}, - 'remove_application_capacity': {'key': 'removeApplicationCapacity', 'type': 'bool'}, - 'metrics': {'key': 'metrics', 'type': '[ApplicationMetricDescription]'}, - 'managed_identities': {'key': 'managedIdentities', 'type': '[ApplicationUserAssignedIdentity]'}, - } - - def __init__( - self, - **kwargs - ): - super(ApplicationResourceUpdateProperties, self).__init__(**kwargs) - self.type_version = kwargs.get('type_version', None) - self.parameters = kwargs.get('parameters', None) - self.upgrade_policy = kwargs.get('upgrade_policy', None) - self.minimum_nodes = kwargs.get('minimum_nodes', None) - self.maximum_nodes = kwargs.get('maximum_nodes', 0) - self.remove_application_capacity = kwargs.get('remove_application_capacity', None) - self.metrics = kwargs.get('metrics', None) - self.managed_identities = kwargs.get('managed_identities', None) - - -class ApplicationResourceProperties(ApplicationResourceUpdateProperties): - """The application resource properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param type_version: The version of the application type as defined in the application - manifest. - :type type_version: str - :param parameters: List of application parameters with overridden values from their default - values specified in the application manifest. - :type parameters: dict[str, str] - :param upgrade_policy: Describes the policy for a monitored application upgrade. - :type upgrade_policy: ~azure.mgmt.servicefabric.models.ApplicationUpgradePolicy - :param minimum_nodes: The minimum number of nodes where Service Fabric will reserve capacity - for this application. Note that this does not mean that the services of this application will - be placed on all of those nodes. If this property is set to zero, no capacity will be reserved. - The value of this property cannot be more than the value of the MaximumNodes property. - :type minimum_nodes: long - :param maximum_nodes: The maximum number of nodes where Service Fabric will reserve capacity - for this application. Note that this does not mean that the services of this application will - be placed on all of those nodes. By default, the value of this property is zero and it means - that the services can be placed on any node. - :type maximum_nodes: long - :param remove_application_capacity: Remove the current application capacity settings. - :type remove_application_capacity: bool - :param metrics: List of application capacity metric description. - :type metrics: list[~azure.mgmt.servicefabric.models.ApplicationMetricDescription] - :param managed_identities: List of user assigned identities for the application, each mapped to - a friendly name. - :type managed_identities: - list[~azure.mgmt.servicefabric.models.ApplicationUserAssignedIdentity] - :ivar provisioning_state: The current deployment or provisioning state, which only appears in - the response. - :vartype provisioning_state: str - :param type_name: The application type name as defined in the application manifest. - :type type_name: str - """ - - _validation = { - 'minimum_nodes': {'minimum': 0}, - 'maximum_nodes': {'minimum': 0}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'type_version': {'key': 'typeVersion', 'type': 'str'}, - 'parameters': {'key': 'parameters', 'type': '{str}'}, - 'upgrade_policy': {'key': 'upgradePolicy', 'type': 'ApplicationUpgradePolicy'}, - 'minimum_nodes': {'key': 'minimumNodes', 'type': 'long'}, - 'maximum_nodes': {'key': 'maximumNodes', 'type': 'long'}, - 'remove_application_capacity': {'key': 'removeApplicationCapacity', 'type': 'bool'}, - 'metrics': {'key': 'metrics', 'type': '[ApplicationMetricDescription]'}, - 'managed_identities': {'key': 'managedIdentities', 'type': '[ApplicationUserAssignedIdentity]'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'type_name': {'key': 'typeName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ApplicationResourceProperties, self).__init__(**kwargs) - self.provisioning_state = None - self.type_name = kwargs.get('type_name', None) - - -class ApplicationResourceUpdate(ProxyResource): - """The application resource for patch operations. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Azure resource identifier. - :vartype id: str - :ivar name: Azure resource name. - :vartype name: str - :ivar type: Azure resource type. - :vartype type: str - :param location: It will be deprecated in New API, resource location depends on the parent - resource. - :type location: str - :param tags: A set of tags. Azure resource tags. - :type tags: dict[str, str] - :ivar etag: Azure resource etag. - :vartype etag: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.servicefabric.models.SystemData - :param type_version: The version of the application type as defined in the application - manifest. - :type type_version: str - :param parameters: List of application parameters with overridden values from their default - values specified in the application manifest. - :type parameters: dict[str, str] - :param upgrade_policy: Describes the policy for a monitored application upgrade. - :type upgrade_policy: ~azure.mgmt.servicefabric.models.ApplicationUpgradePolicy - :param minimum_nodes: The minimum number of nodes where Service Fabric will reserve capacity - for this application. Note that this does not mean that the services of this application will - be placed on all of those nodes. If this property is set to zero, no capacity will be reserved. - The value of this property cannot be more than the value of the MaximumNodes property. - :type minimum_nodes: long - :param maximum_nodes: The maximum number of nodes where Service Fabric will reserve capacity - for this application. Note that this does not mean that the services of this application will - be placed on all of those nodes. By default, the value of this property is zero and it means - that the services can be placed on any node. - :type maximum_nodes: long - :param remove_application_capacity: Remove the current application capacity settings. - :type remove_application_capacity: bool - :param metrics: List of application capacity metric description. - :type metrics: list[~azure.mgmt.servicefabric.models.ApplicationMetricDescription] - :param managed_identities: List of user assigned identities for the application, each mapped to - a friendly name. - :type managed_identities: - list[~azure.mgmt.servicefabric.models.ApplicationUserAssignedIdentity] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'etag': {'readonly': True}, - 'system_data': {'readonly': True}, - 'minimum_nodes': {'minimum': 0}, - 'maximum_nodes': {'minimum': 0}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'type_version': {'key': 'properties.typeVersion', 'type': 'str'}, - 'parameters': {'key': 'properties.parameters', 'type': '{str}'}, - 'upgrade_policy': {'key': 'properties.upgradePolicy', 'type': 'ApplicationUpgradePolicy'}, - 'minimum_nodes': {'key': 'properties.minimumNodes', 'type': 'long'}, - 'maximum_nodes': {'key': 'properties.maximumNodes', 'type': 'long'}, - 'remove_application_capacity': {'key': 'properties.removeApplicationCapacity', 'type': 'bool'}, - 'metrics': {'key': 'properties.metrics', 'type': '[ApplicationMetricDescription]'}, - 'managed_identities': {'key': 'properties.managedIdentities', 'type': '[ApplicationUserAssignedIdentity]'}, - } - - def __init__( - self, - **kwargs - ): - super(ApplicationResourceUpdate, self).__init__(**kwargs) - self.type_version = kwargs.get('type_version', None) - self.parameters = kwargs.get('parameters', None) - self.upgrade_policy = kwargs.get('upgrade_policy', None) - self.minimum_nodes = kwargs.get('minimum_nodes', None) - self.maximum_nodes = kwargs.get('maximum_nodes', 0) - self.remove_application_capacity = kwargs.get('remove_application_capacity', None) - self.metrics = kwargs.get('metrics', None) - self.managed_identities = kwargs.get('managed_identities', None) - - -class ApplicationTypeResource(ProxyResource): - """The application type name resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Azure resource identifier. - :vartype id: str - :ivar name: Azure resource name. - :vartype name: str - :ivar type: Azure resource type. - :vartype type: str - :param location: It will be deprecated in New API, resource location depends on the parent - resource. - :type location: str - :param tags: A set of tags. Azure resource tags. - :type tags: dict[str, str] - :ivar etag: Azure resource etag. - :vartype etag: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.servicefabric.models.SystemData - :ivar provisioning_state: The current deployment or provisioning state, which only appears in - the response. - :vartype provisioning_state: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'etag': {'readonly': True}, - 'system_data': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ApplicationTypeResource, self).__init__(**kwargs) - self.provisioning_state = None - - -class ApplicationTypeResourceList(msrest.serialization.Model): - """The list of application type names. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param value: - :type value: list[~azure.mgmt.servicefabric.models.ApplicationTypeResource] - :ivar next_link: URL to get the next set of application type list results if there are any. - :vartype next_link: str - """ - - _validation = { - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ApplicationTypeResource]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ApplicationTypeResourceList, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = None - - -class ApplicationTypeVersionResource(ProxyResource): - """An application type version resource for the specified application type name resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Azure resource identifier. - :vartype id: str - :ivar name: Azure resource name. - :vartype name: str - :ivar type: Azure resource type. - :vartype type: str - :param location: It will be deprecated in New API, resource location depends on the parent - resource. - :type location: str - :param tags: A set of tags. Azure resource tags. - :type tags: dict[str, str] - :ivar etag: Azure resource etag. - :vartype etag: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.servicefabric.models.SystemData - :ivar provisioning_state: The current deployment or provisioning state, which only appears in - the response. - :vartype provisioning_state: str - :param app_package_url: The URL to the application package. - :type app_package_url: str - :ivar default_parameter_list: List of application type parameters that can be overridden when - creating or updating the application. - :vartype default_parameter_list: dict[str, str] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'etag': {'readonly': True}, - 'system_data': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'default_parameter_list': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'app_package_url': {'key': 'properties.appPackageUrl', 'type': 'str'}, - 'default_parameter_list': {'key': 'properties.defaultParameterList', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(ApplicationTypeVersionResource, self).__init__(**kwargs) - self.provisioning_state = None - self.app_package_url = kwargs.get('app_package_url', None) - self.default_parameter_list = None - - -class ApplicationTypeVersionResourceList(msrest.serialization.Model): - """The list of application type version resources for the specified application type name resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param value: - :type value: list[~azure.mgmt.servicefabric.models.ApplicationTypeVersionResource] - :ivar next_link: URL to get the next set of application type version list results if there are - any. - :vartype next_link: str - """ - - _validation = { - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ApplicationTypeVersionResource]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ApplicationTypeVersionResourceList, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = None - - -class ApplicationTypeVersionsCleanupPolicy(msrest.serialization.Model): - """ApplicationTypeVersionsCleanupPolicy. - - All required parameters must be populated in order to send to Azure. - - :param max_unused_versions_to_keep: Required. Number of unused versions per application type to - keep. - :type max_unused_versions_to_keep: long - """ - - _validation = { - 'max_unused_versions_to_keep': {'required': True, 'minimum': 0}, - } - - _attribute_map = { - 'max_unused_versions_to_keep': {'key': 'maxUnusedVersionsToKeep', 'type': 'long'}, - } - - def __init__( - self, - **kwargs - ): - super(ApplicationTypeVersionsCleanupPolicy, self).__init__(**kwargs) - self.max_unused_versions_to_keep = kwargs['max_unused_versions_to_keep'] - - -class ApplicationUpgradePolicy(msrest.serialization.Model): - """Describes the policy for a monitored application upgrade. - - :param upgrade_replica_set_check_timeout: The maximum amount of time to block processing of an - upgrade domain and prevent loss of availability when there are unexpected issues. When this - timeout expires, processing of the upgrade domain will proceed regardless of availability loss - issues. The timeout is reset at the start of each upgrade domain. Valid values are between 0 - and 42949672925 inclusive. (unsigned 32-bit integer). - :type upgrade_replica_set_check_timeout: str - :param force_restart: If true, then processes are forcefully restarted during upgrade even when - the code version has not changed (the upgrade only changes configuration or data). - :type force_restart: bool - :param rolling_upgrade_monitoring_policy: The policy used for monitoring the application - upgrade. - :type rolling_upgrade_monitoring_policy: - ~azure.mgmt.servicefabric.models.ArmRollingUpgradeMonitoringPolicy - :param application_health_policy: Defines a health policy used to evaluate the health of an - application or one of its children entities. - :type application_health_policy: ~azure.mgmt.servicefabric.models.ArmApplicationHealthPolicy - :param upgrade_mode: The mode used to monitor health during a rolling upgrade. The values are - UnmonitoredAuto, UnmonitoredManual, and Monitored. Possible values include: "Invalid", - "UnmonitoredAuto", "UnmonitoredManual", "Monitored". Default value: "Monitored". - :type upgrade_mode: str or ~azure.mgmt.servicefabric.models.RollingUpgradeMode - :param recreate_application: Determines whether the application should be recreated on update. - If value=true, the rest of the upgrade policy parameters are not allowed and it will result in - availability loss. - :type recreate_application: bool - """ - - _attribute_map = { - 'upgrade_replica_set_check_timeout': {'key': 'upgradeReplicaSetCheckTimeout', 'type': 'str'}, - 'force_restart': {'key': 'forceRestart', 'type': 'bool'}, - 'rolling_upgrade_monitoring_policy': {'key': 'rollingUpgradeMonitoringPolicy', 'type': 'ArmRollingUpgradeMonitoringPolicy'}, - 'application_health_policy': {'key': 'applicationHealthPolicy', 'type': 'ArmApplicationHealthPolicy'}, - 'upgrade_mode': {'key': 'upgradeMode', 'type': 'str'}, - 'recreate_application': {'key': 'recreateApplication', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(ApplicationUpgradePolicy, self).__init__(**kwargs) - self.upgrade_replica_set_check_timeout = kwargs.get('upgrade_replica_set_check_timeout', None) - self.force_restart = kwargs.get('force_restart', False) - self.rolling_upgrade_monitoring_policy = kwargs.get('rolling_upgrade_monitoring_policy', None) - self.application_health_policy = kwargs.get('application_health_policy', None) - self.upgrade_mode = kwargs.get('upgrade_mode', "Monitored") - self.recreate_application = kwargs.get('recreate_application', None) - - -class ApplicationUserAssignedIdentity(msrest.serialization.Model): - """ApplicationUserAssignedIdentity. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The friendly name of user assigned identity. - :type name: str - :param principal_id: Required. The principal id of user assigned identity. - :type principal_id: str - """ - - _validation = { - 'name': {'required': True}, - 'principal_id': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'principal_id': {'key': 'principalId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ApplicationUserAssignedIdentity, self).__init__(**kwargs) - self.name = kwargs['name'] - self.principal_id = kwargs['principal_id'] - - -class ArmApplicationHealthPolicy(msrest.serialization.Model): - """Defines a health policy used to evaluate the health of an application or one of its children entities. - - :param consider_warning_as_error: Indicates whether warnings are treated with the same severity - as errors. - :type consider_warning_as_error: bool - :param max_percent_unhealthy_deployed_applications: The maximum allowed percentage of unhealthy - deployed applications. Allowed values are Byte values from zero to 100. - The percentage represents the maximum tolerated percentage of deployed applications that can - be unhealthy before the application is considered in error. - This is calculated by dividing the number of unhealthy deployed applications over the number - of nodes where the application is currently deployed on in the cluster. - The computation rounds up to tolerate one failure on small numbers of nodes. Default - percentage is zero. - :type max_percent_unhealthy_deployed_applications: int - :param default_service_type_health_policy: The health policy used by default to evaluate the - health of a service type. - :type default_service_type_health_policy: - ~azure.mgmt.servicefabric.models.ArmServiceTypeHealthPolicy - :param service_type_health_policy_map: The map with service type health policy per service type - name. The map is empty by default. - :type service_type_health_policy_map: dict[str, - ~azure.mgmt.servicefabric.models.ArmServiceTypeHealthPolicy] - """ - - _attribute_map = { - 'consider_warning_as_error': {'key': 'considerWarningAsError', 'type': 'bool'}, - 'max_percent_unhealthy_deployed_applications': {'key': 'maxPercentUnhealthyDeployedApplications', 'type': 'int'}, - 'default_service_type_health_policy': {'key': 'defaultServiceTypeHealthPolicy', 'type': 'ArmServiceTypeHealthPolicy'}, - 'service_type_health_policy_map': {'key': 'serviceTypeHealthPolicyMap', 'type': '{ArmServiceTypeHealthPolicy}'}, - } - - def __init__( - self, - **kwargs - ): - super(ArmApplicationHealthPolicy, self).__init__(**kwargs) - self.consider_warning_as_error = kwargs.get('consider_warning_as_error', False) - self.max_percent_unhealthy_deployed_applications = kwargs.get('max_percent_unhealthy_deployed_applications', 0) - self.default_service_type_health_policy = kwargs.get('default_service_type_health_policy', None) - self.service_type_health_policy_map = kwargs.get('service_type_health_policy_map', None) - - -class ArmRollingUpgradeMonitoringPolicy(msrest.serialization.Model): - """The policy used for monitoring the application upgrade. - - :param failure_action: The activation Mode of the service package. Possible values include: - "Rollback", "Manual". - :type failure_action: str or ~azure.mgmt.servicefabric.models.ArmUpgradeFailureAction - :param health_check_wait_duration: The amount of time to wait after completing an upgrade - domain before applying health policies. It is first interpreted as a string representing an ISO - 8601 duration. If that fails, then it is interpreted as a number representing the total number - of milliseconds. - :type health_check_wait_duration: str - :param health_check_stable_duration: The amount of time that the application or cluster must - remain healthy before the upgrade proceeds to the next upgrade domain. It is first interpreted - as a string representing an ISO 8601 duration. If that fails, then it is interpreted as a - number representing the total number of milliseconds. - :type health_check_stable_duration: str - :param health_check_retry_timeout: The amount of time to retry health evaluation when the - application or cluster is unhealthy before FailureAction is executed. It is first interpreted - as a string representing an ISO 8601 duration. If that fails, then it is interpreted as a - number representing the total number of milliseconds. - :type health_check_retry_timeout: str - :param upgrade_timeout: The amount of time the overall upgrade has to complete before - FailureAction is executed. It is first interpreted as a string representing an ISO 8601 - duration. If that fails, then it is interpreted as a number representing the total number of - milliseconds. - :type upgrade_timeout: str - :param upgrade_domain_timeout: The amount of time each upgrade domain has to complete before - FailureAction is executed. It is first interpreted as a string representing an ISO 8601 - duration. If that fails, then it is interpreted as a number representing the total number of - milliseconds. - :type upgrade_domain_timeout: str - """ - - _attribute_map = { - 'failure_action': {'key': 'failureAction', 'type': 'str'}, - 'health_check_wait_duration': {'key': 'healthCheckWaitDuration', 'type': 'str'}, - 'health_check_stable_duration': {'key': 'healthCheckStableDuration', 'type': 'str'}, - 'health_check_retry_timeout': {'key': 'healthCheckRetryTimeout', 'type': 'str'}, - 'upgrade_timeout': {'key': 'upgradeTimeout', 'type': 'str'}, - 'upgrade_domain_timeout': {'key': 'upgradeDomainTimeout', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ArmRollingUpgradeMonitoringPolicy, self).__init__(**kwargs) - self.failure_action = kwargs.get('failure_action', None) - self.health_check_wait_duration = kwargs.get('health_check_wait_duration', "0") - self.health_check_stable_duration = kwargs.get('health_check_stable_duration', "PT0H2M0S") - self.health_check_retry_timeout = kwargs.get('health_check_retry_timeout', "PT0H10M0S") - self.upgrade_timeout = kwargs.get('upgrade_timeout', "P10675199DT02H48M05.4775807S") - self.upgrade_domain_timeout = kwargs.get('upgrade_domain_timeout', "P10675199DT02H48M05.4775807S") - - -class ArmServiceTypeHealthPolicy(msrest.serialization.Model): - """Represents the health policy used to evaluate the health of services belonging to a service type. - - :param max_percent_unhealthy_services: The maximum percentage of services allowed to be - unhealthy before your application is considered in error. - :type max_percent_unhealthy_services: int - :param max_percent_unhealthy_partitions_per_service: The maximum percentage of partitions per - service allowed to be unhealthy before your application is considered in error. - :type max_percent_unhealthy_partitions_per_service: int - :param max_percent_unhealthy_replicas_per_partition: The maximum percentage of replicas per - partition allowed to be unhealthy before your application is considered in error. - :type max_percent_unhealthy_replicas_per_partition: int - """ - - _validation = { - 'max_percent_unhealthy_services': {'maximum': 100, 'minimum': 0}, - 'max_percent_unhealthy_partitions_per_service': {'maximum': 100, 'minimum': 0}, - 'max_percent_unhealthy_replicas_per_partition': {'maximum': 100, 'minimum': 0}, - } - - _attribute_map = { - 'max_percent_unhealthy_services': {'key': 'maxPercentUnhealthyServices', 'type': 'int'}, - 'max_percent_unhealthy_partitions_per_service': {'key': 'maxPercentUnhealthyPartitionsPerService', 'type': 'int'}, - 'max_percent_unhealthy_replicas_per_partition': {'key': 'maxPercentUnhealthyReplicasPerPartition', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(ArmServiceTypeHealthPolicy, self).__init__(**kwargs) - self.max_percent_unhealthy_services = kwargs.get('max_percent_unhealthy_services', 0) - self.max_percent_unhealthy_partitions_per_service = kwargs.get('max_percent_unhealthy_partitions_per_service', 0) - self.max_percent_unhealthy_replicas_per_partition = kwargs.get('max_percent_unhealthy_replicas_per_partition', 0) - - -class AvailableOperationDisplay(msrest.serialization.Model): - """Operation supported by the Service Fabric resource provider. - - :param provider: The name of the provider. - :type provider: str - :param resource: The resource on which the operation is performed. - :type resource: str - :param operation: The operation that can be performed. - :type operation: str - :param description: Operation description. - :type description: str - """ - - _attribute_map = { - 'provider': {'key': 'provider', 'type': 'str'}, - 'resource': {'key': 'resource', 'type': 'str'}, - 'operation': {'key': 'operation', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AvailableOperationDisplay, self).__init__(**kwargs) - self.provider = kwargs.get('provider', None) - self.resource = kwargs.get('resource', None) - self.operation = kwargs.get('operation', None) - self.description = kwargs.get('description', None) - - -class AzureActiveDirectory(msrest.serialization.Model): - """The settings to enable AAD authentication on the cluster. - - :param tenant_id: Azure active directory tenant id. - :type tenant_id: str - :param cluster_application: Azure active directory cluster application id. - :type cluster_application: str - :param client_application: Azure active directory client application id. - :type client_application: str - """ - - _attribute_map = { - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'cluster_application': {'key': 'clusterApplication', 'type': 'str'}, - 'client_application': {'key': 'clientApplication', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AzureActiveDirectory, self).__init__(**kwargs) - self.tenant_id = kwargs.get('tenant_id', None) - self.cluster_application = kwargs.get('cluster_application', None) - self.client_application = kwargs.get('client_application', None) - - -class CertificateDescription(msrest.serialization.Model): - """Describes the certificate details. - - All required parameters must be populated in order to send to Azure. - - :param thumbprint: Required. Thumbprint of the primary certificate. - :type thumbprint: str - :param thumbprint_secondary: Thumbprint of the secondary certificate. - :type thumbprint_secondary: str - :param x509_store_name: The local certificate store location. Possible values include: - "AddressBook", "AuthRoot", "CertificateAuthority", "Disallowed", "My", "Root", "TrustedPeople", - "TrustedPublisher". - :type x509_store_name: str or ~azure.mgmt.servicefabric.models.StoreName - """ - - _validation = { - 'thumbprint': {'required': True}, - } - - _attribute_map = { - 'thumbprint': {'key': 'thumbprint', 'type': 'str'}, - 'thumbprint_secondary': {'key': 'thumbprintSecondary', 'type': 'str'}, - 'x509_store_name': {'key': 'x509StoreName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CertificateDescription, self).__init__(**kwargs) - self.thumbprint = kwargs['thumbprint'] - self.thumbprint_secondary = kwargs.get('thumbprint_secondary', None) - self.x509_store_name = kwargs.get('x509_store_name', None) - - -class ClientCertificateCommonName(msrest.serialization.Model): - """Describes the client certificate details using common name. - - All required parameters must be populated in order to send to Azure. - - :param is_admin: Required. Indicates if the client certificate has admin access to the cluster. - Non admin clients can perform only read only operations on the cluster. - :type is_admin: bool - :param certificate_common_name: Required. The common name of the client certificate. - :type certificate_common_name: str - :param certificate_issuer_thumbprint: Required. The issuer thumbprint of the client - certificate. - :type certificate_issuer_thumbprint: str - """ - - _validation = { - 'is_admin': {'required': True}, - 'certificate_common_name': {'required': True}, - 'certificate_issuer_thumbprint': {'required': True}, - } - - _attribute_map = { - 'is_admin': {'key': 'isAdmin', 'type': 'bool'}, - 'certificate_common_name': {'key': 'certificateCommonName', 'type': 'str'}, - 'certificate_issuer_thumbprint': {'key': 'certificateIssuerThumbprint', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ClientCertificateCommonName, self).__init__(**kwargs) - self.is_admin = kwargs['is_admin'] - self.certificate_common_name = kwargs['certificate_common_name'] - self.certificate_issuer_thumbprint = kwargs['certificate_issuer_thumbprint'] - - -class ClientCertificateThumbprint(msrest.serialization.Model): - """Describes the client certificate details using thumbprint. - - All required parameters must be populated in order to send to Azure. - - :param is_admin: Required. Indicates if the client certificate has admin access to the cluster. - Non admin clients can perform only read only operations on the cluster. - :type is_admin: bool - :param certificate_thumbprint: Required. The thumbprint of the client certificate. - :type certificate_thumbprint: str - """ - - _validation = { - 'is_admin': {'required': True}, - 'certificate_thumbprint': {'required': True}, - } - - _attribute_map = { - 'is_admin': {'key': 'isAdmin', 'type': 'bool'}, - 'certificate_thumbprint': {'key': 'certificateThumbprint', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ClientCertificateThumbprint, self).__init__(**kwargs) - self.is_admin = kwargs['is_admin'] - self.certificate_thumbprint = kwargs['certificate_thumbprint'] - - -class Resource(msrest.serialization.Model): - """The resource model definition. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Azure resource identifier. - :vartype id: str - :ivar name: Azure resource name. - :vartype name: str - :ivar type: Azure resource type. - :vartype type: str - :param location: Required. Azure resource location. - :type location: str - :param tags: A set of tags. Azure resource tags. - :type tags: dict[str, str] - :ivar etag: Azure resource etag. - :vartype etag: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.servicefabric.models.SystemData - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'etag': {'readonly': True}, - 'system_data': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - } - - def __init__( - self, - **kwargs - ): - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.location = kwargs['location'] - self.tags = kwargs.get('tags', None) - self.etag = None - self.system_data = None - - -class Cluster(Resource): - """The cluster resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Azure resource identifier. - :vartype id: str - :ivar name: Azure resource name. - :vartype name: str - :ivar type: Azure resource type. - :vartype type: str - :param location: Required. Azure resource location. - :type location: str - :param tags: A set of tags. Azure resource tags. - :type tags: dict[str, str] - :ivar etag: Azure resource etag. - :vartype etag: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.servicefabric.models.SystemData - :param add_on_features: The list of add-on features to enable in the cluster. - :type add_on_features: list[str or ~azure.mgmt.servicefabric.models.AddOnFeatures] - :ivar available_cluster_versions: The Service Fabric runtime versions available for this - cluster. - :vartype available_cluster_versions: - list[~azure.mgmt.servicefabric.models.ClusterVersionDetails] - :param azure_active_directory: The AAD authentication settings of the cluster. - :type azure_active_directory: ~azure.mgmt.servicefabric.models.AzureActiveDirectory - :param certificate: The certificate to use for securing the cluster. The certificate provided - will be used for node to node security within the cluster, SSL certificate for cluster - management endpoint and default admin client. - :type certificate: ~azure.mgmt.servicefabric.models.CertificateDescription - :param certificate_common_names: Describes a list of server certificates referenced by common - name that are used to secure the cluster. - :type certificate_common_names: ~azure.mgmt.servicefabric.models.ServerCertificateCommonNames - :param client_certificate_common_names: The list of client certificates referenced by common - name that are allowed to manage the cluster. - :type client_certificate_common_names: - list[~azure.mgmt.servicefabric.models.ClientCertificateCommonName] - :param client_certificate_thumbprints: The list of client certificates referenced by thumbprint - that are allowed to manage the cluster. - :type client_certificate_thumbprints: - list[~azure.mgmt.servicefabric.models.ClientCertificateThumbprint] - :param cluster_code_version: The Service Fabric runtime version of the cluster. This property - can only by set the user when **upgradeMode** is set to 'Manual'. To get list of available - Service Fabric versions for new clusters use `ClusterVersion API <./ClusterVersion.md>`_. To - get the list of available version for existing clusters use **availableClusterVersions**. - :type cluster_code_version: str - :ivar cluster_endpoint: The Azure Resource Provider endpoint. A system service in the cluster - connects to this endpoint. - :vartype cluster_endpoint: str - :ivar cluster_id: A service generated unique identifier for the cluster resource. - :vartype cluster_id: str - :ivar cluster_state: The current state of the cluster. - - - * WaitingForNodes - Indicates that the cluster resource is created and the resource provider - is waiting for Service Fabric VM extension to boot up and report to it. - * Deploying - Indicates that the Service Fabric runtime is being installed on the VMs. Cluster - resource will be in this state until the cluster boots up and system services are up. - * BaselineUpgrade - Indicates that the cluster is upgrading to establishes the cluster - version. This upgrade is automatically initiated when the cluster boots up for the first time. - * UpdatingUserConfiguration - Indicates that the cluster is being upgraded with the user - provided configuration. - * UpdatingUserCertificate - Indicates that the cluster is being upgraded with the user - provided certificate. - * UpdatingInfrastructure - Indicates that the cluster is being upgraded with the latest - Service Fabric runtime version. This happens only when the **upgradeMode** is set to - 'Automatic'. - * EnforcingClusterVersion - Indicates that cluster is on a different version than expected and - the cluster is being upgraded to the expected version. - * UpgradeServiceUnreachable - Indicates that the system service in the cluster is no longer - polling the Resource Provider. Clusters in this state cannot be managed by the Resource - Provider. - * AutoScale - Indicates that the ReliabilityLevel of the cluster is being adjusted. - * Ready - Indicates that the cluster is in a stable state. Possible values include: - "WaitingForNodes", "Deploying", "BaselineUpgrade", "UpdatingUserConfiguration", - "UpdatingUserCertificate", "UpdatingInfrastructure", "EnforcingClusterVersion", - "UpgradeServiceUnreachable", "AutoScale", "Ready". - :vartype cluster_state: str or ~azure.mgmt.servicefabric.models.ClusterState - :param diagnostics_storage_account_config: The storage account information for storing Service - Fabric diagnostic logs. - :type diagnostics_storage_account_config: - ~azure.mgmt.servicefabric.models.DiagnosticsStorageAccountConfig - :param event_store_service_enabled: Indicates if the event store service is enabled. - :type event_store_service_enabled: bool - :param fabric_settings: The list of custom fabric settings to configure the cluster. - :type fabric_settings: list[~azure.mgmt.servicefabric.models.SettingsSectionDescription] - :param management_endpoint: The http management endpoint of the cluster. - :type management_endpoint: str - :param node_types: The list of node types in the cluster. - :type node_types: list[~azure.mgmt.servicefabric.models.NodeTypeDescription] - :ivar provisioning_state: The provisioning state of the cluster resource. Possible values - include: "Updating", "Succeeded", "Failed", "Canceled". - :vartype provisioning_state: str or ~azure.mgmt.servicefabric.models.ProvisioningState - :param reliability_level: The reliability level sets the replica set size of system services. - Learn about `ReliabilityLevel - `_. - - - * None - Run the System services with a target replica set count of 1. This should only be - used for test clusters. - * Bronze - Run the System services with a target replica set count of 3. This should only be - used for test clusters. - * Silver - Run the System services with a target replica set count of 5. - * Gold - Run the System services with a target replica set count of 7. - * Platinum - Run the System services with a target replica set count of 9. Possible values - include: "None", "Bronze", "Silver", "Gold", "Platinum". - :type reliability_level: str or ~azure.mgmt.servicefabric.models.ReliabilityLevel - :param reverse_proxy_certificate: The server certificate used by reverse proxy. - :type reverse_proxy_certificate: ~azure.mgmt.servicefabric.models.CertificateDescription - :param reverse_proxy_certificate_common_names: Describes a list of server certificates - referenced by common name that are used to secure the cluster. - :type reverse_proxy_certificate_common_names: - ~azure.mgmt.servicefabric.models.ServerCertificateCommonNames - :param upgrade_description: The policy to use when upgrading the cluster. - :type upgrade_description: ~azure.mgmt.servicefabric.models.ClusterUpgradePolicy - :param upgrade_mode: The upgrade mode of the cluster when new Service Fabric runtime version is - available. Possible values include: "Automatic", "Manual". Default value: "Automatic". - :type upgrade_mode: str or ~azure.mgmt.servicefabric.models.UpgradeMode - :param application_type_versions_cleanup_policy: The policy used to clean up unused versions. - :type application_type_versions_cleanup_policy: - ~azure.mgmt.servicefabric.models.ApplicationTypeVersionsCleanupPolicy - :param vm_image: The VM image VMSS has been configured with. Generic names such as Windows or - Linux can be used. - :type vm_image: str - :param sf_zonal_upgrade_mode: This property controls the logical grouping of VMs in upgrade - domains (UDs). This property can't be modified if a node type with multiple Availability Zones - is already present in the cluster. Possible values include: "Parallel", "Hierarchical". - :type sf_zonal_upgrade_mode: str or ~azure.mgmt.servicefabric.models.SfZonalUpgradeMode - :param vmss_zonal_upgrade_mode: This property defines the upgrade mode for the virtual machine - scale set, it is mandatory if a node type with multiple Availability Zones is added. Possible - values include: "Parallel", "Hierarchical". - :type vmss_zonal_upgrade_mode: str or ~azure.mgmt.servicefabric.models.VmssZonalUpgradeMode - :param infrastructure_service_manager: Indicates if infrastructure service manager is enabled. - :type infrastructure_service_manager: bool - :param upgrade_wave: Indicates when new cluster runtime version upgrades will be applied after - they are released. By default is Wave0. Only applies when **upgradeMode** is set to - 'Automatic'. Possible values include: "Wave0", "Wave1", "Wave2". - :type upgrade_wave: str or ~azure.mgmt.servicefabric.models.ClusterUpgradeCadence - :param upgrade_pause_start_timestamp_utc: Indicates the start date and time to pause automatic - runtime version upgrades on the cluster for an specific period of time on the cluster (UTC). - :type upgrade_pause_start_timestamp_utc: ~datetime.datetime - :param upgrade_pause_end_timestamp_utc: Indicates the end date and time to pause automatic - runtime version upgrades on the cluster for an specific period of time on the cluster (UTC). - :type upgrade_pause_end_timestamp_utc: ~datetime.datetime - :param wave_upgrade_paused: Boolean to pause automatic runtime version upgrades to the cluster. - :type wave_upgrade_paused: bool - :param notifications: Indicates a list of notification channels for cluster events. - :type notifications: list[~azure.mgmt.servicefabric.models.Notification] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'etag': {'readonly': True}, - 'system_data': {'readonly': True}, - 'available_cluster_versions': {'readonly': True}, - 'cluster_endpoint': {'readonly': True}, - 'cluster_id': {'readonly': True}, - 'cluster_state': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'add_on_features': {'key': 'properties.addOnFeatures', 'type': '[str]'}, - 'available_cluster_versions': {'key': 'properties.availableClusterVersions', 'type': '[ClusterVersionDetails]'}, - 'azure_active_directory': {'key': 'properties.azureActiveDirectory', 'type': 'AzureActiveDirectory'}, - 'certificate': {'key': 'properties.certificate', 'type': 'CertificateDescription'}, - 'certificate_common_names': {'key': 'properties.certificateCommonNames', 'type': 'ServerCertificateCommonNames'}, - 'client_certificate_common_names': {'key': 'properties.clientCertificateCommonNames', 'type': '[ClientCertificateCommonName]'}, - 'client_certificate_thumbprints': {'key': 'properties.clientCertificateThumbprints', 'type': '[ClientCertificateThumbprint]'}, - 'cluster_code_version': {'key': 'properties.clusterCodeVersion', 'type': 'str'}, - 'cluster_endpoint': {'key': 'properties.clusterEndpoint', 'type': 'str'}, - 'cluster_id': {'key': 'properties.clusterId', 'type': 'str'}, - 'cluster_state': {'key': 'properties.clusterState', 'type': 'str'}, - 'diagnostics_storage_account_config': {'key': 'properties.diagnosticsStorageAccountConfig', 'type': 'DiagnosticsStorageAccountConfig'}, - 'event_store_service_enabled': {'key': 'properties.eventStoreServiceEnabled', 'type': 'bool'}, - 'fabric_settings': {'key': 'properties.fabricSettings', 'type': '[SettingsSectionDescription]'}, - 'management_endpoint': {'key': 'properties.managementEndpoint', 'type': 'str'}, - 'node_types': {'key': 'properties.nodeTypes', 'type': '[NodeTypeDescription]'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'reliability_level': {'key': 'properties.reliabilityLevel', 'type': 'str'}, - 'reverse_proxy_certificate': {'key': 'properties.reverseProxyCertificate', 'type': 'CertificateDescription'}, - 'reverse_proxy_certificate_common_names': {'key': 'properties.reverseProxyCertificateCommonNames', 'type': 'ServerCertificateCommonNames'}, - 'upgrade_description': {'key': 'properties.upgradeDescription', 'type': 'ClusterUpgradePolicy'}, - 'upgrade_mode': {'key': 'properties.upgradeMode', 'type': 'str'}, - 'application_type_versions_cleanup_policy': {'key': 'properties.applicationTypeVersionsCleanupPolicy', 'type': 'ApplicationTypeVersionsCleanupPolicy'}, - 'vm_image': {'key': 'properties.vmImage', 'type': 'str'}, - 'sf_zonal_upgrade_mode': {'key': 'properties.sfZonalUpgradeMode', 'type': 'str'}, - 'vmss_zonal_upgrade_mode': {'key': 'properties.vmssZonalUpgradeMode', 'type': 'str'}, - 'infrastructure_service_manager': {'key': 'properties.infrastructureServiceManager', 'type': 'bool'}, - 'upgrade_wave': {'key': 'properties.upgradeWave', 'type': 'str'}, - 'upgrade_pause_start_timestamp_utc': {'key': 'properties.upgradePauseStartTimestampUtc', 'type': 'iso-8601'}, - 'upgrade_pause_end_timestamp_utc': {'key': 'properties.upgradePauseEndTimestampUtc', 'type': 'iso-8601'}, - 'wave_upgrade_paused': {'key': 'properties.waveUpgradePaused', 'type': 'bool'}, - 'notifications': {'key': 'properties.notifications', 'type': '[Notification]'}, - } - - def __init__( - self, - **kwargs - ): - super(Cluster, self).__init__(**kwargs) - self.add_on_features = kwargs.get('add_on_features', None) - self.available_cluster_versions = None - self.azure_active_directory = kwargs.get('azure_active_directory', None) - self.certificate = kwargs.get('certificate', None) - self.certificate_common_names = kwargs.get('certificate_common_names', None) - self.client_certificate_common_names = kwargs.get('client_certificate_common_names', None) - self.client_certificate_thumbprints = kwargs.get('client_certificate_thumbprints', None) - self.cluster_code_version = kwargs.get('cluster_code_version', None) - self.cluster_endpoint = None - self.cluster_id = None - self.cluster_state = None - self.diagnostics_storage_account_config = kwargs.get('diagnostics_storage_account_config', None) - self.event_store_service_enabled = kwargs.get('event_store_service_enabled', None) - self.fabric_settings = kwargs.get('fabric_settings', None) - self.management_endpoint = kwargs.get('management_endpoint', None) - self.node_types = kwargs.get('node_types', None) - self.provisioning_state = None - self.reliability_level = kwargs.get('reliability_level', None) - self.reverse_proxy_certificate = kwargs.get('reverse_proxy_certificate', None) - self.reverse_proxy_certificate_common_names = kwargs.get('reverse_proxy_certificate_common_names', None) - self.upgrade_description = kwargs.get('upgrade_description', None) - self.upgrade_mode = kwargs.get('upgrade_mode', "Automatic") - self.application_type_versions_cleanup_policy = kwargs.get('application_type_versions_cleanup_policy', None) - self.vm_image = kwargs.get('vm_image', None) - self.sf_zonal_upgrade_mode = kwargs.get('sf_zonal_upgrade_mode', None) - self.vmss_zonal_upgrade_mode = kwargs.get('vmss_zonal_upgrade_mode', None) - self.infrastructure_service_manager = kwargs.get('infrastructure_service_manager', None) - self.upgrade_wave = kwargs.get('upgrade_wave', None) - self.upgrade_pause_start_timestamp_utc = kwargs.get('upgrade_pause_start_timestamp_utc', None) - self.upgrade_pause_end_timestamp_utc = kwargs.get('upgrade_pause_end_timestamp_utc', None) - self.wave_upgrade_paused = kwargs.get('wave_upgrade_paused', None) - self.notifications = kwargs.get('notifications', None) - - -class ClusterCodeVersionsListResult(msrest.serialization.Model): - """The list results of the Service Fabric runtime versions. - - :param value: - :type value: list[~azure.mgmt.servicefabric.models.ClusterCodeVersionsResult] - :param next_link: The URL to use for getting the next set of results. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ClusterCodeVersionsResult]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ClusterCodeVersionsListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class ClusterCodeVersionsResult(msrest.serialization.Model): - """The result of the Service Fabric runtime versions. - - :param id: The identification of the result. - :type id: str - :param name: The name of the result. - :type name: str - :param type: The result resource type. - :type type: str - :param code_version: The Service Fabric runtime version of the cluster. - :type code_version: str - :param support_expiry_utc: The date of expiry of support of the version. - :type support_expiry_utc: str - :param environment: Indicates if this version is for Windows or Linux operating system. - Possible values include: "Windows", "Linux". - :type environment: str or ~azure.mgmt.servicefabric.models.ClusterEnvironment - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'code_version': {'key': 'properties.codeVersion', 'type': 'str'}, - 'support_expiry_utc': {'key': 'properties.supportExpiryUtc', 'type': 'str'}, - 'environment': {'key': 'properties.environment', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ClusterCodeVersionsResult, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - self.name = kwargs.get('name', None) - self.type = kwargs.get('type', None) - self.code_version = kwargs.get('code_version', None) - self.support_expiry_utc = kwargs.get('support_expiry_utc', None) - self.environment = kwargs.get('environment', None) - - -class ClusterHealthPolicy(msrest.serialization.Model): - """Defines a health policy used to evaluate the health of the cluster or of a cluster node. - - :param max_percent_unhealthy_nodes: The maximum allowed percentage of unhealthy nodes before - reporting an error. For example, to allow 10% of nodes to be unhealthy, this value would be 10. - - The percentage represents the maximum tolerated percentage of nodes that can be unhealthy - before the cluster is considered in error. - If the percentage is respected but there is at least one unhealthy node, the health is - evaluated as Warning. - The percentage is calculated by dividing the number of unhealthy nodes over the total number - of nodes in the cluster. - The computation rounds up to tolerate one failure on small numbers of nodes. Default - percentage is zero. - - In large clusters, some nodes will always be down or out for repairs, so this percentage - should be configured to tolerate that. - :type max_percent_unhealthy_nodes: int - :param max_percent_unhealthy_applications: The maximum allowed percentage of unhealthy - applications before reporting an error. For example, to allow 10% of applications to be - unhealthy, this value would be 10. - - The percentage represents the maximum tolerated percentage of applications that can be - unhealthy before the cluster is considered in error. - If the percentage is respected but there is at least one unhealthy application, the health is - evaluated as Warning. - This is calculated by dividing the number of unhealthy applications over the total number of - application instances in the cluster, excluding applications of application types that are - included in the ApplicationTypeHealthPolicyMap. - The computation rounds up to tolerate one failure on small numbers of applications. Default - percentage is zero. - :type max_percent_unhealthy_applications: int - :param application_health_policies: Defines the application health policy map used to evaluate - the health of an application or one of its children entities. - :type application_health_policies: dict[str, - ~azure.mgmt.servicefabric.models.ApplicationHealthPolicy] - """ - - _validation = { - 'max_percent_unhealthy_nodes': {'maximum': 100, 'minimum': 0}, - 'max_percent_unhealthy_applications': {'maximum': 100, 'minimum': 0}, - } - - _attribute_map = { - 'max_percent_unhealthy_nodes': {'key': 'maxPercentUnhealthyNodes', 'type': 'int'}, - 'max_percent_unhealthy_applications': {'key': 'maxPercentUnhealthyApplications', 'type': 'int'}, - 'application_health_policies': {'key': 'applicationHealthPolicies', 'type': '{ApplicationHealthPolicy}'}, - } - - def __init__( - self, - **kwargs - ): - super(ClusterHealthPolicy, self).__init__(**kwargs) - self.max_percent_unhealthy_nodes = kwargs.get('max_percent_unhealthy_nodes', 0) - self.max_percent_unhealthy_applications = kwargs.get('max_percent_unhealthy_applications', 0) - self.application_health_policies = kwargs.get('application_health_policies', None) - - -class ClusterListResult(msrest.serialization.Model): - """Cluster list results. - - :param value: - :type value: list[~azure.mgmt.servicefabric.models.Cluster] - :param next_link: The URL to use for getting the next set of results. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Cluster]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ClusterListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class ClusterUpdateParameters(msrest.serialization.Model): - """Cluster update request. - - :param tags: A set of tags. Cluster update parameters. - :type tags: dict[str, str] - :param add_on_features: The list of add-on features to enable in the cluster. - :type add_on_features: list[str or ~azure.mgmt.servicefabric.models.AddOnFeatures] - :param certificate: The certificate to use for securing the cluster. The certificate provided - will be used for node to node security within the cluster, SSL certificate for cluster - management endpoint and default admin client. - :type certificate: ~azure.mgmt.servicefabric.models.CertificateDescription - :param certificate_common_names: Describes a list of server certificates referenced by common - name that are used to secure the cluster. - :type certificate_common_names: ~azure.mgmt.servicefabric.models.ServerCertificateCommonNames - :param client_certificate_common_names: The list of client certificates referenced by common - name that are allowed to manage the cluster. This will overwrite the existing list. - :type client_certificate_common_names: - list[~azure.mgmt.servicefabric.models.ClientCertificateCommonName] - :param client_certificate_thumbprints: The list of client certificates referenced by thumbprint - that are allowed to manage the cluster. This will overwrite the existing list. - :type client_certificate_thumbprints: - list[~azure.mgmt.servicefabric.models.ClientCertificateThumbprint] - :param cluster_code_version: The Service Fabric runtime version of the cluster. This property - can only by set the user when **upgradeMode** is set to 'Manual'. To get list of available - Service Fabric versions for new clusters use `ClusterVersion API <./ClusterVersion.md>`_. To - get the list of available version for existing clusters use **availableClusterVersions**. - :type cluster_code_version: str - :param event_store_service_enabled: Indicates if the event store service is enabled. - :type event_store_service_enabled: bool - :param fabric_settings: The list of custom fabric settings to configure the cluster. This will - overwrite the existing list. - :type fabric_settings: list[~azure.mgmt.servicefabric.models.SettingsSectionDescription] - :param node_types: The list of node types in the cluster. This will overwrite the existing - list. - :type node_types: list[~azure.mgmt.servicefabric.models.NodeTypeDescription] - :param reliability_level: The reliability level sets the replica set size of system services. - Learn about `ReliabilityLevel - `_. - - - * None - Run the System services with a target replica set count of 1. This should only be - used for test clusters. - * Bronze - Run the System services with a target replica set count of 3. This should only be - used for test clusters. - * Silver - Run the System services with a target replica set count of 5. - * Gold - Run the System services with a target replica set count of 7. - * Platinum - Run the System services with a target replica set count of 9. Possible values - include: "None", "Bronze", "Silver", "Gold", "Platinum". - :type reliability_level: str or ~azure.mgmt.servicefabric.models.ReliabilityLevel - :param reverse_proxy_certificate: The server certificate used by reverse proxy. - :type reverse_proxy_certificate: ~azure.mgmt.servicefabric.models.CertificateDescription - :param upgrade_description: The policy to use when upgrading the cluster. - :type upgrade_description: ~azure.mgmt.servicefabric.models.ClusterUpgradePolicy - :param application_type_versions_cleanup_policy: The policy used to clean up unused versions. - :type application_type_versions_cleanup_policy: - ~azure.mgmt.servicefabric.models.ApplicationTypeVersionsCleanupPolicy - :param upgrade_mode: The upgrade mode of the cluster when new Service Fabric runtime version is - available. Possible values include: "Automatic", "Manual". Default value: "Automatic". - :type upgrade_mode: str or ~azure.mgmt.servicefabric.models.UpgradeMode - :param sf_zonal_upgrade_mode: This property controls the logical grouping of VMs in upgrade - domains (UDs). This property can't be modified if a node type with multiple Availability Zones - is already present in the cluster. Possible values include: "Parallel", "Hierarchical". - :type sf_zonal_upgrade_mode: str or ~azure.mgmt.servicefabric.models.SfZonalUpgradeMode - :param vmss_zonal_upgrade_mode: This property defines the upgrade mode for the virtual machine - scale set, it is mandatory if a node type with multiple Availability Zones is added. Possible - values include: "Parallel", "Hierarchical". - :type vmss_zonal_upgrade_mode: str or ~azure.mgmt.servicefabric.models.VmssZonalUpgradeMode - :param infrastructure_service_manager: Indicates if infrastructure service manager is enabled. - :type infrastructure_service_manager: bool - :param upgrade_wave: Indicates when new cluster runtime version upgrades will be applied after - they are released. By default is Wave0. Only applies when **upgradeMode** is set to - 'Automatic'. Possible values include: "Wave0", "Wave1", "Wave2". - :type upgrade_wave: str or ~azure.mgmt.servicefabric.models.ClusterUpgradeCadence - :param upgrade_pause_start_timestamp_utc: The start timestamp to pause runtime version upgrades - on the cluster (UTC). - :type upgrade_pause_start_timestamp_utc: ~datetime.datetime - :param upgrade_pause_end_timestamp_utc: The end timestamp of pause runtime version upgrades on - the cluster (UTC). - :type upgrade_pause_end_timestamp_utc: ~datetime.datetime - :param wave_upgrade_paused: Boolean to pause automatic runtime version upgrades to the cluster. - :type wave_upgrade_paused: bool - :param notifications: Indicates a list of notification channels for cluster events. - :type notifications: list[~azure.mgmt.servicefabric.models.Notification] - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'add_on_features': {'key': 'properties.addOnFeatures', 'type': '[str]'}, - 'certificate': {'key': 'properties.certificate', 'type': 'CertificateDescription'}, - 'certificate_common_names': {'key': 'properties.certificateCommonNames', 'type': 'ServerCertificateCommonNames'}, - 'client_certificate_common_names': {'key': 'properties.clientCertificateCommonNames', 'type': '[ClientCertificateCommonName]'}, - 'client_certificate_thumbprints': {'key': 'properties.clientCertificateThumbprints', 'type': '[ClientCertificateThumbprint]'}, - 'cluster_code_version': {'key': 'properties.clusterCodeVersion', 'type': 'str'}, - 'event_store_service_enabled': {'key': 'properties.eventStoreServiceEnabled', 'type': 'bool'}, - 'fabric_settings': {'key': 'properties.fabricSettings', 'type': '[SettingsSectionDescription]'}, - 'node_types': {'key': 'properties.nodeTypes', 'type': '[NodeTypeDescription]'}, - 'reliability_level': {'key': 'properties.reliabilityLevel', 'type': 'str'}, - 'reverse_proxy_certificate': {'key': 'properties.reverseProxyCertificate', 'type': 'CertificateDescription'}, - 'upgrade_description': {'key': 'properties.upgradeDescription', 'type': 'ClusterUpgradePolicy'}, - 'application_type_versions_cleanup_policy': {'key': 'properties.applicationTypeVersionsCleanupPolicy', 'type': 'ApplicationTypeVersionsCleanupPolicy'}, - 'upgrade_mode': {'key': 'properties.upgradeMode', 'type': 'str'}, - 'sf_zonal_upgrade_mode': {'key': 'properties.sfZonalUpgradeMode', 'type': 'str'}, - 'vmss_zonal_upgrade_mode': {'key': 'properties.vmssZonalUpgradeMode', 'type': 'str'}, - 'infrastructure_service_manager': {'key': 'properties.infrastructureServiceManager', 'type': 'bool'}, - 'upgrade_wave': {'key': 'properties.upgradeWave', 'type': 'str'}, - 'upgrade_pause_start_timestamp_utc': {'key': 'properties.upgradePauseStartTimestampUtc', 'type': 'iso-8601'}, - 'upgrade_pause_end_timestamp_utc': {'key': 'properties.upgradePauseEndTimestampUtc', 'type': 'iso-8601'}, - 'wave_upgrade_paused': {'key': 'properties.waveUpgradePaused', 'type': 'bool'}, - 'notifications': {'key': 'properties.notifications', 'type': '[Notification]'}, - } - - def __init__( - self, - **kwargs - ): - super(ClusterUpdateParameters, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.add_on_features = kwargs.get('add_on_features', None) - self.certificate = kwargs.get('certificate', None) - self.certificate_common_names = kwargs.get('certificate_common_names', None) - self.client_certificate_common_names = kwargs.get('client_certificate_common_names', None) - self.client_certificate_thumbprints = kwargs.get('client_certificate_thumbprints', None) - self.cluster_code_version = kwargs.get('cluster_code_version', None) - self.event_store_service_enabled = kwargs.get('event_store_service_enabled', None) - self.fabric_settings = kwargs.get('fabric_settings', None) - self.node_types = kwargs.get('node_types', None) - self.reliability_level = kwargs.get('reliability_level', None) - self.reverse_proxy_certificate = kwargs.get('reverse_proxy_certificate', None) - self.upgrade_description = kwargs.get('upgrade_description', None) - self.application_type_versions_cleanup_policy = kwargs.get('application_type_versions_cleanup_policy', None) - self.upgrade_mode = kwargs.get('upgrade_mode', "Automatic") - self.sf_zonal_upgrade_mode = kwargs.get('sf_zonal_upgrade_mode', None) - self.vmss_zonal_upgrade_mode = kwargs.get('vmss_zonal_upgrade_mode', None) - self.infrastructure_service_manager = kwargs.get('infrastructure_service_manager', None) - self.upgrade_wave = kwargs.get('upgrade_wave', None) - self.upgrade_pause_start_timestamp_utc = kwargs.get('upgrade_pause_start_timestamp_utc', None) - self.upgrade_pause_end_timestamp_utc = kwargs.get('upgrade_pause_end_timestamp_utc', None) - self.wave_upgrade_paused = kwargs.get('wave_upgrade_paused', None) - self.notifications = kwargs.get('notifications', None) - - -class ClusterUpgradeDeltaHealthPolicy(msrest.serialization.Model): - """Describes the delta health policies for the cluster upgrade. - - All required parameters must be populated in order to send to Azure. - - :param max_percent_delta_unhealthy_nodes: Required. The maximum allowed percentage of nodes - health degradation allowed during cluster upgrades. - The delta is measured between the state of the nodes at the beginning of upgrade and the state - of the nodes at the time of the health evaluation. - The check is performed after every upgrade domain upgrade completion to make sure the global - state of the cluster is within tolerated limits. - :type max_percent_delta_unhealthy_nodes: int - :param max_percent_upgrade_domain_delta_unhealthy_nodes: Required. The maximum allowed - percentage of upgrade domain nodes health degradation allowed during cluster upgrades. - The delta is measured between the state of the upgrade domain nodes at the beginning of - upgrade and the state of the upgrade domain nodes at the time of the health evaluation. - The check is performed after every upgrade domain upgrade completion for all completed upgrade - domains to make sure the state of the upgrade domains is within tolerated limits. - :type max_percent_upgrade_domain_delta_unhealthy_nodes: int - :param max_percent_delta_unhealthy_applications: Required. The maximum allowed percentage of - applications health degradation allowed during cluster upgrades. - The delta is measured between the state of the applications at the beginning of upgrade and - the state of the applications at the time of the health evaluation. - The check is performed after every upgrade domain upgrade completion to make sure the global - state of the cluster is within tolerated limits. System services are not included in this. - :type max_percent_delta_unhealthy_applications: int - :param application_delta_health_policies: Defines the application delta health policy map used - to evaluate the health of an application or one of its child entities when upgrading the - cluster. - :type application_delta_health_policies: dict[str, - ~azure.mgmt.servicefabric.models.ApplicationDeltaHealthPolicy] - """ - - _validation = { - 'max_percent_delta_unhealthy_nodes': {'required': True, 'maximum': 100, 'minimum': 0}, - 'max_percent_upgrade_domain_delta_unhealthy_nodes': {'required': True, 'maximum': 100, 'minimum': 0}, - 'max_percent_delta_unhealthy_applications': {'required': True, 'maximum': 100, 'minimum': 0}, - } - - _attribute_map = { - 'max_percent_delta_unhealthy_nodes': {'key': 'maxPercentDeltaUnhealthyNodes', 'type': 'int'}, - 'max_percent_upgrade_domain_delta_unhealthy_nodes': {'key': 'maxPercentUpgradeDomainDeltaUnhealthyNodes', 'type': 'int'}, - 'max_percent_delta_unhealthy_applications': {'key': 'maxPercentDeltaUnhealthyApplications', 'type': 'int'}, - 'application_delta_health_policies': {'key': 'applicationDeltaHealthPolicies', 'type': '{ApplicationDeltaHealthPolicy}'}, - } - - def __init__( - self, - **kwargs - ): - super(ClusterUpgradeDeltaHealthPolicy, self).__init__(**kwargs) - self.max_percent_delta_unhealthy_nodes = kwargs['max_percent_delta_unhealthy_nodes'] - self.max_percent_upgrade_domain_delta_unhealthy_nodes = kwargs['max_percent_upgrade_domain_delta_unhealthy_nodes'] - self.max_percent_delta_unhealthy_applications = kwargs['max_percent_delta_unhealthy_applications'] - self.application_delta_health_policies = kwargs.get('application_delta_health_policies', None) - - -class ClusterUpgradePolicy(msrest.serialization.Model): - """Describes the policy used when upgrading the cluster. - - All required parameters must be populated in order to send to Azure. - - :param force_restart: If true, then processes are forcefully restarted during upgrade even when - the code version has not changed (the upgrade only changes configuration or data). - :type force_restart: bool - :param upgrade_replica_set_check_timeout: Required. The maximum amount of time to block - processing of an upgrade domain and prevent loss of availability when there are unexpected - issues. When this timeout expires, processing of the upgrade domain will proceed regardless of - availability loss issues. The timeout is reset at the start of each upgrade domain. The timeout - can be in either hh:mm:ss or in d.hh:mm:ss.ms format. - :type upgrade_replica_set_check_timeout: str - :param health_check_wait_duration: Required. The length of time to wait after completing an - upgrade domain before performing health checks. The duration can be in either hh:mm:ss or in - d.hh:mm:ss.ms format. - :type health_check_wait_duration: str - :param health_check_stable_duration: Required. The amount of time that the application or - cluster must remain healthy before the upgrade proceeds to the next upgrade domain. The - duration can be in either hh:mm:ss or in d.hh:mm:ss.ms format. - :type health_check_stable_duration: str - :param health_check_retry_timeout: Required. The amount of time to retry health evaluation when - the application or cluster is unhealthy before the upgrade rolls back. The timeout can be in - either hh:mm:ss or in d.hh:mm:ss.ms format. - :type health_check_retry_timeout: str - :param upgrade_timeout: Required. The amount of time the overall upgrade has to complete before - the upgrade rolls back. The timeout can be in either hh:mm:ss or in d.hh:mm:ss.ms format. - :type upgrade_timeout: str - :param upgrade_domain_timeout: Required. The amount of time each upgrade domain has to complete - before the upgrade rolls back. The timeout can be in either hh:mm:ss or in d.hh:mm:ss.ms - format. - :type upgrade_domain_timeout: str - :param health_policy: Required. The cluster health policy used when upgrading the cluster. - :type health_policy: ~azure.mgmt.servicefabric.models.ClusterHealthPolicy - :param delta_health_policy: The cluster delta health policy used when upgrading the cluster. - :type delta_health_policy: ~azure.mgmt.servicefabric.models.ClusterUpgradeDeltaHealthPolicy - """ - - _validation = { - 'upgrade_replica_set_check_timeout': {'required': True}, - 'health_check_wait_duration': {'required': True}, - 'health_check_stable_duration': {'required': True}, - 'health_check_retry_timeout': {'required': True}, - 'upgrade_timeout': {'required': True}, - 'upgrade_domain_timeout': {'required': True}, - 'health_policy': {'required': True}, - } - - _attribute_map = { - 'force_restart': {'key': 'forceRestart', 'type': 'bool'}, - 'upgrade_replica_set_check_timeout': {'key': 'upgradeReplicaSetCheckTimeout', 'type': 'str'}, - 'health_check_wait_duration': {'key': 'healthCheckWaitDuration', 'type': 'str'}, - 'health_check_stable_duration': {'key': 'healthCheckStableDuration', 'type': 'str'}, - 'health_check_retry_timeout': {'key': 'healthCheckRetryTimeout', 'type': 'str'}, - 'upgrade_timeout': {'key': 'upgradeTimeout', 'type': 'str'}, - 'upgrade_domain_timeout': {'key': 'upgradeDomainTimeout', 'type': 'str'}, - 'health_policy': {'key': 'healthPolicy', 'type': 'ClusterHealthPolicy'}, - 'delta_health_policy': {'key': 'deltaHealthPolicy', 'type': 'ClusterUpgradeDeltaHealthPolicy'}, - } - - def __init__( - self, - **kwargs - ): - super(ClusterUpgradePolicy, self).__init__(**kwargs) - self.force_restart = kwargs.get('force_restart', None) - self.upgrade_replica_set_check_timeout = kwargs['upgrade_replica_set_check_timeout'] - self.health_check_wait_duration = kwargs['health_check_wait_duration'] - self.health_check_stable_duration = kwargs['health_check_stable_duration'] - self.health_check_retry_timeout = kwargs['health_check_retry_timeout'] - self.upgrade_timeout = kwargs['upgrade_timeout'] - self.upgrade_domain_timeout = kwargs['upgrade_domain_timeout'] - self.health_policy = kwargs['health_policy'] - self.delta_health_policy = kwargs.get('delta_health_policy', None) - - -class ClusterVersionDetails(msrest.serialization.Model): - """The detail of the Service Fabric runtime version result. - - :param code_version: The Service Fabric runtime version of the cluster. - :type code_version: str - :param support_expiry_utc: The date of expiry of support of the version. - :type support_expiry_utc: str - :param environment: Indicates if this version is for Windows or Linux operating system. - Possible values include: "Windows", "Linux". - :type environment: str or ~azure.mgmt.servicefabric.models.ClusterEnvironment - """ - - _attribute_map = { - 'code_version': {'key': 'codeVersion', 'type': 'str'}, - 'support_expiry_utc': {'key': 'supportExpiryUtc', 'type': 'str'}, - 'environment': {'key': 'environment', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ClusterVersionDetails, self).__init__(**kwargs) - self.code_version = kwargs.get('code_version', None) - self.support_expiry_utc = kwargs.get('support_expiry_utc', None) - self.environment = kwargs.get('environment', None) - - -class DiagnosticsStorageAccountConfig(msrest.serialization.Model): - """The storage account information for storing Service Fabric diagnostic logs. - - All required parameters must be populated in order to send to Azure. - - :param storage_account_name: Required. The Azure storage account name. - :type storage_account_name: str - :param protected_account_key_name: Required. The protected diagnostics storage key name. - :type protected_account_key_name: str - :param protected_account_key_name2: The secondary protected diagnostics storage key name. If - one of the storage account keys is rotated the cluster will fallback to using the other. - :type protected_account_key_name2: str - :param blob_endpoint: Required. The blob endpoint of the azure storage account. - :type blob_endpoint: str - :param queue_endpoint: Required. The queue endpoint of the azure storage account. - :type queue_endpoint: str - :param table_endpoint: Required. The table endpoint of the azure storage account. - :type table_endpoint: str - """ - - _validation = { - 'storage_account_name': {'required': True}, - 'protected_account_key_name': {'required': True}, - 'blob_endpoint': {'required': True}, - 'queue_endpoint': {'required': True}, - 'table_endpoint': {'required': True}, - } - - _attribute_map = { - 'storage_account_name': {'key': 'storageAccountName', 'type': 'str'}, - 'protected_account_key_name': {'key': 'protectedAccountKeyName', 'type': 'str'}, - 'protected_account_key_name2': {'key': 'protectedAccountKeyName2', 'type': 'str'}, - 'blob_endpoint': {'key': 'blobEndpoint', 'type': 'str'}, - 'queue_endpoint': {'key': 'queueEndpoint', 'type': 'str'}, - 'table_endpoint': {'key': 'tableEndpoint', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DiagnosticsStorageAccountConfig, self).__init__(**kwargs) - self.storage_account_name = kwargs['storage_account_name'] - self.protected_account_key_name = kwargs['protected_account_key_name'] - self.protected_account_key_name2 = kwargs.get('protected_account_key_name2', None) - self.blob_endpoint = kwargs['blob_endpoint'] - self.queue_endpoint = kwargs['queue_endpoint'] - self.table_endpoint = kwargs['table_endpoint'] - - -class EndpointRangeDescription(msrest.serialization.Model): - """Port range details. - - All required parameters must be populated in order to send to Azure. - - :param start_port: Required. Starting port of a range of ports. - :type start_port: int - :param end_port: Required. End port of a range of ports. - :type end_port: int - """ - - _validation = { - 'start_port': {'required': True}, - 'end_port': {'required': True}, - } - - _attribute_map = { - 'start_port': {'key': 'startPort', 'type': 'int'}, - 'end_port': {'key': 'endPort', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(EndpointRangeDescription, self).__init__(**kwargs) - self.start_port = kwargs['start_port'] - self.end_port = kwargs['end_port'] - - -class ErrorModel(msrest.serialization.Model): - """The structure of the error. - - :param error: The error details. - :type error: ~azure.mgmt.servicefabric.models.ErrorModelError - """ - - _attribute_map = { - 'error': {'key': 'error', 'type': 'ErrorModelError'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorModel, self).__init__(**kwargs) - self.error = kwargs.get('error', None) - - -class ErrorModelError(msrest.serialization.Model): - """The error details. - - :param code: The error code. - :type code: str - :param message: The error message. - :type message: str - """ - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorModelError, self).__init__(**kwargs) - self.code = kwargs.get('code', None) - self.message = kwargs.get('message', None) - - -class ManagedIdentity(msrest.serialization.Model): - """Describes the managed identities for an Azure resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar principal_id: The principal id of the managed identity. This property will only be - provided for a system assigned identity. - :vartype principal_id: str - :ivar tenant_id: The tenant id of the managed identity. This property will only be provided for - a system assigned identity. - :vartype tenant_id: str - :param type: The type of managed identity for the resource. Possible values include: - "SystemAssigned", "UserAssigned", "SystemAssigned, UserAssigned", "None". - :type type: str or ~azure.mgmt.servicefabric.models.ManagedIdentityType - :param user_assigned_identities: The list of user identities associated with the resource. The - user identity dictionary key references will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. - :type user_assigned_identities: dict[str, - ~azure.mgmt.servicefabric.models.UserAssignedIdentity] - """ - - _validation = { - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, - } - - _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{UserAssignedIdentity}'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagedIdentity, self).__init__(**kwargs) - self.principal_id = None - self.tenant_id = None - self.type = kwargs.get('type', None) - self.user_assigned_identities = kwargs.get('user_assigned_identities', None) - - -class PartitionSchemeDescription(msrest.serialization.Model): - """Describes how the service is partitioned. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: NamedPartitionSchemeDescription, SingletonPartitionSchemeDescription, UniformInt64RangePartitionSchemeDescription. - - All required parameters must be populated in order to send to Azure. - - :param partition_scheme: Required. Specifies how the service is partitioned.Constant filled by - server. Possible values include: "Invalid", "Singleton", "UniformInt64Range", "Named". - :type partition_scheme: str or ~azure.mgmt.servicefabric.models.PartitionScheme - """ - - _validation = { - 'partition_scheme': {'required': True}, - } - - _attribute_map = { - 'partition_scheme': {'key': 'partitionScheme', 'type': 'str'}, - } - - _subtype_map = { - 'partition_scheme': {'Named': 'NamedPartitionSchemeDescription', 'Singleton': 'SingletonPartitionSchemeDescription', 'UniformInt64Range': 'UniformInt64RangePartitionSchemeDescription'} - } - - def __init__( - self, - **kwargs - ): - super(PartitionSchemeDescription, self).__init__(**kwargs) - self.partition_scheme = None # type: Optional[str] - - -class NamedPartitionSchemeDescription(PartitionSchemeDescription): - """Describes the named partition scheme of the service. - - All required parameters must be populated in order to send to Azure. - - :param partition_scheme: Required. Specifies how the service is partitioned.Constant filled by - server. Possible values include: "Invalid", "Singleton", "UniformInt64Range", "Named". - :type partition_scheme: str or ~azure.mgmt.servicefabric.models.PartitionScheme - :param count: Required. The number of partitions. - :type count: int - :param names: Required. Array of size specified by the ‘count’ parameter, for the names of the - partitions. - :type names: list[str] - """ - - _validation = { - 'partition_scheme': {'required': True}, - 'count': {'required': True}, - 'names': {'required': True}, - } - - _attribute_map = { - 'partition_scheme': {'key': 'partitionScheme', 'type': 'str'}, - 'count': {'key': 'count', 'type': 'int'}, - 'names': {'key': 'names', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(NamedPartitionSchemeDescription, self).__init__(**kwargs) - self.partition_scheme = 'Named' # type: str - self.count = kwargs['count'] - self.names = kwargs['names'] - - -class NodeTypeDescription(msrest.serialization.Model): - """Describes a node type in the cluster, each node type represents sub set of nodes in the cluster. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The name of the node type. - :type name: str - :param placement_properties: The placement tags applied to nodes in the node type, which can be - used to indicate where certain services (workload) should run. - :type placement_properties: dict[str, str] - :param capacities: The capacity tags applied to the nodes in the node type, the cluster - resource manager uses these tags to understand how much resource a node has. - :type capacities: dict[str, str] - :param client_connection_endpoint_port: Required. The TCP cluster management endpoint port. - :type client_connection_endpoint_port: int - :param http_gateway_endpoint_port: Required. The HTTP cluster management endpoint port. - :type http_gateway_endpoint_port: int - :param durability_level: The durability level of the node type. Learn about `DurabilityLevel - `_. - - - * Bronze - No privileges. This is the default. - * Silver - The infrastructure jobs can be paused for a duration of 10 minutes per UD. - * Gold - The infrastructure jobs can be paused for a duration of 2 hours per UD. Gold - durability can be enabled only on full node VM skus like D15_V2, G5 etc. Possible values - include: "Bronze", "Silver", "Gold". - :type durability_level: str or ~azure.mgmt.servicefabric.models.DurabilityLevel - :param application_ports: The range of ports from which cluster assigned port to Service Fabric - applications. - :type application_ports: ~azure.mgmt.servicefabric.models.EndpointRangeDescription - :param ephemeral_ports: The range of ephemeral ports that nodes in this node type should be - configured with. - :type ephemeral_ports: ~azure.mgmt.servicefabric.models.EndpointRangeDescription - :param is_primary: Required. The node type on which system services will run. Only one node - type should be marked as primary. Primary node type cannot be deleted or changed for existing - clusters. - :type is_primary: bool - :param vm_instance_count: Required. VMInstanceCount should be 1 to n, where n indicates the - number of VM instances corresponding to this nodeType. VMInstanceCount = 0 can be done only in - these scenarios: NodeType is a secondary nodeType. Durability = Bronze or Durability >= Bronze - and InfrastructureServiceManager = true. If VMInstanceCount = 0, implies the VMs for this - nodeType will not be used for the initial cluster size computation. - :type vm_instance_count: int - :param reverse_proxy_endpoint_port: The endpoint used by reverse proxy. - :type reverse_proxy_endpoint_port: int - :param is_stateless: Indicates if the node type can only host Stateless workloads. - :type is_stateless: bool - :param multiple_availability_zones: Indicates if the node type is enabled to support multiple - zones. - :type multiple_availability_zones: bool - """ - - _validation = { - 'name': {'required': True}, - 'client_connection_endpoint_port': {'required': True}, - 'http_gateway_endpoint_port': {'required': True}, - 'is_primary': {'required': True}, - 'vm_instance_count': {'required': True, 'maximum': 2147483647, 'minimum': 0}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'placement_properties': {'key': 'placementProperties', 'type': '{str}'}, - 'capacities': {'key': 'capacities', 'type': '{str}'}, - 'client_connection_endpoint_port': {'key': 'clientConnectionEndpointPort', 'type': 'int'}, - 'http_gateway_endpoint_port': {'key': 'httpGatewayEndpointPort', 'type': 'int'}, - 'durability_level': {'key': 'durabilityLevel', 'type': 'str'}, - 'application_ports': {'key': 'applicationPorts', 'type': 'EndpointRangeDescription'}, - 'ephemeral_ports': {'key': 'ephemeralPorts', 'type': 'EndpointRangeDescription'}, - 'is_primary': {'key': 'isPrimary', 'type': 'bool'}, - 'vm_instance_count': {'key': 'vmInstanceCount', 'type': 'int'}, - 'reverse_proxy_endpoint_port': {'key': 'reverseProxyEndpointPort', 'type': 'int'}, - 'is_stateless': {'key': 'isStateless', 'type': 'bool'}, - 'multiple_availability_zones': {'key': 'multipleAvailabilityZones', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(NodeTypeDescription, self).__init__(**kwargs) - self.name = kwargs['name'] - self.placement_properties = kwargs.get('placement_properties', None) - self.capacities = kwargs.get('capacities', None) - self.client_connection_endpoint_port = kwargs['client_connection_endpoint_port'] - self.http_gateway_endpoint_port = kwargs['http_gateway_endpoint_port'] - self.durability_level = kwargs.get('durability_level', None) - self.application_ports = kwargs.get('application_ports', None) - self.ephemeral_ports = kwargs.get('ephemeral_ports', None) - self.is_primary = kwargs['is_primary'] - self.vm_instance_count = kwargs['vm_instance_count'] - self.reverse_proxy_endpoint_port = kwargs.get('reverse_proxy_endpoint_port', None) - self.is_stateless = kwargs.get('is_stateless', None) - self.multiple_availability_zones = kwargs.get('multiple_availability_zones', None) - - -class Notification(msrest.serialization.Model): - """Describes the notification channel for cluster events. - - All required parameters must be populated in order to send to Azure. - - :param is_enabled: Required. Indicates if the notification is enabled. - :type is_enabled: bool - :param notification_category: Required. The category of notification. Possible values include: - "WaveProgress". - :type notification_category: str or ~azure.mgmt.servicefabric.models.NotificationCategory - :param notification_level: Required. The level of notification. Possible values include: - "Critical", "All". - :type notification_level: str or ~azure.mgmt.servicefabric.models.NotificationLevel - :param notification_targets: Required. List of targets that subscribe to the notification. - :type notification_targets: list[~azure.mgmt.servicefabric.models.NotificationTarget] - """ - - _validation = { - 'is_enabled': {'required': True}, - 'notification_category': {'required': True}, - 'notification_level': {'required': True}, - 'notification_targets': {'required': True}, - } - - _attribute_map = { - 'is_enabled': {'key': 'isEnabled', 'type': 'bool'}, - 'notification_category': {'key': 'notificationCategory', 'type': 'str'}, - 'notification_level': {'key': 'notificationLevel', 'type': 'str'}, - 'notification_targets': {'key': 'notificationTargets', 'type': '[NotificationTarget]'}, - } - - def __init__( - self, - **kwargs - ): - super(Notification, self).__init__(**kwargs) - self.is_enabled = kwargs['is_enabled'] - self.notification_category = kwargs['notification_category'] - self.notification_level = kwargs['notification_level'] - self.notification_targets = kwargs['notification_targets'] - - -class NotificationTarget(msrest.serialization.Model): - """Describes the notification target properties. - - All required parameters must be populated in order to send to Azure. - - :param notification_channel: Required. The notification channel indicates the type of receivers - subscribed to the notification, either user or subscription. Possible values include: - "EmailUser", "EmailSubscription". - :type notification_channel: str or ~azure.mgmt.servicefabric.models.NotificationChannel - :param receivers: Required. List of targets that subscribe to the notification. - :type receivers: list[str] - """ - - _validation = { - 'notification_channel': {'required': True}, - 'receivers': {'required': True}, - } - - _attribute_map = { - 'notification_channel': {'key': 'notificationChannel', 'type': 'str'}, - 'receivers': {'key': 'receivers', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(NotificationTarget, self).__init__(**kwargs) - self.notification_channel = kwargs['notification_channel'] - self.receivers = kwargs['receivers'] - - -class OperationListResult(msrest.serialization.Model): - """Describes the result of the request to list Service Fabric resource provider operations. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param value: List of operations supported by the Service Fabric resource provider. - :type value: list[~azure.mgmt.servicefabric.models.OperationResult] - :ivar next_link: URL to get the next set of operation list results if there are any. - :vartype next_link: str - """ - - _validation = { - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[OperationResult]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = None - - -class OperationResult(msrest.serialization.Model): - """Available operation list result. - - :param name: The name of the operation. - :type name: str - :param is_data_action: Indicates whether the operation is a data action. - :type is_data_action: bool - :param display: The object that represents the operation. - :type display: ~azure.mgmt.servicefabric.models.AvailableOperationDisplay - :param origin: Origin result. - :type origin: str - :param next_link: The URL to use for getting the next set of results. - :type next_link: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, - 'display': {'key': 'display', 'type': 'AvailableOperationDisplay'}, - 'origin': {'key': 'origin', 'type': 'str'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationResult, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.is_data_action = kwargs.get('is_data_action', None) - self.display = kwargs.get('display', None) - self.origin = kwargs.get('origin', None) - self.next_link = kwargs.get('next_link', None) - - -class ServerCertificateCommonName(msrest.serialization.Model): - """Describes the server certificate details using common name. - - All required parameters must be populated in order to send to Azure. - - :param certificate_common_name: Required. The common name of the server certificate. - :type certificate_common_name: str - :param certificate_issuer_thumbprint: Required. The issuer thumbprint of the server - certificate. - :type certificate_issuer_thumbprint: str - """ - - _validation = { - 'certificate_common_name': {'required': True}, - 'certificate_issuer_thumbprint': {'required': True}, - } - - _attribute_map = { - 'certificate_common_name': {'key': 'certificateCommonName', 'type': 'str'}, - 'certificate_issuer_thumbprint': {'key': 'certificateIssuerThumbprint', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ServerCertificateCommonName, self).__init__(**kwargs) - self.certificate_common_name = kwargs['certificate_common_name'] - self.certificate_issuer_thumbprint = kwargs['certificate_issuer_thumbprint'] - - -class ServerCertificateCommonNames(msrest.serialization.Model): - """Describes a list of server certificates referenced by common name that are used to secure the cluster. - - :param common_names: The list of server certificates referenced by common name that are used to - secure the cluster. - :type common_names: list[~azure.mgmt.servicefabric.models.ServerCertificateCommonName] - :param x509_store_name: The local certificate store location. Possible values include: - "AddressBook", "AuthRoot", "CertificateAuthority", "Disallowed", "My", "Root", "TrustedPeople", - "TrustedPublisher". - :type x509_store_name: str or ~azure.mgmt.servicefabric.models.StoreName - """ - - _attribute_map = { - 'common_names': {'key': 'commonNames', 'type': '[ServerCertificateCommonName]'}, - 'x509_store_name': {'key': 'x509StoreName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ServerCertificateCommonNames, self).__init__(**kwargs) - self.common_names = kwargs.get('common_names', None) - self.x509_store_name = kwargs.get('x509_store_name', None) - - -class ServiceCorrelationDescription(msrest.serialization.Model): - """Creates a particular correlation between services. - - All required parameters must be populated in order to send to Azure. - - :param scheme: Required. The ServiceCorrelationScheme which describes the relationship between - this service and the service specified via ServiceName. Possible values include: "Invalid", - "Affinity", "AlignedAffinity", "NonAlignedAffinity". - :type scheme: str or ~azure.mgmt.servicefabric.models.ServiceCorrelationScheme - :param service_name: Required. The name of the service that the correlation relationship is - established with. - :type service_name: str - """ - - _validation = { - 'scheme': {'required': True}, - 'service_name': {'required': True}, - } - - _attribute_map = { - 'scheme': {'key': 'scheme', 'type': 'str'}, - 'service_name': {'key': 'serviceName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ServiceCorrelationDescription, self).__init__(**kwargs) - self.scheme = kwargs['scheme'] - self.service_name = kwargs['service_name'] - - -class ServiceLoadMetricDescription(msrest.serialization.Model): - """Specifies a metric to load balance a service during runtime. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The name of the metric. If the service chooses to report load during - runtime, the load metric name should match the name that is specified in Name exactly. Note - that metric names are case sensitive. - :type name: str - :param weight: The service load metric relative weight, compared to other metrics configured - for this service, as a number. Possible values include: "Zero", "Low", "Medium", "High". - :type weight: str or ~azure.mgmt.servicefabric.models.ServiceLoadMetricWeight - :param primary_default_load: Used only for Stateful services. The default amount of load, as a - number, that this service creates for this metric when it is a Primary replica. - :type primary_default_load: int - :param secondary_default_load: Used only for Stateful services. The default amount of load, as - a number, that this service creates for this metric when it is a Secondary replica. - :type secondary_default_load: int - :param default_load: Used only for Stateless services. The default amount of load, as a number, - that this service creates for this metric. - :type default_load: int - """ - - _validation = { - 'name': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'weight': {'key': 'weight', 'type': 'str'}, - 'primary_default_load': {'key': 'primaryDefaultLoad', 'type': 'int'}, - 'secondary_default_load': {'key': 'secondaryDefaultLoad', 'type': 'int'}, - 'default_load': {'key': 'defaultLoad', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(ServiceLoadMetricDescription, self).__init__(**kwargs) - self.name = kwargs['name'] - self.weight = kwargs.get('weight', None) - self.primary_default_load = kwargs.get('primary_default_load', None) - self.secondary_default_load = kwargs.get('secondary_default_load', None) - self.default_load = kwargs.get('default_load', None) - - -class ServicePlacementPolicyDescription(msrest.serialization.Model): - """Describes the policy to be used for placement of a Service Fabric service. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: . - - All required parameters must be populated in order to send to Azure. - - :param type: Required. The type of placement policy for a service fabric service. Following are - the possible values.Constant filled by server. Possible values include: "Invalid", - "InvalidDomain", "RequiredDomain", "PreferredPrimaryDomain", "RequiredDomainDistribution", - "NonPartiallyPlaceService". - :type type: str or ~azure.mgmt.servicefabric.models.ServicePlacementPolicyType - """ - - _validation = { - 'type': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - } - - _subtype_map = { - 'type': {} - } - - def __init__( - self, - **kwargs - ): - super(ServicePlacementPolicyDescription, self).__init__(**kwargs) - self.type = None # type: Optional[str] - - -class ServiceResource(ProxyResource): - """The service resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Azure resource identifier. - :vartype id: str - :ivar name: Azure resource name. - :vartype name: str - :ivar type: Azure resource type. - :vartype type: str - :param location: It will be deprecated in New API, resource location depends on the parent - resource. - :type location: str - :param tags: A set of tags. Azure resource tags. - :type tags: dict[str, str] - :ivar etag: Azure resource etag. - :vartype etag: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.servicefabric.models.SystemData - :param placement_constraints: The placement constraints as a string. Placement constraints are - boolean expressions on node properties and allow for restricting a service to particular nodes - based on the service requirements. For example, to place a service on nodes where NodeType is - blue specify the following: "NodeColor == blue)". - :type placement_constraints: str - :param correlation_scheme: A list that describes the correlation of the service with other - services. - :type correlation_scheme: list[~azure.mgmt.servicefabric.models.ServiceCorrelationDescription] - :param service_load_metrics: The service load metrics is given as an array of - ServiceLoadMetricDescription objects. - :type service_load_metrics: list[~azure.mgmt.servicefabric.models.ServiceLoadMetricDescription] - :param service_placement_policies: A list that describes the correlation of the service with - other services. - :type service_placement_policies: - list[~azure.mgmt.servicefabric.models.ServicePlacementPolicyDescription] - :param default_move_cost: Specifies the move cost for the service. Possible values include: - "Zero", "Low", "Medium", "High". - :type default_move_cost: str or ~azure.mgmt.servicefabric.models.MoveCost - :ivar provisioning_state: The current deployment or provisioning state, which only appears in - the response. - :vartype provisioning_state: str - :param service_kind: The kind of service (Stateless or Stateful).Constant filled by server. - Possible values include: "Invalid", "Stateless", "Stateful". - :type service_kind: str or ~azure.mgmt.servicefabric.models.ServiceKind - :param service_type_name: The name of the service type. - :type service_type_name: str - :param partition_description: Describes how the service is partitioned. - :type partition_description: ~azure.mgmt.servicefabric.models.PartitionSchemeDescription - :param service_package_activation_mode: The activation Mode of the service package. Possible - values include: "SharedProcess", "ExclusiveProcess". - :type service_package_activation_mode: str or - ~azure.mgmt.servicefabric.models.ArmServicePackageActivationMode - :param service_dns_name: Dns name used for the service. If this is specified, then the service - can be accessed via its DNS name instead of service name. - :type service_dns_name: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'etag': {'readonly': True}, - 'system_data': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'placement_constraints': {'key': 'properties.placementConstraints', 'type': 'str'}, - 'correlation_scheme': {'key': 'properties.correlationScheme', 'type': '[ServiceCorrelationDescription]'}, - 'service_load_metrics': {'key': 'properties.serviceLoadMetrics', 'type': '[ServiceLoadMetricDescription]'}, - 'service_placement_policies': {'key': 'properties.servicePlacementPolicies', 'type': '[ServicePlacementPolicyDescription]'}, - 'default_move_cost': {'key': 'properties.defaultMoveCost', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'service_kind': {'key': 'properties.serviceKind', 'type': 'str'}, - 'service_type_name': {'key': 'properties.serviceTypeName', 'type': 'str'}, - 'partition_description': {'key': 'properties.partitionDescription', 'type': 'PartitionSchemeDescription'}, - 'service_package_activation_mode': {'key': 'properties.servicePackageActivationMode', 'type': 'str'}, - 'service_dns_name': {'key': 'properties.serviceDnsName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ServiceResource, self).__init__(**kwargs) - self.placement_constraints = kwargs.get('placement_constraints', None) - self.correlation_scheme = kwargs.get('correlation_scheme', None) - self.service_load_metrics = kwargs.get('service_load_metrics', None) - self.service_placement_policies = kwargs.get('service_placement_policies', None) - self.default_move_cost = kwargs.get('default_move_cost', None) - self.provisioning_state = None - self.service_kind = None # type: Optional[str] - self.service_type_name = kwargs.get('service_type_name', None) - self.partition_description = kwargs.get('partition_description', None) - self.service_package_activation_mode = kwargs.get('service_package_activation_mode', None) - self.service_dns_name = kwargs.get('service_dns_name', None) - - -class ServiceResourceList(msrest.serialization.Model): - """The list of service resources. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param value: - :type value: list[~azure.mgmt.servicefabric.models.ServiceResource] - :ivar next_link: URL to get the next set of service list results if there are any. - :vartype next_link: str - """ - - _validation = { - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ServiceResource]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ServiceResourceList, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = None - - -class ServiceResourcePropertiesBase(msrest.serialization.Model): - """The common service resource properties. - - :param placement_constraints: The placement constraints as a string. Placement constraints are - boolean expressions on node properties and allow for restricting a service to particular nodes - based on the service requirements. For example, to place a service on nodes where NodeType is - blue specify the following: "NodeColor == blue)". - :type placement_constraints: str - :param correlation_scheme: A list that describes the correlation of the service with other - services. - :type correlation_scheme: list[~azure.mgmt.servicefabric.models.ServiceCorrelationDescription] - :param service_load_metrics: The service load metrics is given as an array of - ServiceLoadMetricDescription objects. - :type service_load_metrics: list[~azure.mgmt.servicefabric.models.ServiceLoadMetricDescription] - :param service_placement_policies: A list that describes the correlation of the service with - other services. - :type service_placement_policies: - list[~azure.mgmt.servicefabric.models.ServicePlacementPolicyDescription] - :param default_move_cost: Specifies the move cost for the service. Possible values include: - "Zero", "Low", "Medium", "High". - :type default_move_cost: str or ~azure.mgmt.servicefabric.models.MoveCost - """ - - _attribute_map = { - 'placement_constraints': {'key': 'placementConstraints', 'type': 'str'}, - 'correlation_scheme': {'key': 'correlationScheme', 'type': '[ServiceCorrelationDescription]'}, - 'service_load_metrics': {'key': 'serviceLoadMetrics', 'type': '[ServiceLoadMetricDescription]'}, - 'service_placement_policies': {'key': 'servicePlacementPolicies', 'type': '[ServicePlacementPolicyDescription]'}, - 'default_move_cost': {'key': 'defaultMoveCost', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ServiceResourcePropertiesBase, self).__init__(**kwargs) - self.placement_constraints = kwargs.get('placement_constraints', None) - self.correlation_scheme = kwargs.get('correlation_scheme', None) - self.service_load_metrics = kwargs.get('service_load_metrics', None) - self.service_placement_policies = kwargs.get('service_placement_policies', None) - self.default_move_cost = kwargs.get('default_move_cost', None) - - -class ServiceResourceProperties(ServiceResourcePropertiesBase): - """The service resource properties. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: StatefulServiceProperties, StatelessServiceProperties. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param placement_constraints: The placement constraints as a string. Placement constraints are - boolean expressions on node properties and allow for restricting a service to particular nodes - based on the service requirements. For example, to place a service on nodes where NodeType is - blue specify the following: "NodeColor == blue)". - :type placement_constraints: str - :param correlation_scheme: A list that describes the correlation of the service with other - services. - :type correlation_scheme: list[~azure.mgmt.servicefabric.models.ServiceCorrelationDescription] - :param service_load_metrics: The service load metrics is given as an array of - ServiceLoadMetricDescription objects. - :type service_load_metrics: list[~azure.mgmt.servicefabric.models.ServiceLoadMetricDescription] - :param service_placement_policies: A list that describes the correlation of the service with - other services. - :type service_placement_policies: - list[~azure.mgmt.servicefabric.models.ServicePlacementPolicyDescription] - :param default_move_cost: Specifies the move cost for the service. Possible values include: - "Zero", "Low", "Medium", "High". - :type default_move_cost: str or ~azure.mgmt.servicefabric.models.MoveCost - :ivar provisioning_state: The current deployment or provisioning state, which only appears in - the response. - :vartype provisioning_state: str - :param service_kind: Required. The kind of service (Stateless or Stateful).Constant filled by - server. Possible values include: "Invalid", "Stateless", "Stateful". - :type service_kind: str or ~azure.mgmt.servicefabric.models.ServiceKind - :param service_type_name: The name of the service type. - :type service_type_name: str - :param partition_description: Describes how the service is partitioned. - :type partition_description: ~azure.mgmt.servicefabric.models.PartitionSchemeDescription - :param service_package_activation_mode: The activation Mode of the service package. Possible - values include: "SharedProcess", "ExclusiveProcess". - :type service_package_activation_mode: str or - ~azure.mgmt.servicefabric.models.ArmServicePackageActivationMode - :param service_dns_name: Dns name used for the service. If this is specified, then the service - can be accessed via its DNS name instead of service name. - :type service_dns_name: str - """ - - _validation = { - 'provisioning_state': {'readonly': True}, - 'service_kind': {'required': True}, - } - - _attribute_map = { - 'placement_constraints': {'key': 'placementConstraints', 'type': 'str'}, - 'correlation_scheme': {'key': 'correlationScheme', 'type': '[ServiceCorrelationDescription]'}, - 'service_load_metrics': {'key': 'serviceLoadMetrics', 'type': '[ServiceLoadMetricDescription]'}, - 'service_placement_policies': {'key': 'servicePlacementPolicies', 'type': '[ServicePlacementPolicyDescription]'}, - 'default_move_cost': {'key': 'defaultMoveCost', 'type': 'str'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'service_kind': {'key': 'serviceKind', 'type': 'str'}, - 'service_type_name': {'key': 'serviceTypeName', 'type': 'str'}, - 'partition_description': {'key': 'partitionDescription', 'type': 'PartitionSchemeDescription'}, - 'service_package_activation_mode': {'key': 'servicePackageActivationMode', 'type': 'str'}, - 'service_dns_name': {'key': 'serviceDnsName', 'type': 'str'}, - } - - _subtype_map = { - 'service_kind': {'Stateful': 'StatefulServiceProperties', 'Stateless': 'StatelessServiceProperties'} - } - - def __init__( - self, - **kwargs - ): - super(ServiceResourceProperties, self).__init__(**kwargs) - self.provisioning_state = None - self.service_kind = 'ServiceResourceProperties' # type: str - self.service_type_name = kwargs.get('service_type_name', None) - self.partition_description = kwargs.get('partition_description', None) - self.service_package_activation_mode = kwargs.get('service_package_activation_mode', None) - self.service_dns_name = kwargs.get('service_dns_name', None) - - -class ServiceResourceUpdate(ProxyResource): - """The service resource for patch operations. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Azure resource identifier. - :vartype id: str - :ivar name: Azure resource name. - :vartype name: str - :ivar type: Azure resource type. - :vartype type: str - :param location: It will be deprecated in New API, resource location depends on the parent - resource. - :type location: str - :param tags: A set of tags. Azure resource tags. - :type tags: dict[str, str] - :ivar etag: Azure resource etag. - :vartype etag: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.servicefabric.models.SystemData - :param placement_constraints: The placement constraints as a string. Placement constraints are - boolean expressions on node properties and allow for restricting a service to particular nodes - based on the service requirements. For example, to place a service on nodes where NodeType is - blue specify the following: "NodeColor == blue)". - :type placement_constraints: str - :param correlation_scheme: A list that describes the correlation of the service with other - services. - :type correlation_scheme: list[~azure.mgmt.servicefabric.models.ServiceCorrelationDescription] - :param service_load_metrics: The service load metrics is given as an array of - ServiceLoadMetricDescription objects. - :type service_load_metrics: list[~azure.mgmt.servicefabric.models.ServiceLoadMetricDescription] - :param service_placement_policies: A list that describes the correlation of the service with - other services. - :type service_placement_policies: - list[~azure.mgmt.servicefabric.models.ServicePlacementPolicyDescription] - :param default_move_cost: Specifies the move cost for the service. Possible values include: - "Zero", "Low", "Medium", "High". - :type default_move_cost: str or ~azure.mgmt.servicefabric.models.MoveCost - :param service_kind: The kind of service (Stateless or Stateful).Constant filled by server. - Possible values include: "Invalid", "Stateless", "Stateful". - :type service_kind: str or ~azure.mgmt.servicefabric.models.ServiceKind - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'etag': {'readonly': True}, - 'system_data': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'placement_constraints': {'key': 'properties.placementConstraints', 'type': 'str'}, - 'correlation_scheme': {'key': 'properties.correlationScheme', 'type': '[ServiceCorrelationDescription]'}, - 'service_load_metrics': {'key': 'properties.serviceLoadMetrics', 'type': '[ServiceLoadMetricDescription]'}, - 'service_placement_policies': {'key': 'properties.servicePlacementPolicies', 'type': '[ServicePlacementPolicyDescription]'}, - 'default_move_cost': {'key': 'properties.defaultMoveCost', 'type': 'str'}, - 'service_kind': {'key': 'properties.serviceKind', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ServiceResourceUpdate, self).__init__(**kwargs) - self.placement_constraints = kwargs.get('placement_constraints', None) - self.correlation_scheme = kwargs.get('correlation_scheme', None) - self.service_load_metrics = kwargs.get('service_load_metrics', None) - self.service_placement_policies = kwargs.get('service_placement_policies', None) - self.default_move_cost = kwargs.get('default_move_cost', None) - self.service_kind = None # type: Optional[str] - - -class ServiceResourceUpdateProperties(ServiceResourcePropertiesBase): - """The service resource properties for patch operations. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: StatefulServiceUpdateProperties, StatelessServiceUpdateProperties. - - All required parameters must be populated in order to send to Azure. - - :param placement_constraints: The placement constraints as a string. Placement constraints are - boolean expressions on node properties and allow for restricting a service to particular nodes - based on the service requirements. For example, to place a service on nodes where NodeType is - blue specify the following: "NodeColor == blue)". - :type placement_constraints: str - :param correlation_scheme: A list that describes the correlation of the service with other - services. - :type correlation_scheme: list[~azure.mgmt.servicefabric.models.ServiceCorrelationDescription] - :param service_load_metrics: The service load metrics is given as an array of - ServiceLoadMetricDescription objects. - :type service_load_metrics: list[~azure.mgmt.servicefabric.models.ServiceLoadMetricDescription] - :param service_placement_policies: A list that describes the correlation of the service with - other services. - :type service_placement_policies: - list[~azure.mgmt.servicefabric.models.ServicePlacementPolicyDescription] - :param default_move_cost: Specifies the move cost for the service. Possible values include: - "Zero", "Low", "Medium", "High". - :type default_move_cost: str or ~azure.mgmt.servicefabric.models.MoveCost - :param service_kind: Required. The kind of service (Stateless or Stateful).Constant filled by - server. Possible values include: "Invalid", "Stateless", "Stateful". - :type service_kind: str or ~azure.mgmt.servicefabric.models.ServiceKind - """ - - _validation = { - 'service_kind': {'required': True}, - } - - _attribute_map = { - 'placement_constraints': {'key': 'placementConstraints', 'type': 'str'}, - 'correlation_scheme': {'key': 'correlationScheme', 'type': '[ServiceCorrelationDescription]'}, - 'service_load_metrics': {'key': 'serviceLoadMetrics', 'type': '[ServiceLoadMetricDescription]'}, - 'service_placement_policies': {'key': 'servicePlacementPolicies', 'type': '[ServicePlacementPolicyDescription]'}, - 'default_move_cost': {'key': 'defaultMoveCost', 'type': 'str'}, - 'service_kind': {'key': 'serviceKind', 'type': 'str'}, - } - - _subtype_map = { - 'service_kind': {'Stateful': 'StatefulServiceUpdateProperties', 'Stateless': 'StatelessServiceUpdateProperties'} - } - - def __init__( - self, - **kwargs - ): - super(ServiceResourceUpdateProperties, self).__init__(**kwargs) - self.service_kind = 'ServiceResourceUpdateProperties' # type: str - - -class ServiceTypeDeltaHealthPolicy(msrest.serialization.Model): - """Represents the delta health policy used to evaluate the health of services belonging to a service type when upgrading the cluster. - - :param max_percent_delta_unhealthy_services: The maximum allowed percentage of services health - degradation allowed during cluster upgrades. - The delta is measured between the state of the services at the beginning of upgrade and the - state of the services at the time of the health evaluation. - The check is performed after every upgrade domain upgrade completion to make sure the global - state of the cluster is within tolerated limits. - :type max_percent_delta_unhealthy_services: int - """ - - _validation = { - 'max_percent_delta_unhealthy_services': {'maximum': 100, 'minimum': 0}, - } - - _attribute_map = { - 'max_percent_delta_unhealthy_services': {'key': 'maxPercentDeltaUnhealthyServices', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(ServiceTypeDeltaHealthPolicy, self).__init__(**kwargs) - self.max_percent_delta_unhealthy_services = kwargs.get('max_percent_delta_unhealthy_services', 0) - - -class ServiceTypeHealthPolicy(msrest.serialization.Model): - """Represents the health policy used to evaluate the health of services belonging to a service type. - - :param max_percent_unhealthy_services: The maximum percentage of services allowed to be - unhealthy before your application is considered in error. - :type max_percent_unhealthy_services: int - """ - - _validation = { - 'max_percent_unhealthy_services': {'maximum': 100, 'minimum': 0}, - } - - _attribute_map = { - 'max_percent_unhealthy_services': {'key': 'maxPercentUnhealthyServices', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(ServiceTypeHealthPolicy, self).__init__(**kwargs) - self.max_percent_unhealthy_services = kwargs.get('max_percent_unhealthy_services', 0) - - -class SettingsParameterDescription(msrest.serialization.Model): - """Describes a parameter in fabric settings of the cluster. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The parameter name of fabric setting. - :type name: str - :param value: Required. The parameter value of fabric setting. - :type value: str - """ - - _validation = { - 'name': {'required': True}, - 'value': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SettingsParameterDescription, self).__init__(**kwargs) - self.name = kwargs['name'] - self.value = kwargs['value'] - - -class SettingsSectionDescription(msrest.serialization.Model): - """Describes a section in the fabric settings of the cluster. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The section name of the fabric settings. - :type name: str - :param parameters: Required. The collection of parameters in the section. - :type parameters: list[~azure.mgmt.servicefabric.models.SettingsParameterDescription] - """ - - _validation = { - 'name': {'required': True}, - 'parameters': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'parameters': {'key': 'parameters', 'type': '[SettingsParameterDescription]'}, - } - - def __init__( - self, - **kwargs - ): - super(SettingsSectionDescription, self).__init__(**kwargs) - self.name = kwargs['name'] - self.parameters = kwargs['parameters'] - - -class SingletonPartitionSchemeDescription(PartitionSchemeDescription): - """SingletonPartitionSchemeDescription. - - All required parameters must be populated in order to send to Azure. - - :param partition_scheme: Required. Specifies how the service is partitioned.Constant filled by - server. Possible values include: "Invalid", "Singleton", "UniformInt64Range", "Named". - :type partition_scheme: str or ~azure.mgmt.servicefabric.models.PartitionScheme - """ - - _validation = { - 'partition_scheme': {'required': True}, - } - - _attribute_map = { - 'partition_scheme': {'key': 'partitionScheme', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SingletonPartitionSchemeDescription, self).__init__(**kwargs) - self.partition_scheme = 'Singleton' # type: str - - -class StatefulServiceProperties(ServiceResourceProperties): - """The properties of a stateful service resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param placement_constraints: The placement constraints as a string. Placement constraints are - boolean expressions on node properties and allow for restricting a service to particular nodes - based on the service requirements. For example, to place a service on nodes where NodeType is - blue specify the following: "NodeColor == blue)". - :type placement_constraints: str - :param correlation_scheme: A list that describes the correlation of the service with other - services. - :type correlation_scheme: list[~azure.mgmt.servicefabric.models.ServiceCorrelationDescription] - :param service_load_metrics: The service load metrics is given as an array of - ServiceLoadMetricDescription objects. - :type service_load_metrics: list[~azure.mgmt.servicefabric.models.ServiceLoadMetricDescription] - :param service_placement_policies: A list that describes the correlation of the service with - other services. - :type service_placement_policies: - list[~azure.mgmt.servicefabric.models.ServicePlacementPolicyDescription] - :param default_move_cost: Specifies the move cost for the service. Possible values include: - "Zero", "Low", "Medium", "High". - :type default_move_cost: str or ~azure.mgmt.servicefabric.models.MoveCost - :ivar provisioning_state: The current deployment or provisioning state, which only appears in - the response. - :vartype provisioning_state: str - :param service_kind: Required. The kind of service (Stateless or Stateful).Constant filled by - server. Possible values include: "Invalid", "Stateless", "Stateful". - :type service_kind: str or ~azure.mgmt.servicefabric.models.ServiceKind - :param service_type_name: The name of the service type. - :type service_type_name: str - :param partition_description: Describes how the service is partitioned. - :type partition_description: ~azure.mgmt.servicefabric.models.PartitionSchemeDescription - :param service_package_activation_mode: The activation Mode of the service package. Possible - values include: "SharedProcess", "ExclusiveProcess". - :type service_package_activation_mode: str or - ~azure.mgmt.servicefabric.models.ArmServicePackageActivationMode - :param service_dns_name: Dns name used for the service. If this is specified, then the service - can be accessed via its DNS name instead of service name. - :type service_dns_name: str - :param has_persisted_state: A flag indicating whether this is a persistent service which stores - states on the local disk. If it is then the value of this property is true, if not it is false. - :type has_persisted_state: bool - :param target_replica_set_size: The target replica set size as a number. - :type target_replica_set_size: int - :param min_replica_set_size: The minimum replica set size as a number. - :type min_replica_set_size: int - :param replica_restart_wait_duration: The duration between when a replica goes down and when a - new replica is created, represented in ISO 8601 format (hh:mm:ss.s). - :type replica_restart_wait_duration: ~datetime.datetime - :param quorum_loss_wait_duration: The maximum duration for which a partition is allowed to be - in a state of quorum loss, represented in ISO 8601 format (hh:mm:ss.s). - :type quorum_loss_wait_duration: ~datetime.datetime - :param stand_by_replica_keep_duration: The definition on how long StandBy replicas should be - maintained before being removed, represented in ISO 8601 format (hh:mm:ss.s). - :type stand_by_replica_keep_duration: ~datetime.datetime - """ - - _validation = { - 'provisioning_state': {'readonly': True}, - 'service_kind': {'required': True}, - 'target_replica_set_size': {'minimum': 1}, - 'min_replica_set_size': {'minimum': 1}, - } - - _attribute_map = { - 'placement_constraints': {'key': 'placementConstraints', 'type': 'str'}, - 'correlation_scheme': {'key': 'correlationScheme', 'type': '[ServiceCorrelationDescription]'}, - 'service_load_metrics': {'key': 'serviceLoadMetrics', 'type': '[ServiceLoadMetricDescription]'}, - 'service_placement_policies': {'key': 'servicePlacementPolicies', 'type': '[ServicePlacementPolicyDescription]'}, - 'default_move_cost': {'key': 'defaultMoveCost', 'type': 'str'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'service_kind': {'key': 'serviceKind', 'type': 'str'}, - 'service_type_name': {'key': 'serviceTypeName', 'type': 'str'}, - 'partition_description': {'key': 'partitionDescription', 'type': 'PartitionSchemeDescription'}, - 'service_package_activation_mode': {'key': 'servicePackageActivationMode', 'type': 'str'}, - 'service_dns_name': {'key': 'serviceDnsName', 'type': 'str'}, - 'has_persisted_state': {'key': 'hasPersistedState', 'type': 'bool'}, - 'target_replica_set_size': {'key': 'targetReplicaSetSize', 'type': 'int'}, - 'min_replica_set_size': {'key': 'minReplicaSetSize', 'type': 'int'}, - 'replica_restart_wait_duration': {'key': 'replicaRestartWaitDuration', 'type': 'iso-8601'}, - 'quorum_loss_wait_duration': {'key': 'quorumLossWaitDuration', 'type': 'iso-8601'}, - 'stand_by_replica_keep_duration': {'key': 'standByReplicaKeepDuration', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(StatefulServiceProperties, self).__init__(**kwargs) - self.service_kind = 'Stateful' # type: str - self.has_persisted_state = kwargs.get('has_persisted_state', None) - self.target_replica_set_size = kwargs.get('target_replica_set_size', None) - self.min_replica_set_size = kwargs.get('min_replica_set_size', None) - self.replica_restart_wait_duration = kwargs.get('replica_restart_wait_duration', None) - self.quorum_loss_wait_duration = kwargs.get('quorum_loss_wait_duration', None) - self.stand_by_replica_keep_duration = kwargs.get('stand_by_replica_keep_duration', None) - - -class StatefulServiceUpdateProperties(ServiceResourceUpdateProperties): - """The properties of a stateful service resource for patch operations. - - All required parameters must be populated in order to send to Azure. - - :param placement_constraints: The placement constraints as a string. Placement constraints are - boolean expressions on node properties and allow for restricting a service to particular nodes - based on the service requirements. For example, to place a service on nodes where NodeType is - blue specify the following: "NodeColor == blue)". - :type placement_constraints: str - :param correlation_scheme: A list that describes the correlation of the service with other - services. - :type correlation_scheme: list[~azure.mgmt.servicefabric.models.ServiceCorrelationDescription] - :param service_load_metrics: The service load metrics is given as an array of - ServiceLoadMetricDescription objects. - :type service_load_metrics: list[~azure.mgmt.servicefabric.models.ServiceLoadMetricDescription] - :param service_placement_policies: A list that describes the correlation of the service with - other services. - :type service_placement_policies: - list[~azure.mgmt.servicefabric.models.ServicePlacementPolicyDescription] - :param default_move_cost: Specifies the move cost for the service. Possible values include: - "Zero", "Low", "Medium", "High". - :type default_move_cost: str or ~azure.mgmt.servicefabric.models.MoveCost - :param service_kind: Required. The kind of service (Stateless or Stateful).Constant filled by - server. Possible values include: "Invalid", "Stateless", "Stateful". - :type service_kind: str or ~azure.mgmt.servicefabric.models.ServiceKind - :param target_replica_set_size: The target replica set size as a number. - :type target_replica_set_size: int - :param min_replica_set_size: The minimum replica set size as a number. - :type min_replica_set_size: int - :param replica_restart_wait_duration: The duration between when a replica goes down and when a - new replica is created, represented in ISO 8601 format (hh:mm:ss.s). - :type replica_restart_wait_duration: ~datetime.datetime - :param quorum_loss_wait_duration: The maximum duration for which a partition is allowed to be - in a state of quorum loss, represented in ISO 8601 format (hh:mm:ss.s). - :type quorum_loss_wait_duration: ~datetime.datetime - :param stand_by_replica_keep_duration: The definition on how long StandBy replicas should be - maintained before being removed, represented in ISO 8601 format (hh:mm:ss.s). - :type stand_by_replica_keep_duration: ~datetime.datetime - """ - - _validation = { - 'service_kind': {'required': True}, - 'target_replica_set_size': {'minimum': 1}, - 'min_replica_set_size': {'minimum': 1}, - } - - _attribute_map = { - 'placement_constraints': {'key': 'placementConstraints', 'type': 'str'}, - 'correlation_scheme': {'key': 'correlationScheme', 'type': '[ServiceCorrelationDescription]'}, - 'service_load_metrics': {'key': 'serviceLoadMetrics', 'type': '[ServiceLoadMetricDescription]'}, - 'service_placement_policies': {'key': 'servicePlacementPolicies', 'type': '[ServicePlacementPolicyDescription]'}, - 'default_move_cost': {'key': 'defaultMoveCost', 'type': 'str'}, - 'service_kind': {'key': 'serviceKind', 'type': 'str'}, - 'target_replica_set_size': {'key': 'targetReplicaSetSize', 'type': 'int'}, - 'min_replica_set_size': {'key': 'minReplicaSetSize', 'type': 'int'}, - 'replica_restart_wait_duration': {'key': 'replicaRestartWaitDuration', 'type': 'iso-8601'}, - 'quorum_loss_wait_duration': {'key': 'quorumLossWaitDuration', 'type': 'iso-8601'}, - 'stand_by_replica_keep_duration': {'key': 'standByReplicaKeepDuration', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(StatefulServiceUpdateProperties, self).__init__(**kwargs) - self.service_kind = 'Stateful' # type: str - self.target_replica_set_size = kwargs.get('target_replica_set_size', None) - self.min_replica_set_size = kwargs.get('min_replica_set_size', None) - self.replica_restart_wait_duration = kwargs.get('replica_restart_wait_duration', None) - self.quorum_loss_wait_duration = kwargs.get('quorum_loss_wait_duration', None) - self.stand_by_replica_keep_duration = kwargs.get('stand_by_replica_keep_duration', None) - - -class StatelessServiceProperties(ServiceResourceProperties): - """The properties of a stateless service resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param placement_constraints: The placement constraints as a string. Placement constraints are - boolean expressions on node properties and allow for restricting a service to particular nodes - based on the service requirements. For example, to place a service on nodes where NodeType is - blue specify the following: "NodeColor == blue)". - :type placement_constraints: str - :param correlation_scheme: A list that describes the correlation of the service with other - services. - :type correlation_scheme: list[~azure.mgmt.servicefabric.models.ServiceCorrelationDescription] - :param service_load_metrics: The service load metrics is given as an array of - ServiceLoadMetricDescription objects. - :type service_load_metrics: list[~azure.mgmt.servicefabric.models.ServiceLoadMetricDescription] - :param service_placement_policies: A list that describes the correlation of the service with - other services. - :type service_placement_policies: - list[~azure.mgmt.servicefabric.models.ServicePlacementPolicyDescription] - :param default_move_cost: Specifies the move cost for the service. Possible values include: - "Zero", "Low", "Medium", "High". - :type default_move_cost: str or ~azure.mgmt.servicefabric.models.MoveCost - :ivar provisioning_state: The current deployment or provisioning state, which only appears in - the response. - :vartype provisioning_state: str - :param service_kind: Required. The kind of service (Stateless or Stateful).Constant filled by - server. Possible values include: "Invalid", "Stateless", "Stateful". - :type service_kind: str or ~azure.mgmt.servicefabric.models.ServiceKind - :param service_type_name: The name of the service type. - :type service_type_name: str - :param partition_description: Describes how the service is partitioned. - :type partition_description: ~azure.mgmt.servicefabric.models.PartitionSchemeDescription - :param service_package_activation_mode: The activation Mode of the service package. Possible - values include: "SharedProcess", "ExclusiveProcess". - :type service_package_activation_mode: str or - ~azure.mgmt.servicefabric.models.ArmServicePackageActivationMode - :param service_dns_name: Dns name used for the service. If this is specified, then the service - can be accessed via its DNS name instead of service name. - :type service_dns_name: str - :param instance_count: The instance count. - :type instance_count: int - :param instance_close_delay_duration: Delay duration for RequestDrain feature to ensures that - the endpoint advertised by the stateless instance is removed before the delay starts prior to - closing the instance. This delay enables existing requests to drain gracefully before the - instance actually goes down - (https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-application-upgrade-advanced#avoid-connection-drops-during-stateless-service-planned-downtime-preview). - It is first interpreted as a string representing an ISO 8601 duration. If that fails, then it - is interpreted as a number representing the total number of milliseconds. - :type instance_close_delay_duration: str - """ - - _validation = { - 'provisioning_state': {'readonly': True}, - 'service_kind': {'required': True}, - 'instance_count': {'minimum': -1}, - } - - _attribute_map = { - 'placement_constraints': {'key': 'placementConstraints', 'type': 'str'}, - 'correlation_scheme': {'key': 'correlationScheme', 'type': '[ServiceCorrelationDescription]'}, - 'service_load_metrics': {'key': 'serviceLoadMetrics', 'type': '[ServiceLoadMetricDescription]'}, - 'service_placement_policies': {'key': 'servicePlacementPolicies', 'type': '[ServicePlacementPolicyDescription]'}, - 'default_move_cost': {'key': 'defaultMoveCost', 'type': 'str'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'service_kind': {'key': 'serviceKind', 'type': 'str'}, - 'service_type_name': {'key': 'serviceTypeName', 'type': 'str'}, - 'partition_description': {'key': 'partitionDescription', 'type': 'PartitionSchemeDescription'}, - 'service_package_activation_mode': {'key': 'servicePackageActivationMode', 'type': 'str'}, - 'service_dns_name': {'key': 'serviceDnsName', 'type': 'str'}, - 'instance_count': {'key': 'instanceCount', 'type': 'int'}, - 'instance_close_delay_duration': {'key': 'instanceCloseDelayDuration', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(StatelessServiceProperties, self).__init__(**kwargs) - self.service_kind = 'Stateless' # type: str - self.instance_count = kwargs.get('instance_count', None) - self.instance_close_delay_duration = kwargs.get('instance_close_delay_duration', None) - - -class StatelessServiceUpdateProperties(ServiceResourceUpdateProperties): - """The properties of a stateless service resource for patch operations. - - All required parameters must be populated in order to send to Azure. - - :param placement_constraints: The placement constraints as a string. Placement constraints are - boolean expressions on node properties and allow for restricting a service to particular nodes - based on the service requirements. For example, to place a service on nodes where NodeType is - blue specify the following: "NodeColor == blue)". - :type placement_constraints: str - :param correlation_scheme: A list that describes the correlation of the service with other - services. - :type correlation_scheme: list[~azure.mgmt.servicefabric.models.ServiceCorrelationDescription] - :param service_load_metrics: The service load metrics is given as an array of - ServiceLoadMetricDescription objects. - :type service_load_metrics: list[~azure.mgmt.servicefabric.models.ServiceLoadMetricDescription] - :param service_placement_policies: A list that describes the correlation of the service with - other services. - :type service_placement_policies: - list[~azure.mgmt.servicefabric.models.ServicePlacementPolicyDescription] - :param default_move_cost: Specifies the move cost for the service. Possible values include: - "Zero", "Low", "Medium", "High". - :type default_move_cost: str or ~azure.mgmt.servicefabric.models.MoveCost - :param service_kind: Required. The kind of service (Stateless or Stateful).Constant filled by - server. Possible values include: "Invalid", "Stateless", "Stateful". - :type service_kind: str or ~azure.mgmt.servicefabric.models.ServiceKind - :param instance_count: The instance count. - :type instance_count: int - :param instance_close_delay_duration: Delay duration for RequestDrain feature to ensures that - the endpoint advertised by the stateless instance is removed before the delay starts prior to - closing the instance. This delay enables existing requests to drain gracefully before the - instance actually goes down - (https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-application-upgrade-advanced#avoid-connection-drops-during-stateless-service-planned-downtime-preview). - It is first interpreted as a string representing an ISO 8601 duration. If that fails, then it - is interpreted as a number representing the total number of milliseconds. - :type instance_close_delay_duration: str - """ - - _validation = { - 'service_kind': {'required': True}, - 'instance_count': {'minimum': -1}, - } - - _attribute_map = { - 'placement_constraints': {'key': 'placementConstraints', 'type': 'str'}, - 'correlation_scheme': {'key': 'correlationScheme', 'type': '[ServiceCorrelationDescription]'}, - 'service_load_metrics': {'key': 'serviceLoadMetrics', 'type': '[ServiceLoadMetricDescription]'}, - 'service_placement_policies': {'key': 'servicePlacementPolicies', 'type': '[ServicePlacementPolicyDescription]'}, - 'default_move_cost': {'key': 'defaultMoveCost', 'type': 'str'}, - 'service_kind': {'key': 'serviceKind', 'type': 'str'}, - 'instance_count': {'key': 'instanceCount', 'type': 'int'}, - 'instance_close_delay_duration': {'key': 'instanceCloseDelayDuration', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(StatelessServiceUpdateProperties, self).__init__(**kwargs) - self.service_kind = 'Stateless' # type: str - self.instance_count = kwargs.get('instance_count', None) - self.instance_close_delay_duration = kwargs.get('instance_close_delay_duration', None) - - -class SystemData(msrest.serialization.Model): - """Metadata pertaining to creation and last modification of the resource. - - :param created_by: The identity that created the resource. - :type created_by: str - :param created_by_type: The type of identity that created the resource. - :type created_by_type: str - :param created_at: The timestamp of resource creation (UTC). - :type created_at: ~datetime.datetime - :param last_modified_by: The identity that last modified the resource. - :type last_modified_by: str - :param last_modified_by_type: The type of identity that last modified the resource. - :type last_modified_by_type: str - :param last_modified_at: The timestamp of resource last modification (UTC). - :type last_modified_at: ~datetime.datetime - """ - - _attribute_map = { - 'created_by': {'key': 'createdBy', 'type': 'str'}, - 'created_by_type': {'key': 'createdByType', 'type': 'str'}, - 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, - 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, - 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, - 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(SystemData, self).__init__(**kwargs) - self.created_by = kwargs.get('created_by', None) - self.created_by_type = kwargs.get('created_by_type', None) - self.created_at = kwargs.get('created_at', None) - self.last_modified_by = kwargs.get('last_modified_by', None) - self.last_modified_by_type = kwargs.get('last_modified_by_type', None) - self.last_modified_at = kwargs.get('last_modified_at', None) - - -class UniformInt64RangePartitionSchemeDescription(PartitionSchemeDescription): - """Describes a partitioning scheme where an integer range is allocated evenly across a number of partitions. - - All required parameters must be populated in order to send to Azure. - - :param partition_scheme: Required. Specifies how the service is partitioned.Constant filled by - server. Possible values include: "Invalid", "Singleton", "UniformInt64Range", "Named". - :type partition_scheme: str or ~azure.mgmt.servicefabric.models.PartitionScheme - :param count: Required. The number of partitions. - :type count: int - :param low_key: Required. String indicating the lower bound of the partition key range that - should be split between the partition ‘count’. - :type low_key: str - :param high_key: Required. String indicating the upper bound of the partition key range that - should be split between the partition ‘count’. - :type high_key: str - """ - - _validation = { - 'partition_scheme': {'required': True}, - 'count': {'required': True}, - 'low_key': {'required': True}, - 'high_key': {'required': True}, - } - - _attribute_map = { - 'partition_scheme': {'key': 'partitionScheme', 'type': 'str'}, - 'count': {'key': 'count', 'type': 'int'}, - 'low_key': {'key': 'lowKey', 'type': 'str'}, - 'high_key': {'key': 'highKey', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UniformInt64RangePartitionSchemeDescription, self).__init__(**kwargs) - self.partition_scheme = 'UniformInt64Range' # type: str - self.count = kwargs['count'] - self.low_key = kwargs['low_key'] - self.high_key = kwargs['high_key'] - - -class UpgradableVersionPathResult(msrest.serialization.Model): - """The list of intermediate cluster code versions for an upgrade or downgrade. Or minimum and maximum upgradable version if no target was given. - - :param supported_path: - :type supported_path: list[str] - """ - - _attribute_map = { - 'supported_path': {'key': 'supportedPath', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(UpgradableVersionPathResult, self).__init__(**kwargs) - self.supported_path = kwargs.get('supported_path', None) - - -class UpgradableVersionsDescription(msrest.serialization.Model): - """UpgradableVersionsDescription. - - All required parameters must be populated in order to send to Azure. - - :param target_version: Required. The target code version. - :type target_version: str - """ - - _validation = { - 'target_version': {'required': True}, - } - - _attribute_map = { - 'target_version': {'key': 'targetVersion', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UpgradableVersionsDescription, self).__init__(**kwargs) - self.target_version = kwargs['target_version'] - - -class UserAssignedIdentity(msrest.serialization.Model): - """UserAssignedIdentity. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar principal_id: The principal id of user assigned identity. - :vartype principal_id: str - :ivar client_id: The client id of user assigned identity. - :vartype client_id: str - """ - - _validation = { - 'principal_id': {'readonly': True}, - 'client_id': {'readonly': True}, - } - - _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UserAssignedIdentity, self).__init__(**kwargs) - self.principal_id = None - self.client_id = None diff --git a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/models/_models_py3.py b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/models/_models_py3.py index 66fddb483ccd..e11d4bdea259 100644 --- a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/models/_models_py3.py +++ b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/models/_models_py3.py @@ -18,13 +18,13 @@ class ApplicationDeltaHealthPolicy(msrest.serialization.Model): """Defines a delta health policy used to evaluate the health of an application or one of its child entities when upgrading the cluster. - :param default_service_type_delta_health_policy: The delta health policy used by default to + :ivar default_service_type_delta_health_policy: The delta health policy used by default to evaluate the health of a service type when upgrading the cluster. - :type default_service_type_delta_health_policy: + :vartype default_service_type_delta_health_policy: ~azure.mgmt.servicefabric.models.ServiceTypeDeltaHealthPolicy - :param service_type_delta_health_policies: The map with service type delta health policy per + :ivar service_type_delta_health_policies: The map with service type delta health policy per service type name. The map is empty by default. - :type service_type_delta_health_policies: dict[str, + :vartype service_type_delta_health_policies: dict[str, ~azure.mgmt.servicefabric.models.ServiceTypeDeltaHealthPolicy] """ @@ -40,6 +40,16 @@ def __init__( service_type_delta_health_policies: Optional[Dict[str, "ServiceTypeDeltaHealthPolicy"]] = None, **kwargs ): + """ + :keyword default_service_type_delta_health_policy: The delta health policy used by default to + evaluate the health of a service type when upgrading the cluster. + :paramtype default_service_type_delta_health_policy: + ~azure.mgmt.servicefabric.models.ServiceTypeDeltaHealthPolicy + :keyword service_type_delta_health_policies: The map with service type delta health policy per + service type name. The map is empty by default. + :paramtype service_type_delta_health_policies: dict[str, + ~azure.mgmt.servicefabric.models.ServiceTypeDeltaHealthPolicy] + """ super(ApplicationDeltaHealthPolicy, self).__init__(**kwargs) self.default_service_type_delta_health_policy = default_service_type_delta_health_policy self.service_type_delta_health_policies = service_type_delta_health_policies @@ -48,13 +58,13 @@ def __init__( class ApplicationHealthPolicy(msrest.serialization.Model): """Defines a health policy used to evaluate the health of an application or one of its children entities. - :param default_service_type_health_policy: The health policy used by default to evaluate the + :ivar default_service_type_health_policy: The health policy used by default to evaluate the health of a service type. - :type default_service_type_health_policy: + :vartype default_service_type_health_policy: ~azure.mgmt.servicefabric.models.ServiceTypeHealthPolicy - :param service_type_health_policies: The map with service type health policy per service type + :ivar service_type_health_policies: The map with service type health policy per service type name. The map is empty by default. - :type service_type_health_policies: dict[str, + :vartype service_type_health_policies: dict[str, ~azure.mgmt.servicefabric.models.ServiceTypeHealthPolicy] """ @@ -70,6 +80,16 @@ def __init__( service_type_health_policies: Optional[Dict[str, "ServiceTypeHealthPolicy"]] = None, **kwargs ): + """ + :keyword default_service_type_health_policy: The health policy used by default to evaluate the + health of a service type. + :paramtype default_service_type_health_policy: + ~azure.mgmt.servicefabric.models.ServiceTypeHealthPolicy + :keyword service_type_health_policies: The map with service type health policy per service type + name. The map is empty by default. + :paramtype service_type_health_policies: dict[str, + ~azure.mgmt.servicefabric.models.ServiceTypeHealthPolicy] + """ super(ApplicationHealthPolicy, self).__init__(**kwargs) self.default_service_type_health_policy = default_service_type_health_policy self.service_type_health_policies = service_type_health_policies @@ -78,9 +98,9 @@ def __init__( class ApplicationMetricDescription(msrest.serialization.Model): """Describes capacity information for a custom resource balancing metric. This can be used to limit the total consumption of this metric by the services of this application. - :param name: The name of the metric. - :type name: str - :param maximum_capacity: The maximum node capacity for Service Fabric application. + :ivar name: The name of the metric. + :vartype name: str + :ivar maximum_capacity: The maximum node capacity for Service Fabric application. This is the maximum Load for an instance of this application on a single node. Even if the capacity of node is greater than this value, Service Fabric will limit the total load of services within the application on each node to this value. @@ -89,8 +109,8 @@ class ApplicationMetricDescription(msrest.serialization.Model): and this value must always be smaller than or equal to TotalApplicationCapacity. When updating existing application with application capacity, the product of MaximumNodes and this value must always be smaller than or equal to TotalApplicationCapacity. - :type maximum_capacity: long - :param reservation_capacity: The node reservation capacity for Service Fabric application. + :vartype maximum_capacity: long + :ivar reservation_capacity: The node reservation capacity for Service Fabric application. This is the amount of load which is reserved on nodes which have instances of this application. If MinimumNodes is specified, then the product of these values will be the capacity reserved @@ -98,13 +118,13 @@ class ApplicationMetricDescription(msrest.serialization.Model): If set to zero, no capacity is reserved for this metric. When setting application capacity or when updating application capacity; this value must be smaller than or equal to MaximumCapacity for each metric. - :type reservation_capacity: long - :param total_application_capacity: The total metric capacity for Service Fabric application. + :vartype reservation_capacity: long + :ivar total_application_capacity: The total metric capacity for Service Fabric application. This is the total metric capacity for this application in the cluster. Service Fabric will try to limit the sum of loads of services within the application to this value. When creating a new application with application capacity defined, the product of MaximumNodes and MaximumCapacity must always be smaller than or equal to this value. - :type total_application_capacity: long + :vartype total_application_capacity: long """ _attribute_map = { @@ -123,6 +143,35 @@ def __init__( total_application_capacity: Optional[int] = None, **kwargs ): + """ + :keyword name: The name of the metric. + :paramtype name: str + :keyword maximum_capacity: The maximum node capacity for Service Fabric application. + This is the maximum Load for an instance of this application on a single node. Even if the + capacity of node is greater than this value, Service Fabric will limit the total load of + services within the application on each node to this value. + If set to zero, capacity for this metric is unlimited on each node. + When creating a new application with application capacity defined, the product of MaximumNodes + and this value must always be smaller than or equal to TotalApplicationCapacity. + When updating existing application with application capacity, the product of MaximumNodes and + this value must always be smaller than or equal to TotalApplicationCapacity. + :paramtype maximum_capacity: long + :keyword reservation_capacity: The node reservation capacity for Service Fabric application. + This is the amount of load which is reserved on nodes which have instances of this + application. + If MinimumNodes is specified, then the product of these values will be the capacity reserved + in the cluster for the application. + If set to zero, no capacity is reserved for this metric. + When setting application capacity or when updating application capacity; this value must be + smaller than or equal to MaximumCapacity for each metric. + :paramtype reservation_capacity: long + :keyword total_application_capacity: The total metric capacity for Service Fabric application. + This is the total metric capacity for this application in the cluster. Service Fabric will try + to limit the sum of loads of services within the application to this value. + When creating a new application with application capacity defined, the product of MaximumNodes + and MaximumCapacity must always be smaller than or equal to this value. + :paramtype total_application_capacity: long + """ super(ApplicationMetricDescription, self).__init__(**kwargs) self.name = name self.maximum_capacity = maximum_capacity @@ -141,11 +190,11 @@ class ProxyResource(msrest.serialization.Model): :vartype name: str :ivar type: Azure resource type. :vartype type: str - :param location: It will be deprecated in New API, resource location depends on the parent + :ivar location: It will be deprecated in New API, resource location depends on the parent resource. - :type location: str - :param tags: A set of tags. Azure resource tags. - :type tags: dict[str, str] + :vartype location: str + :ivar tags: A set of tags. Azure resource tags. + :vartype tags: dict[str, str] :ivar etag: Azure resource etag. :vartype etag: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. @@ -177,6 +226,13 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword location: It will be deprecated in New API, resource location depends on the parent + resource. + :paramtype location: str + :keyword tags: A set of tags. Azure resource tags. + :paramtype tags: dict[str, str] + """ super(ProxyResource, self).__init__(**kwargs) self.id = None self.name = None @@ -198,48 +254,47 @@ class ApplicationResource(ProxyResource): :vartype name: str :ivar type: Azure resource type. :vartype type: str - :param location: It will be deprecated in New API, resource location depends on the parent + :ivar location: It will be deprecated in New API, resource location depends on the parent resource. - :type location: str - :param tags: A set of tags. Azure resource tags. - :type tags: dict[str, str] + :vartype location: str + :ivar tags: A set of tags. Azure resource tags. + :vartype tags: dict[str, str] :ivar etag: Azure resource etag. :vartype etag: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.servicefabric.models.SystemData - :param identity: Describes the managed identities for an Azure resource. - :type identity: ~azure.mgmt.servicefabric.models.ManagedIdentity - :param type_version: The version of the application type as defined in the application - manifest. - :type type_version: str - :param parameters: List of application parameters with overridden values from their default + :ivar identity: Describes the managed identities for an Azure resource. + :vartype identity: ~azure.mgmt.servicefabric.models.ManagedIdentity + :ivar type_version: The version of the application type as defined in the application manifest. + :vartype type_version: str + :ivar parameters: List of application parameters with overridden values from their default values specified in the application manifest. - :type parameters: dict[str, str] - :param upgrade_policy: Describes the policy for a monitored application upgrade. - :type upgrade_policy: ~azure.mgmt.servicefabric.models.ApplicationUpgradePolicy - :param minimum_nodes: The minimum number of nodes where Service Fabric will reserve capacity - for this application. Note that this does not mean that the services of this application will - be placed on all of those nodes. If this property is set to zero, no capacity will be reserved. + :vartype parameters: dict[str, str] + :ivar upgrade_policy: Describes the policy for a monitored application upgrade. + :vartype upgrade_policy: ~azure.mgmt.servicefabric.models.ApplicationUpgradePolicy + :ivar minimum_nodes: The minimum number of nodes where Service Fabric will reserve capacity for + this application. Note that this does not mean that the services of this application will be + placed on all of those nodes. If this property is set to zero, no capacity will be reserved. The value of this property cannot be more than the value of the MaximumNodes property. - :type minimum_nodes: long - :param maximum_nodes: The maximum number of nodes where Service Fabric will reserve capacity - for this application. Note that this does not mean that the services of this application will - be placed on all of those nodes. By default, the value of this property is zero and it means - that the services can be placed on any node. - :type maximum_nodes: long - :param remove_application_capacity: Remove the current application capacity settings. - :type remove_application_capacity: bool - :param metrics: List of application capacity metric description. - :type metrics: list[~azure.mgmt.servicefabric.models.ApplicationMetricDescription] - :param managed_identities: List of user assigned identities for the application, each mapped to + :vartype minimum_nodes: long + :ivar maximum_nodes: The maximum number of nodes where Service Fabric will reserve capacity for + this application. Note that this does not mean that the services of this application will be + placed on all of those nodes. By default, the value of this property is zero and it means that + the services can be placed on any node. + :vartype maximum_nodes: long + :ivar remove_application_capacity: Remove the current application capacity settings. + :vartype remove_application_capacity: bool + :ivar metrics: List of application capacity metric description. + :vartype metrics: list[~azure.mgmt.servicefabric.models.ApplicationMetricDescription] + :ivar managed_identities: List of user assigned identities for the application, each mapped to a friendly name. - :type managed_identities: + :vartype managed_identities: list[~azure.mgmt.servicefabric.models.ApplicationUserAssignedIdentity] :ivar provisioning_state: The current deployment or provisioning state, which only appears in the response. :vartype provisioning_state: str - :param type_name: The application type name as defined in the application manifest. - :type type_name: str + :ivar type_name: The application type name as defined in the application manifest. + :vartype type_name: str """ _validation = { @@ -291,6 +346,43 @@ def __init__( type_name: Optional[str] = None, **kwargs ): + """ + :keyword location: It will be deprecated in New API, resource location depends on the parent + resource. + :paramtype location: str + :keyword tags: A set of tags. Azure resource tags. + :paramtype tags: dict[str, str] + :keyword identity: Describes the managed identities for an Azure resource. + :paramtype identity: ~azure.mgmt.servicefabric.models.ManagedIdentity + :keyword type_version: The version of the application type as defined in the application + manifest. + :paramtype type_version: str + :keyword parameters: List of application parameters with overridden values from their default + values specified in the application manifest. + :paramtype parameters: dict[str, str] + :keyword upgrade_policy: Describes the policy for a monitored application upgrade. + :paramtype upgrade_policy: ~azure.mgmt.servicefabric.models.ApplicationUpgradePolicy + :keyword minimum_nodes: The minimum number of nodes where Service Fabric will reserve capacity + for this application. Note that this does not mean that the services of this application will + be placed on all of those nodes. If this property is set to zero, no capacity will be reserved. + The value of this property cannot be more than the value of the MaximumNodes property. + :paramtype minimum_nodes: long + :keyword maximum_nodes: The maximum number of nodes where Service Fabric will reserve capacity + for this application. Note that this does not mean that the services of this application will + be placed on all of those nodes. By default, the value of this property is zero and it means + that the services can be placed on any node. + :paramtype maximum_nodes: long + :keyword remove_application_capacity: Remove the current application capacity settings. + :paramtype remove_application_capacity: bool + :keyword metrics: List of application capacity metric description. + :paramtype metrics: list[~azure.mgmt.servicefabric.models.ApplicationMetricDescription] + :keyword managed_identities: List of user assigned identities for the application, each mapped + to a friendly name. + :paramtype managed_identities: + list[~azure.mgmt.servicefabric.models.ApplicationUserAssignedIdentity] + :keyword type_name: The application type name as defined in the application manifest. + :paramtype type_name: str + """ super(ApplicationResource, self).__init__(location=location, tags=tags, **kwargs) self.identity = identity self.type_version = type_version @@ -310,8 +402,8 @@ class ApplicationResourceList(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param value: - :type value: list[~azure.mgmt.servicefabric.models.ApplicationResource] + :ivar value: + :vartype value: list[~azure.mgmt.servicefabric.models.ApplicationResource] :ivar next_link: URL to get the next set of application list results if there are any. :vartype next_link: str """ @@ -331,6 +423,10 @@ def __init__( value: Optional[List["ApplicationResource"]] = None, **kwargs ): + """ + :keyword value: + :paramtype value: list[~azure.mgmt.servicefabric.models.ApplicationResource] + """ super(ApplicationResourceList, self).__init__(**kwargs) self.value = value self.next_link = None @@ -339,31 +435,30 @@ def __init__( class ApplicationResourceUpdateProperties(msrest.serialization.Model): """The application resource properties for patch operations. - :param type_version: The version of the application type as defined in the application - manifest. - :type type_version: str - :param parameters: List of application parameters with overridden values from their default + :ivar type_version: The version of the application type as defined in the application manifest. + :vartype type_version: str + :ivar parameters: List of application parameters with overridden values from their default values specified in the application manifest. - :type parameters: dict[str, str] - :param upgrade_policy: Describes the policy for a monitored application upgrade. - :type upgrade_policy: ~azure.mgmt.servicefabric.models.ApplicationUpgradePolicy - :param minimum_nodes: The minimum number of nodes where Service Fabric will reserve capacity - for this application. Note that this does not mean that the services of this application will - be placed on all of those nodes. If this property is set to zero, no capacity will be reserved. + :vartype parameters: dict[str, str] + :ivar upgrade_policy: Describes the policy for a monitored application upgrade. + :vartype upgrade_policy: ~azure.mgmt.servicefabric.models.ApplicationUpgradePolicy + :ivar minimum_nodes: The minimum number of nodes where Service Fabric will reserve capacity for + this application. Note that this does not mean that the services of this application will be + placed on all of those nodes. If this property is set to zero, no capacity will be reserved. The value of this property cannot be more than the value of the MaximumNodes property. - :type minimum_nodes: long - :param maximum_nodes: The maximum number of nodes where Service Fabric will reserve capacity - for this application. Note that this does not mean that the services of this application will - be placed on all of those nodes. By default, the value of this property is zero and it means - that the services can be placed on any node. - :type maximum_nodes: long - :param remove_application_capacity: Remove the current application capacity settings. - :type remove_application_capacity: bool - :param metrics: List of application capacity metric description. - :type metrics: list[~azure.mgmt.servicefabric.models.ApplicationMetricDescription] - :param managed_identities: List of user assigned identities for the application, each mapped to + :vartype minimum_nodes: long + :ivar maximum_nodes: The maximum number of nodes where Service Fabric will reserve capacity for + this application. Note that this does not mean that the services of this application will be + placed on all of those nodes. By default, the value of this property is zero and it means that + the services can be placed on any node. + :vartype maximum_nodes: long + :ivar remove_application_capacity: Remove the current application capacity settings. + :vartype remove_application_capacity: bool + :ivar metrics: List of application capacity metric description. + :vartype metrics: list[~azure.mgmt.servicefabric.models.ApplicationMetricDescription] + :ivar managed_identities: List of user assigned identities for the application, each mapped to a friendly name. - :type managed_identities: + :vartype managed_identities: list[~azure.mgmt.servicefabric.models.ApplicationUserAssignedIdentity] """ @@ -396,6 +491,34 @@ def __init__( managed_identities: Optional[List["ApplicationUserAssignedIdentity"]] = None, **kwargs ): + """ + :keyword type_version: The version of the application type as defined in the application + manifest. + :paramtype type_version: str + :keyword parameters: List of application parameters with overridden values from their default + values specified in the application manifest. + :paramtype parameters: dict[str, str] + :keyword upgrade_policy: Describes the policy for a monitored application upgrade. + :paramtype upgrade_policy: ~azure.mgmt.servicefabric.models.ApplicationUpgradePolicy + :keyword minimum_nodes: The minimum number of nodes where Service Fabric will reserve capacity + for this application. Note that this does not mean that the services of this application will + be placed on all of those nodes. If this property is set to zero, no capacity will be reserved. + The value of this property cannot be more than the value of the MaximumNodes property. + :paramtype minimum_nodes: long + :keyword maximum_nodes: The maximum number of nodes where Service Fabric will reserve capacity + for this application. Note that this does not mean that the services of this application will + be placed on all of those nodes. By default, the value of this property is zero and it means + that the services can be placed on any node. + :paramtype maximum_nodes: long + :keyword remove_application_capacity: Remove the current application capacity settings. + :paramtype remove_application_capacity: bool + :keyword metrics: List of application capacity metric description. + :paramtype metrics: list[~azure.mgmt.servicefabric.models.ApplicationMetricDescription] + :keyword managed_identities: List of user assigned identities for the application, each mapped + to a friendly name. + :paramtype managed_identities: + list[~azure.mgmt.servicefabric.models.ApplicationUserAssignedIdentity] + """ super(ApplicationResourceUpdateProperties, self).__init__(**kwargs) self.type_version = type_version self.parameters = parameters @@ -412,37 +535,36 @@ class ApplicationResourceProperties(ApplicationResourceUpdateProperties): Variables are only populated by the server, and will be ignored when sending a request. - :param type_version: The version of the application type as defined in the application - manifest. - :type type_version: str - :param parameters: List of application parameters with overridden values from their default + :ivar type_version: The version of the application type as defined in the application manifest. + :vartype type_version: str + :ivar parameters: List of application parameters with overridden values from their default values specified in the application manifest. - :type parameters: dict[str, str] - :param upgrade_policy: Describes the policy for a monitored application upgrade. - :type upgrade_policy: ~azure.mgmt.servicefabric.models.ApplicationUpgradePolicy - :param minimum_nodes: The minimum number of nodes where Service Fabric will reserve capacity - for this application. Note that this does not mean that the services of this application will - be placed on all of those nodes. If this property is set to zero, no capacity will be reserved. + :vartype parameters: dict[str, str] + :ivar upgrade_policy: Describes the policy for a monitored application upgrade. + :vartype upgrade_policy: ~azure.mgmt.servicefabric.models.ApplicationUpgradePolicy + :ivar minimum_nodes: The minimum number of nodes where Service Fabric will reserve capacity for + this application. Note that this does not mean that the services of this application will be + placed on all of those nodes. If this property is set to zero, no capacity will be reserved. The value of this property cannot be more than the value of the MaximumNodes property. - :type minimum_nodes: long - :param maximum_nodes: The maximum number of nodes where Service Fabric will reserve capacity - for this application. Note that this does not mean that the services of this application will - be placed on all of those nodes. By default, the value of this property is zero and it means - that the services can be placed on any node. - :type maximum_nodes: long - :param remove_application_capacity: Remove the current application capacity settings. - :type remove_application_capacity: bool - :param metrics: List of application capacity metric description. - :type metrics: list[~azure.mgmt.servicefabric.models.ApplicationMetricDescription] - :param managed_identities: List of user assigned identities for the application, each mapped to + :vartype minimum_nodes: long + :ivar maximum_nodes: The maximum number of nodes where Service Fabric will reserve capacity for + this application. Note that this does not mean that the services of this application will be + placed on all of those nodes. By default, the value of this property is zero and it means that + the services can be placed on any node. + :vartype maximum_nodes: long + :ivar remove_application_capacity: Remove the current application capacity settings. + :vartype remove_application_capacity: bool + :ivar metrics: List of application capacity metric description. + :vartype metrics: list[~azure.mgmt.servicefabric.models.ApplicationMetricDescription] + :ivar managed_identities: List of user assigned identities for the application, each mapped to a friendly name. - :type managed_identities: + :vartype managed_identities: list[~azure.mgmt.servicefabric.models.ApplicationUserAssignedIdentity] :ivar provisioning_state: The current deployment or provisioning state, which only appears in the response. :vartype provisioning_state: str - :param type_name: The application type name as defined in the application manifest. - :type type_name: str + :ivar type_name: The application type name as defined in the application manifest. + :vartype type_name: str """ _validation = { @@ -478,6 +600,36 @@ def __init__( type_name: Optional[str] = None, **kwargs ): + """ + :keyword type_version: The version of the application type as defined in the application + manifest. + :paramtype type_version: str + :keyword parameters: List of application parameters with overridden values from their default + values specified in the application manifest. + :paramtype parameters: dict[str, str] + :keyword upgrade_policy: Describes the policy for a monitored application upgrade. + :paramtype upgrade_policy: ~azure.mgmt.servicefabric.models.ApplicationUpgradePolicy + :keyword minimum_nodes: The minimum number of nodes where Service Fabric will reserve capacity + for this application. Note that this does not mean that the services of this application will + be placed on all of those nodes. If this property is set to zero, no capacity will be reserved. + The value of this property cannot be more than the value of the MaximumNodes property. + :paramtype minimum_nodes: long + :keyword maximum_nodes: The maximum number of nodes where Service Fabric will reserve capacity + for this application. Note that this does not mean that the services of this application will + be placed on all of those nodes. By default, the value of this property is zero and it means + that the services can be placed on any node. + :paramtype maximum_nodes: long + :keyword remove_application_capacity: Remove the current application capacity settings. + :paramtype remove_application_capacity: bool + :keyword metrics: List of application capacity metric description. + :paramtype metrics: list[~azure.mgmt.servicefabric.models.ApplicationMetricDescription] + :keyword managed_identities: List of user assigned identities for the application, each mapped + to a friendly name. + :paramtype managed_identities: + list[~azure.mgmt.servicefabric.models.ApplicationUserAssignedIdentity] + :keyword type_name: The application type name as defined in the application manifest. + :paramtype type_name: str + """ super(ApplicationResourceProperties, self).__init__(type_version=type_version, parameters=parameters, upgrade_policy=upgrade_policy, minimum_nodes=minimum_nodes, maximum_nodes=maximum_nodes, remove_application_capacity=remove_application_capacity, metrics=metrics, managed_identities=managed_identities, **kwargs) self.provisioning_state = None self.type_name = type_name @@ -494,40 +646,39 @@ class ApplicationResourceUpdate(ProxyResource): :vartype name: str :ivar type: Azure resource type. :vartype type: str - :param location: It will be deprecated in New API, resource location depends on the parent + :ivar location: It will be deprecated in New API, resource location depends on the parent resource. - :type location: str - :param tags: A set of tags. Azure resource tags. - :type tags: dict[str, str] + :vartype location: str + :ivar tags: A set of tags. Azure resource tags. + :vartype tags: dict[str, str] :ivar etag: Azure resource etag. :vartype etag: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.servicefabric.models.SystemData - :param type_version: The version of the application type as defined in the application - manifest. - :type type_version: str - :param parameters: List of application parameters with overridden values from their default + :ivar type_version: The version of the application type as defined in the application manifest. + :vartype type_version: str + :ivar parameters: List of application parameters with overridden values from their default values specified in the application manifest. - :type parameters: dict[str, str] - :param upgrade_policy: Describes the policy for a monitored application upgrade. - :type upgrade_policy: ~azure.mgmt.servicefabric.models.ApplicationUpgradePolicy - :param minimum_nodes: The minimum number of nodes where Service Fabric will reserve capacity - for this application. Note that this does not mean that the services of this application will - be placed on all of those nodes. If this property is set to zero, no capacity will be reserved. + :vartype parameters: dict[str, str] + :ivar upgrade_policy: Describes the policy for a monitored application upgrade. + :vartype upgrade_policy: ~azure.mgmt.servicefabric.models.ApplicationUpgradePolicy + :ivar minimum_nodes: The minimum number of nodes where Service Fabric will reserve capacity for + this application. Note that this does not mean that the services of this application will be + placed on all of those nodes. If this property is set to zero, no capacity will be reserved. The value of this property cannot be more than the value of the MaximumNodes property. - :type minimum_nodes: long - :param maximum_nodes: The maximum number of nodes where Service Fabric will reserve capacity - for this application. Note that this does not mean that the services of this application will - be placed on all of those nodes. By default, the value of this property is zero and it means - that the services can be placed on any node. - :type maximum_nodes: long - :param remove_application_capacity: Remove the current application capacity settings. - :type remove_application_capacity: bool - :param metrics: List of application capacity metric description. - :type metrics: list[~azure.mgmt.servicefabric.models.ApplicationMetricDescription] - :param managed_identities: List of user assigned identities for the application, each mapped to + :vartype minimum_nodes: long + :ivar maximum_nodes: The maximum number of nodes where Service Fabric will reserve capacity for + this application. Note that this does not mean that the services of this application will be + placed on all of those nodes. By default, the value of this property is zero and it means that + the services can be placed on any node. + :vartype maximum_nodes: long + :ivar remove_application_capacity: Remove the current application capacity settings. + :vartype remove_application_capacity: bool + :ivar metrics: List of application capacity metric description. + :vartype metrics: list[~azure.mgmt.servicefabric.models.ApplicationMetricDescription] + :ivar managed_identities: List of user assigned identities for the application, each mapped to a friendly name. - :type managed_identities: + :vartype managed_identities: list[~azure.mgmt.servicefabric.models.ApplicationUserAssignedIdentity] """ @@ -574,6 +725,39 @@ def __init__( managed_identities: Optional[List["ApplicationUserAssignedIdentity"]] = None, **kwargs ): + """ + :keyword location: It will be deprecated in New API, resource location depends on the parent + resource. + :paramtype location: str + :keyword tags: A set of tags. Azure resource tags. + :paramtype tags: dict[str, str] + :keyword type_version: The version of the application type as defined in the application + manifest. + :paramtype type_version: str + :keyword parameters: List of application parameters with overridden values from their default + values specified in the application manifest. + :paramtype parameters: dict[str, str] + :keyword upgrade_policy: Describes the policy for a monitored application upgrade. + :paramtype upgrade_policy: ~azure.mgmt.servicefabric.models.ApplicationUpgradePolicy + :keyword minimum_nodes: The minimum number of nodes where Service Fabric will reserve capacity + for this application. Note that this does not mean that the services of this application will + be placed on all of those nodes. If this property is set to zero, no capacity will be reserved. + The value of this property cannot be more than the value of the MaximumNodes property. + :paramtype minimum_nodes: long + :keyword maximum_nodes: The maximum number of nodes where Service Fabric will reserve capacity + for this application. Note that this does not mean that the services of this application will + be placed on all of those nodes. By default, the value of this property is zero and it means + that the services can be placed on any node. + :paramtype maximum_nodes: long + :keyword remove_application_capacity: Remove the current application capacity settings. + :paramtype remove_application_capacity: bool + :keyword metrics: List of application capacity metric description. + :paramtype metrics: list[~azure.mgmt.servicefabric.models.ApplicationMetricDescription] + :keyword managed_identities: List of user assigned identities for the application, each mapped + to a friendly name. + :paramtype managed_identities: + list[~azure.mgmt.servicefabric.models.ApplicationUserAssignedIdentity] + """ super(ApplicationResourceUpdate, self).__init__(location=location, tags=tags, **kwargs) self.type_version = type_version self.parameters = parameters @@ -596,11 +780,11 @@ class ApplicationTypeResource(ProxyResource): :vartype name: str :ivar type: Azure resource type. :vartype type: str - :param location: It will be deprecated in New API, resource location depends on the parent + :ivar location: It will be deprecated in New API, resource location depends on the parent resource. - :type location: str - :param tags: A set of tags. Azure resource tags. - :type tags: dict[str, str] + :vartype location: str + :ivar tags: A set of tags. Azure resource tags. + :vartype tags: dict[str, str] :ivar etag: Azure resource etag. :vartype etag: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. @@ -637,6 +821,13 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword location: It will be deprecated in New API, resource location depends on the parent + resource. + :paramtype location: str + :keyword tags: A set of tags. Azure resource tags. + :paramtype tags: dict[str, str] + """ super(ApplicationTypeResource, self).__init__(location=location, tags=tags, **kwargs) self.provisioning_state = None @@ -646,8 +837,8 @@ class ApplicationTypeResourceList(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param value: - :type value: list[~azure.mgmt.servicefabric.models.ApplicationTypeResource] + :ivar value: + :vartype value: list[~azure.mgmt.servicefabric.models.ApplicationTypeResource] :ivar next_link: URL to get the next set of application type list results if there are any. :vartype next_link: str """ @@ -667,6 +858,10 @@ def __init__( value: Optional[List["ApplicationTypeResource"]] = None, **kwargs ): + """ + :keyword value: + :paramtype value: list[~azure.mgmt.servicefabric.models.ApplicationTypeResource] + """ super(ApplicationTypeResourceList, self).__init__(**kwargs) self.value = value self.next_link = None @@ -683,11 +878,11 @@ class ApplicationTypeVersionResource(ProxyResource): :vartype name: str :ivar type: Azure resource type. :vartype type: str - :param location: It will be deprecated in New API, resource location depends on the parent + :ivar location: It will be deprecated in New API, resource location depends on the parent resource. - :type location: str - :param tags: A set of tags. Azure resource tags. - :type tags: dict[str, str] + :vartype location: str + :ivar tags: A set of tags. Azure resource tags. + :vartype tags: dict[str, str] :ivar etag: Azure resource etag. :vartype etag: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. @@ -695,8 +890,8 @@ class ApplicationTypeVersionResource(ProxyResource): :ivar provisioning_state: The current deployment or provisioning state, which only appears in the response. :vartype provisioning_state: str - :param app_package_url: The URL to the application package. - :type app_package_url: str + :ivar app_package_url: The URL to the application package. + :vartype app_package_url: str :ivar default_parameter_list: List of application type parameters that can be overridden when creating or updating the application. :vartype default_parameter_list: dict[str, str] @@ -733,6 +928,15 @@ def __init__( app_package_url: Optional[str] = None, **kwargs ): + """ + :keyword location: It will be deprecated in New API, resource location depends on the parent + resource. + :paramtype location: str + :keyword tags: A set of tags. Azure resource tags. + :paramtype tags: dict[str, str] + :keyword app_package_url: The URL to the application package. + :paramtype app_package_url: str + """ super(ApplicationTypeVersionResource, self).__init__(location=location, tags=tags, **kwargs) self.provisioning_state = None self.app_package_url = app_package_url @@ -744,8 +948,8 @@ class ApplicationTypeVersionResourceList(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param value: - :type value: list[~azure.mgmt.servicefabric.models.ApplicationTypeVersionResource] + :ivar value: + :vartype value: list[~azure.mgmt.servicefabric.models.ApplicationTypeVersionResource] :ivar next_link: URL to get the next set of application type version list results if there are any. :vartype next_link: str @@ -766,6 +970,10 @@ def __init__( value: Optional[List["ApplicationTypeVersionResource"]] = None, **kwargs ): + """ + :keyword value: + :paramtype value: list[~azure.mgmt.servicefabric.models.ApplicationTypeVersionResource] + """ super(ApplicationTypeVersionResourceList, self).__init__(**kwargs) self.value = value self.next_link = None @@ -776,9 +984,9 @@ class ApplicationTypeVersionsCleanupPolicy(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param max_unused_versions_to_keep: Required. Number of unused versions per application type to + :ivar max_unused_versions_to_keep: Required. Number of unused versions per application type to keep. - :type max_unused_versions_to_keep: long + :vartype max_unused_versions_to_keep: long """ _validation = { @@ -795,6 +1003,11 @@ def __init__( max_unused_versions_to_keep: int, **kwargs ): + """ + :keyword max_unused_versions_to_keep: Required. Number of unused versions per application type + to keep. + :paramtype max_unused_versions_to_keep: long + """ super(ApplicationTypeVersionsCleanupPolicy, self).__init__(**kwargs) self.max_unused_versions_to_keep = max_unused_versions_to_keep @@ -802,30 +1015,30 @@ def __init__( class ApplicationUpgradePolicy(msrest.serialization.Model): """Describes the policy for a monitored application upgrade. - :param upgrade_replica_set_check_timeout: The maximum amount of time to block processing of an + :ivar upgrade_replica_set_check_timeout: The maximum amount of time to block processing of an upgrade domain and prevent loss of availability when there are unexpected issues. When this timeout expires, processing of the upgrade domain will proceed regardless of availability loss issues. The timeout is reset at the start of each upgrade domain. Valid values are between 0 and 42949672925 inclusive. (unsigned 32-bit integer). - :type upgrade_replica_set_check_timeout: str - :param force_restart: If true, then processes are forcefully restarted during upgrade even when + :vartype upgrade_replica_set_check_timeout: str + :ivar force_restart: If true, then processes are forcefully restarted during upgrade even when the code version has not changed (the upgrade only changes configuration or data). - :type force_restart: bool - :param rolling_upgrade_monitoring_policy: The policy used for monitoring the application + :vartype force_restart: bool + :ivar rolling_upgrade_monitoring_policy: The policy used for monitoring the application upgrade. - :type rolling_upgrade_monitoring_policy: + :vartype rolling_upgrade_monitoring_policy: ~azure.mgmt.servicefabric.models.ArmRollingUpgradeMonitoringPolicy - :param application_health_policy: Defines a health policy used to evaluate the health of an + :ivar application_health_policy: Defines a health policy used to evaluate the health of an application or one of its children entities. - :type application_health_policy: ~azure.mgmt.servicefabric.models.ArmApplicationHealthPolicy - :param upgrade_mode: The mode used to monitor health during a rolling upgrade. The values are + :vartype application_health_policy: ~azure.mgmt.servicefabric.models.ArmApplicationHealthPolicy + :ivar upgrade_mode: The mode used to monitor health during a rolling upgrade. The values are UnmonitoredAuto, UnmonitoredManual, and Monitored. Possible values include: "Invalid", "UnmonitoredAuto", "UnmonitoredManual", "Monitored". Default value: "Monitored". - :type upgrade_mode: str or ~azure.mgmt.servicefabric.models.RollingUpgradeMode - :param recreate_application: Determines whether the application should be recreated on update. + :vartype upgrade_mode: str or ~azure.mgmt.servicefabric.models.RollingUpgradeMode + :ivar recreate_application: Determines whether the application should be recreated on update. If value=true, the rest of the upgrade policy parameters are not allowed and it will result in availability loss. - :type recreate_application: bool + :vartype recreate_application: bool """ _attribute_map = { @@ -848,6 +1061,33 @@ def __init__( recreate_application: Optional[bool] = None, **kwargs ): + """ + :keyword upgrade_replica_set_check_timeout: The maximum amount of time to block processing of + an upgrade domain and prevent loss of availability when there are unexpected issues. When this + timeout expires, processing of the upgrade domain will proceed regardless of availability loss + issues. The timeout is reset at the start of each upgrade domain. Valid values are between 0 + and 42949672925 inclusive. (unsigned 32-bit integer). + :paramtype upgrade_replica_set_check_timeout: str + :keyword force_restart: If true, then processes are forcefully restarted during upgrade even + when the code version has not changed (the upgrade only changes configuration or data). + :paramtype force_restart: bool + :keyword rolling_upgrade_monitoring_policy: The policy used for monitoring the application + upgrade. + :paramtype rolling_upgrade_monitoring_policy: + ~azure.mgmt.servicefabric.models.ArmRollingUpgradeMonitoringPolicy + :keyword application_health_policy: Defines a health policy used to evaluate the health of an + application or one of its children entities. + :paramtype application_health_policy: + ~azure.mgmt.servicefabric.models.ArmApplicationHealthPolicy + :keyword upgrade_mode: The mode used to monitor health during a rolling upgrade. The values are + UnmonitoredAuto, UnmonitoredManual, and Monitored. Possible values include: "Invalid", + "UnmonitoredAuto", "UnmonitoredManual", "Monitored". Default value: "Monitored". + :paramtype upgrade_mode: str or ~azure.mgmt.servicefabric.models.RollingUpgradeMode + :keyword recreate_application: Determines whether the application should be recreated on + update. If value=true, the rest of the upgrade policy parameters are not allowed and it will + result in availability loss. + :paramtype recreate_application: bool + """ super(ApplicationUpgradePolicy, self).__init__(**kwargs) self.upgrade_replica_set_check_timeout = upgrade_replica_set_check_timeout self.force_restart = force_restart @@ -862,10 +1102,10 @@ class ApplicationUserAssignedIdentity(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The friendly name of user assigned identity. - :type name: str - :param principal_id: Required. The principal id of user assigned identity. - :type principal_id: str + :ivar name: Required. The friendly name of user assigned identity. + :vartype name: str + :ivar principal_id: Required. The principal id of user assigned identity. + :vartype principal_id: str """ _validation = { @@ -885,6 +1125,12 @@ def __init__( principal_id: str, **kwargs ): + """ + :keyword name: Required. The friendly name of user assigned identity. + :paramtype name: str + :keyword principal_id: Required. The principal id of user assigned identity. + :paramtype principal_id: str + """ super(ApplicationUserAssignedIdentity, self).__init__(**kwargs) self.name = name self.principal_id = principal_id @@ -893,10 +1139,10 @@ def __init__( class ArmApplicationHealthPolicy(msrest.serialization.Model): """Defines a health policy used to evaluate the health of an application or one of its children entities. - :param consider_warning_as_error: Indicates whether warnings are treated with the same severity + :ivar consider_warning_as_error: Indicates whether warnings are treated with the same severity as errors. - :type consider_warning_as_error: bool - :param max_percent_unhealthy_deployed_applications: The maximum allowed percentage of unhealthy + :vartype consider_warning_as_error: bool + :ivar max_percent_unhealthy_deployed_applications: The maximum allowed percentage of unhealthy deployed applications. Allowed values are Byte values from zero to 100. The percentage represents the maximum tolerated percentage of deployed applications that can be unhealthy before the application is considered in error. @@ -904,14 +1150,14 @@ class ArmApplicationHealthPolicy(msrest.serialization.Model): of nodes where the application is currently deployed on in the cluster. The computation rounds up to tolerate one failure on small numbers of nodes. Default percentage is zero. - :type max_percent_unhealthy_deployed_applications: int - :param default_service_type_health_policy: The health policy used by default to evaluate the + :vartype max_percent_unhealthy_deployed_applications: int + :ivar default_service_type_health_policy: The health policy used by default to evaluate the health of a service type. - :type default_service_type_health_policy: + :vartype default_service_type_health_policy: ~azure.mgmt.servicefabric.models.ArmServiceTypeHealthPolicy - :param service_type_health_policy_map: The map with service type health policy per service type + :ivar service_type_health_policy_map: The map with service type health policy per service type name. The map is empty by default. - :type service_type_health_policy_map: dict[str, + :vartype service_type_health_policy_map: dict[str, ~azure.mgmt.servicefabric.models.ArmServiceTypeHealthPolicy] """ @@ -931,6 +1177,28 @@ def __init__( service_type_health_policy_map: Optional[Dict[str, "ArmServiceTypeHealthPolicy"]] = None, **kwargs ): + """ + :keyword consider_warning_as_error: Indicates whether warnings are treated with the same + severity as errors. + :paramtype consider_warning_as_error: bool + :keyword max_percent_unhealthy_deployed_applications: The maximum allowed percentage of + unhealthy deployed applications. Allowed values are Byte values from zero to 100. + The percentage represents the maximum tolerated percentage of deployed applications that can + be unhealthy before the application is considered in error. + This is calculated by dividing the number of unhealthy deployed applications over the number + of nodes where the application is currently deployed on in the cluster. + The computation rounds up to tolerate one failure on small numbers of nodes. Default + percentage is zero. + :paramtype max_percent_unhealthy_deployed_applications: int + :keyword default_service_type_health_policy: The health policy used by default to evaluate the + health of a service type. + :paramtype default_service_type_health_policy: + ~azure.mgmt.servicefabric.models.ArmServiceTypeHealthPolicy + :keyword service_type_health_policy_map: The map with service type health policy per service + type name. The map is empty by default. + :paramtype service_type_health_policy_map: dict[str, + ~azure.mgmt.servicefabric.models.ArmServiceTypeHealthPolicy] + """ super(ArmApplicationHealthPolicy, self).__init__(**kwargs) self.consider_warning_as_error = consider_warning_as_error self.max_percent_unhealthy_deployed_applications = max_percent_unhealthy_deployed_applications @@ -941,34 +1209,34 @@ def __init__( class ArmRollingUpgradeMonitoringPolicy(msrest.serialization.Model): """The policy used for monitoring the application upgrade. - :param failure_action: The activation Mode of the service package. Possible values include: + :ivar failure_action: The activation Mode of the service package. Possible values include: "Rollback", "Manual". - :type failure_action: str or ~azure.mgmt.servicefabric.models.ArmUpgradeFailureAction - :param health_check_wait_duration: The amount of time to wait after completing an upgrade - domain before applying health policies. It is first interpreted as a string representing an ISO - 8601 duration. If that fails, then it is interpreted as a number representing the total number - of milliseconds. - :type health_check_wait_duration: str - :param health_check_stable_duration: The amount of time that the application or cluster must + :vartype failure_action: str or ~azure.mgmt.servicefabric.models.ArmUpgradeFailureAction + :ivar health_check_wait_duration: The amount of time to wait after completing an upgrade domain + before applying health policies. It is first interpreted as a string representing an ISO 8601 + duration. If that fails, then it is interpreted as a number representing the total number of + milliseconds. + :vartype health_check_wait_duration: str + :ivar health_check_stable_duration: The amount of time that the application or cluster must remain healthy before the upgrade proceeds to the next upgrade domain. It is first interpreted as a string representing an ISO 8601 duration. If that fails, then it is interpreted as a number representing the total number of milliseconds. - :type health_check_stable_duration: str - :param health_check_retry_timeout: The amount of time to retry health evaluation when the + :vartype health_check_stable_duration: str + :ivar health_check_retry_timeout: The amount of time to retry health evaluation when the application or cluster is unhealthy before FailureAction is executed. It is first interpreted as a string representing an ISO 8601 duration. If that fails, then it is interpreted as a number representing the total number of milliseconds. - :type health_check_retry_timeout: str - :param upgrade_timeout: The amount of time the overall upgrade has to complete before + :vartype health_check_retry_timeout: str + :ivar upgrade_timeout: The amount of time the overall upgrade has to complete before FailureAction is executed. It is first interpreted as a string representing an ISO 8601 duration. If that fails, then it is interpreted as a number representing the total number of milliseconds. - :type upgrade_timeout: str - :param upgrade_domain_timeout: The amount of time each upgrade domain has to complete before + :vartype upgrade_timeout: str + :ivar upgrade_domain_timeout: The amount of time each upgrade domain has to complete before FailureAction is executed. It is first interpreted as a string representing an ISO 8601 duration. If that fails, then it is interpreted as a number representing the total number of milliseconds. - :type upgrade_domain_timeout: str + :vartype upgrade_domain_timeout: str """ _attribute_map = { @@ -991,6 +1259,36 @@ def __init__( upgrade_domain_timeout: Optional[str] = "P10675199DT02H48M05.4775807S", **kwargs ): + """ + :keyword failure_action: The activation Mode of the service package. Possible values include: + "Rollback", "Manual". + :paramtype failure_action: str or ~azure.mgmt.servicefabric.models.ArmUpgradeFailureAction + :keyword health_check_wait_duration: The amount of time to wait after completing an upgrade + domain before applying health policies. It is first interpreted as a string representing an ISO + 8601 duration. If that fails, then it is interpreted as a number representing the total number + of milliseconds. + :paramtype health_check_wait_duration: str + :keyword health_check_stable_duration: The amount of time that the application or cluster must + remain healthy before the upgrade proceeds to the next upgrade domain. It is first interpreted + as a string representing an ISO 8601 duration. If that fails, then it is interpreted as a + number representing the total number of milliseconds. + :paramtype health_check_stable_duration: str + :keyword health_check_retry_timeout: The amount of time to retry health evaluation when the + application or cluster is unhealthy before FailureAction is executed. It is first interpreted + as a string representing an ISO 8601 duration. If that fails, then it is interpreted as a + number representing the total number of milliseconds. + :paramtype health_check_retry_timeout: str + :keyword upgrade_timeout: The amount of time the overall upgrade has to complete before + FailureAction is executed. It is first interpreted as a string representing an ISO 8601 + duration. If that fails, then it is interpreted as a number representing the total number of + milliseconds. + :paramtype upgrade_timeout: str + :keyword upgrade_domain_timeout: The amount of time each upgrade domain has to complete before + FailureAction is executed. It is first interpreted as a string representing an ISO 8601 + duration. If that fails, then it is interpreted as a number representing the total number of + milliseconds. + :paramtype upgrade_domain_timeout: str + """ super(ArmRollingUpgradeMonitoringPolicy, self).__init__(**kwargs) self.failure_action = failure_action self.health_check_wait_duration = health_check_wait_duration @@ -1003,15 +1301,15 @@ def __init__( class ArmServiceTypeHealthPolicy(msrest.serialization.Model): """Represents the health policy used to evaluate the health of services belonging to a service type. - :param max_percent_unhealthy_services: The maximum percentage of services allowed to be + :ivar max_percent_unhealthy_services: The maximum percentage of services allowed to be unhealthy before your application is considered in error. - :type max_percent_unhealthy_services: int - :param max_percent_unhealthy_partitions_per_service: The maximum percentage of partitions per + :vartype max_percent_unhealthy_services: int + :ivar max_percent_unhealthy_partitions_per_service: The maximum percentage of partitions per service allowed to be unhealthy before your application is considered in error. - :type max_percent_unhealthy_partitions_per_service: int - :param max_percent_unhealthy_replicas_per_partition: The maximum percentage of replicas per + :vartype max_percent_unhealthy_partitions_per_service: int + :ivar max_percent_unhealthy_replicas_per_partition: The maximum percentage of replicas per partition allowed to be unhealthy before your application is considered in error. - :type max_percent_unhealthy_replicas_per_partition: int + :vartype max_percent_unhealthy_replicas_per_partition: int """ _validation = { @@ -1034,6 +1332,17 @@ def __init__( max_percent_unhealthy_replicas_per_partition: Optional[int] = 0, **kwargs ): + """ + :keyword max_percent_unhealthy_services: The maximum percentage of services allowed to be + unhealthy before your application is considered in error. + :paramtype max_percent_unhealthy_services: int + :keyword max_percent_unhealthy_partitions_per_service: The maximum percentage of partitions per + service allowed to be unhealthy before your application is considered in error. + :paramtype max_percent_unhealthy_partitions_per_service: int + :keyword max_percent_unhealthy_replicas_per_partition: The maximum percentage of replicas per + partition allowed to be unhealthy before your application is considered in error. + :paramtype max_percent_unhealthy_replicas_per_partition: int + """ super(ArmServiceTypeHealthPolicy, self).__init__(**kwargs) self.max_percent_unhealthy_services = max_percent_unhealthy_services self.max_percent_unhealthy_partitions_per_service = max_percent_unhealthy_partitions_per_service @@ -1043,14 +1352,14 @@ def __init__( class AvailableOperationDisplay(msrest.serialization.Model): """Operation supported by the Service Fabric resource provider. - :param provider: The name of the provider. - :type provider: str - :param resource: The resource on which the operation is performed. - :type resource: str - :param operation: The operation that can be performed. - :type operation: str - :param description: Operation description. - :type description: str + :ivar provider: The name of the provider. + :vartype provider: str + :ivar resource: The resource on which the operation is performed. + :vartype resource: str + :ivar operation: The operation that can be performed. + :vartype operation: str + :ivar description: Operation description. + :vartype description: str """ _attribute_map = { @@ -1069,6 +1378,16 @@ def __init__( description: Optional[str] = None, **kwargs ): + """ + :keyword provider: The name of the provider. + :paramtype provider: str + :keyword resource: The resource on which the operation is performed. + :paramtype resource: str + :keyword operation: The operation that can be performed. + :paramtype operation: str + :keyword description: Operation description. + :paramtype description: str + """ super(AvailableOperationDisplay, self).__init__(**kwargs) self.provider = provider self.resource = resource @@ -1079,12 +1398,12 @@ def __init__( class AzureActiveDirectory(msrest.serialization.Model): """The settings to enable AAD authentication on the cluster. - :param tenant_id: Azure active directory tenant id. - :type tenant_id: str - :param cluster_application: Azure active directory cluster application id. - :type cluster_application: str - :param client_application: Azure active directory client application id. - :type client_application: str + :ivar tenant_id: Azure active directory tenant id. + :vartype tenant_id: str + :ivar cluster_application: Azure active directory cluster application id. + :vartype cluster_application: str + :ivar client_application: Azure active directory client application id. + :vartype client_application: str """ _attribute_map = { @@ -1101,6 +1420,14 @@ def __init__( client_application: Optional[str] = None, **kwargs ): + """ + :keyword tenant_id: Azure active directory tenant id. + :paramtype tenant_id: str + :keyword cluster_application: Azure active directory cluster application id. + :paramtype cluster_application: str + :keyword client_application: Azure active directory client application id. + :paramtype client_application: str + """ super(AzureActiveDirectory, self).__init__(**kwargs) self.tenant_id = tenant_id self.cluster_application = cluster_application @@ -1112,14 +1439,14 @@ class CertificateDescription(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param thumbprint: Required. Thumbprint of the primary certificate. - :type thumbprint: str - :param thumbprint_secondary: Thumbprint of the secondary certificate. - :type thumbprint_secondary: str - :param x509_store_name: The local certificate store location. Possible values include: + :ivar thumbprint: Required. Thumbprint of the primary certificate. + :vartype thumbprint: str + :ivar thumbprint_secondary: Thumbprint of the secondary certificate. + :vartype thumbprint_secondary: str + :ivar x509_store_name: The local certificate store location. Possible values include: "AddressBook", "AuthRoot", "CertificateAuthority", "Disallowed", "My", "Root", "TrustedPeople", "TrustedPublisher". - :type x509_store_name: str or ~azure.mgmt.servicefabric.models.StoreName + :vartype x509_store_name: str or ~azure.mgmt.servicefabric.models.StoreName """ _validation = { @@ -1140,6 +1467,16 @@ def __init__( x509_store_name: Optional[Union[str, "StoreName"]] = None, **kwargs ): + """ + :keyword thumbprint: Required. Thumbprint of the primary certificate. + :paramtype thumbprint: str + :keyword thumbprint_secondary: Thumbprint of the secondary certificate. + :paramtype thumbprint_secondary: str + :keyword x509_store_name: The local certificate store location. Possible values include: + "AddressBook", "AuthRoot", "CertificateAuthority", "Disallowed", "My", "Root", "TrustedPeople", + "TrustedPublisher". + :paramtype x509_store_name: str or ~azure.mgmt.servicefabric.models.StoreName + """ super(CertificateDescription, self).__init__(**kwargs) self.thumbprint = thumbprint self.thumbprint_secondary = thumbprint_secondary @@ -1151,14 +1488,13 @@ class ClientCertificateCommonName(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param is_admin: Required. Indicates if the client certificate has admin access to the cluster. + :ivar is_admin: Required. Indicates if the client certificate has admin access to the cluster. Non admin clients can perform only read only operations on the cluster. - :type is_admin: bool - :param certificate_common_name: Required. The common name of the client certificate. - :type certificate_common_name: str - :param certificate_issuer_thumbprint: Required. The issuer thumbprint of the client - certificate. - :type certificate_issuer_thumbprint: str + :vartype is_admin: bool + :ivar certificate_common_name: Required. The common name of the client certificate. + :vartype certificate_common_name: str + :ivar certificate_issuer_thumbprint: Required. The issuer thumbprint of the client certificate. + :vartype certificate_issuer_thumbprint: str """ _validation = { @@ -1181,6 +1517,16 @@ def __init__( certificate_issuer_thumbprint: str, **kwargs ): + """ + :keyword is_admin: Required. Indicates if the client certificate has admin access to the + cluster. Non admin clients can perform only read only operations on the cluster. + :paramtype is_admin: bool + :keyword certificate_common_name: Required. The common name of the client certificate. + :paramtype certificate_common_name: str + :keyword certificate_issuer_thumbprint: Required. The issuer thumbprint of the client + certificate. + :paramtype certificate_issuer_thumbprint: str + """ super(ClientCertificateCommonName, self).__init__(**kwargs) self.is_admin = is_admin self.certificate_common_name = certificate_common_name @@ -1192,11 +1538,11 @@ class ClientCertificateThumbprint(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param is_admin: Required. Indicates if the client certificate has admin access to the cluster. + :ivar is_admin: Required. Indicates if the client certificate has admin access to the cluster. Non admin clients can perform only read only operations on the cluster. - :type is_admin: bool - :param certificate_thumbprint: Required. The thumbprint of the client certificate. - :type certificate_thumbprint: str + :vartype is_admin: bool + :ivar certificate_thumbprint: Required. The thumbprint of the client certificate. + :vartype certificate_thumbprint: str """ _validation = { @@ -1216,6 +1562,13 @@ def __init__( certificate_thumbprint: str, **kwargs ): + """ + :keyword is_admin: Required. Indicates if the client certificate has admin access to the + cluster. Non admin clients can perform only read only operations on the cluster. + :paramtype is_admin: bool + :keyword certificate_thumbprint: Required. The thumbprint of the client certificate. + :paramtype certificate_thumbprint: str + """ super(ClientCertificateThumbprint, self).__init__(**kwargs) self.is_admin = is_admin self.certificate_thumbprint = certificate_thumbprint @@ -1234,10 +1587,10 @@ class Resource(msrest.serialization.Model): :vartype name: str :ivar type: Azure resource type. :vartype type: str - :param location: Required. Azure resource location. - :type location: str - :param tags: A set of tags. Azure resource tags. - :type tags: dict[str, str] + :ivar location: Required. Azure resource location. + :vartype location: str + :ivar tags: A set of tags. Azure resource tags. + :vartype tags: dict[str, str] :ivar etag: Azure resource etag. :vartype etag: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. @@ -1270,6 +1623,12 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword location: Required. Azure resource location. + :paramtype location: str + :keyword tags: A set of tags. Azure resource tags. + :paramtype tags: dict[str, str] + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -1293,42 +1652,43 @@ class Cluster(Resource): :vartype name: str :ivar type: Azure resource type. :vartype type: str - :param location: Required. Azure resource location. - :type location: str - :param tags: A set of tags. Azure resource tags. - :type tags: dict[str, str] + :ivar location: Required. Azure resource location. + :vartype location: str + :ivar tags: A set of tags. Azure resource tags. + :vartype tags: dict[str, str] :ivar etag: Azure resource etag. :vartype etag: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.servicefabric.models.SystemData - :param add_on_features: The list of add-on features to enable in the cluster. - :type add_on_features: list[str or ~azure.mgmt.servicefabric.models.AddOnFeatures] + :ivar add_on_features: The list of add-on features to enable in the cluster. + :vartype add_on_features: list[str or ~azure.mgmt.servicefabric.models.AddOnFeatures] :ivar available_cluster_versions: The Service Fabric runtime versions available for this cluster. :vartype available_cluster_versions: list[~azure.mgmt.servicefabric.models.ClusterVersionDetails] - :param azure_active_directory: The AAD authentication settings of the cluster. - :type azure_active_directory: ~azure.mgmt.servicefabric.models.AzureActiveDirectory - :param certificate: The certificate to use for securing the cluster. The certificate provided + :ivar azure_active_directory: The AAD authentication settings of the cluster. + :vartype azure_active_directory: ~azure.mgmt.servicefabric.models.AzureActiveDirectory + :ivar certificate: The certificate to use for securing the cluster. The certificate provided will be used for node to node security within the cluster, SSL certificate for cluster management endpoint and default admin client. - :type certificate: ~azure.mgmt.servicefabric.models.CertificateDescription - :param certificate_common_names: Describes a list of server certificates referenced by common + :vartype certificate: ~azure.mgmt.servicefabric.models.CertificateDescription + :ivar certificate_common_names: Describes a list of server certificates referenced by common name that are used to secure the cluster. - :type certificate_common_names: ~azure.mgmt.servicefabric.models.ServerCertificateCommonNames - :param client_certificate_common_names: The list of client certificates referenced by common + :vartype certificate_common_names: + ~azure.mgmt.servicefabric.models.ServerCertificateCommonNames + :ivar client_certificate_common_names: The list of client certificates referenced by common name that are allowed to manage the cluster. - :type client_certificate_common_names: + :vartype client_certificate_common_names: list[~azure.mgmt.servicefabric.models.ClientCertificateCommonName] - :param client_certificate_thumbprints: The list of client certificates referenced by thumbprint + :ivar client_certificate_thumbprints: The list of client certificates referenced by thumbprint that are allowed to manage the cluster. - :type client_certificate_thumbprints: + :vartype client_certificate_thumbprints: list[~azure.mgmt.servicefabric.models.ClientCertificateThumbprint] - :param cluster_code_version: The Service Fabric runtime version of the cluster. This property + :ivar cluster_code_version: The Service Fabric runtime version of the cluster. This property can only by set the user when **upgradeMode** is set to 'Manual'. To get list of available Service Fabric versions for new clusters use `ClusterVersion API <./ClusterVersion.md>`_. To get the list of available version for existing clusters use **availableClusterVersions**. - :type cluster_code_version: str + :vartype cluster_code_version: str :ivar cluster_endpoint: The Azure Resource Provider endpoint. A system service in the cluster connects to this endpoint. :vartype cluster_endpoint: str @@ -1361,22 +1721,22 @@ class Cluster(Resource): "UpdatingUserCertificate", "UpdatingInfrastructure", "EnforcingClusterVersion", "UpgradeServiceUnreachable", "AutoScale", "Ready". :vartype cluster_state: str or ~azure.mgmt.servicefabric.models.ClusterState - :param diagnostics_storage_account_config: The storage account information for storing Service + :ivar diagnostics_storage_account_config: The storage account information for storing Service Fabric diagnostic logs. - :type diagnostics_storage_account_config: + :vartype diagnostics_storage_account_config: ~azure.mgmt.servicefabric.models.DiagnosticsStorageAccountConfig - :param event_store_service_enabled: Indicates if the event store service is enabled. - :type event_store_service_enabled: bool - :param fabric_settings: The list of custom fabric settings to configure the cluster. - :type fabric_settings: list[~azure.mgmt.servicefabric.models.SettingsSectionDescription] - :param management_endpoint: The http management endpoint of the cluster. - :type management_endpoint: str - :param node_types: The list of node types in the cluster. - :type node_types: list[~azure.mgmt.servicefabric.models.NodeTypeDescription] + :ivar event_store_service_enabled: Indicates if the event store service is enabled. + :vartype event_store_service_enabled: bool + :ivar fabric_settings: The list of custom fabric settings to configure the cluster. + :vartype fabric_settings: list[~azure.mgmt.servicefabric.models.SettingsSectionDescription] + :ivar management_endpoint: The http management endpoint of the cluster. + :vartype management_endpoint: str + :ivar node_types: The list of node types in the cluster. + :vartype node_types: list[~azure.mgmt.servicefabric.models.NodeTypeDescription] :ivar provisioning_state: The provisioning state of the cluster resource. Possible values include: "Updating", "Succeeded", "Failed", "Canceled". :vartype provisioning_state: str or ~azure.mgmt.servicefabric.models.ProvisioningState - :param reliability_level: The reliability level sets the replica set size of system services. + :ivar reliability_level: The reliability level sets the replica set size of system services. Learn about `ReliabilityLevel `_. @@ -1389,48 +1749,48 @@ class Cluster(Resource): * Gold - Run the System services with a target replica set count of 7. * Platinum - Run the System services with a target replica set count of 9. Possible values include: "None", "Bronze", "Silver", "Gold", "Platinum". - :type reliability_level: str or ~azure.mgmt.servicefabric.models.ReliabilityLevel - :param reverse_proxy_certificate: The server certificate used by reverse proxy. - :type reverse_proxy_certificate: ~azure.mgmt.servicefabric.models.CertificateDescription - :param reverse_proxy_certificate_common_names: Describes a list of server certificates + :vartype reliability_level: str or ~azure.mgmt.servicefabric.models.ReliabilityLevel + :ivar reverse_proxy_certificate: The server certificate used by reverse proxy. + :vartype reverse_proxy_certificate: ~azure.mgmt.servicefabric.models.CertificateDescription + :ivar reverse_proxy_certificate_common_names: Describes a list of server certificates referenced by common name that are used to secure the cluster. - :type reverse_proxy_certificate_common_names: + :vartype reverse_proxy_certificate_common_names: ~azure.mgmt.servicefabric.models.ServerCertificateCommonNames - :param upgrade_description: The policy to use when upgrading the cluster. - :type upgrade_description: ~azure.mgmt.servicefabric.models.ClusterUpgradePolicy - :param upgrade_mode: The upgrade mode of the cluster when new Service Fabric runtime version is + :ivar upgrade_description: The policy to use when upgrading the cluster. + :vartype upgrade_description: ~azure.mgmt.servicefabric.models.ClusterUpgradePolicy + :ivar upgrade_mode: The upgrade mode of the cluster when new Service Fabric runtime version is available. Possible values include: "Automatic", "Manual". Default value: "Automatic". - :type upgrade_mode: str or ~azure.mgmt.servicefabric.models.UpgradeMode - :param application_type_versions_cleanup_policy: The policy used to clean up unused versions. - :type application_type_versions_cleanup_policy: + :vartype upgrade_mode: str or ~azure.mgmt.servicefabric.models.UpgradeMode + :ivar application_type_versions_cleanup_policy: The policy used to clean up unused versions. + :vartype application_type_versions_cleanup_policy: ~azure.mgmt.servicefabric.models.ApplicationTypeVersionsCleanupPolicy - :param vm_image: The VM image VMSS has been configured with. Generic names such as Windows or + :ivar vm_image: The VM image VMSS has been configured with. Generic names such as Windows or Linux can be used. - :type vm_image: str - :param sf_zonal_upgrade_mode: This property controls the logical grouping of VMs in upgrade + :vartype vm_image: str + :ivar sf_zonal_upgrade_mode: This property controls the logical grouping of VMs in upgrade domains (UDs). This property can't be modified if a node type with multiple Availability Zones is already present in the cluster. Possible values include: "Parallel", "Hierarchical". - :type sf_zonal_upgrade_mode: str or ~azure.mgmt.servicefabric.models.SfZonalUpgradeMode - :param vmss_zonal_upgrade_mode: This property defines the upgrade mode for the virtual machine + :vartype sf_zonal_upgrade_mode: str or ~azure.mgmt.servicefabric.models.SfZonalUpgradeMode + :ivar vmss_zonal_upgrade_mode: This property defines the upgrade mode for the virtual machine scale set, it is mandatory if a node type with multiple Availability Zones is added. Possible values include: "Parallel", "Hierarchical". - :type vmss_zonal_upgrade_mode: str or ~azure.mgmt.servicefabric.models.VmssZonalUpgradeMode - :param infrastructure_service_manager: Indicates if infrastructure service manager is enabled. - :type infrastructure_service_manager: bool - :param upgrade_wave: Indicates when new cluster runtime version upgrades will be applied after + :vartype vmss_zonal_upgrade_mode: str or ~azure.mgmt.servicefabric.models.VmssZonalUpgradeMode + :ivar infrastructure_service_manager: Indicates if infrastructure service manager is enabled. + :vartype infrastructure_service_manager: bool + :ivar upgrade_wave: Indicates when new cluster runtime version upgrades will be applied after they are released. By default is Wave0. Only applies when **upgradeMode** is set to 'Automatic'. Possible values include: "Wave0", "Wave1", "Wave2". - :type upgrade_wave: str or ~azure.mgmt.servicefabric.models.ClusterUpgradeCadence - :param upgrade_pause_start_timestamp_utc: Indicates the start date and time to pause automatic + :vartype upgrade_wave: str or ~azure.mgmt.servicefabric.models.ClusterUpgradeCadence + :ivar upgrade_pause_start_timestamp_utc: Indicates the start date and time to pause automatic runtime version upgrades on the cluster for an specific period of time on the cluster (UTC). - :type upgrade_pause_start_timestamp_utc: ~datetime.datetime - :param upgrade_pause_end_timestamp_utc: Indicates the end date and time to pause automatic + :vartype upgrade_pause_start_timestamp_utc: ~datetime.datetime + :ivar upgrade_pause_end_timestamp_utc: Indicates the end date and time to pause automatic runtime version upgrades on the cluster for an specific period of time on the cluster (UTC). - :type upgrade_pause_end_timestamp_utc: ~datetime.datetime - :param wave_upgrade_paused: Boolean to pause automatic runtime version upgrades to the cluster. - :type wave_upgrade_paused: bool - :param notifications: Indicates a list of notification channels for cluster events. - :type notifications: list[~azure.mgmt.servicefabric.models.Notification] + :vartype upgrade_pause_end_timestamp_utc: ~datetime.datetime + :ivar wave_upgrade_paused: Boolean to pause automatic runtime version upgrades to the cluster. + :vartype wave_upgrade_paused: bool + :ivar notifications: Indicates a list of notification channels for cluster events. + :vartype notifications: list[~azure.mgmt.servicefabric.models.Notification] """ _validation = { @@ -1523,6 +1883,108 @@ def __init__( notifications: Optional[List["Notification"]] = None, **kwargs ): + """ + :keyword location: Required. Azure resource location. + :paramtype location: str + :keyword tags: A set of tags. Azure resource tags. + :paramtype tags: dict[str, str] + :keyword add_on_features: The list of add-on features to enable in the cluster. + :paramtype add_on_features: list[str or ~azure.mgmt.servicefabric.models.AddOnFeatures] + :keyword azure_active_directory: The AAD authentication settings of the cluster. + :paramtype azure_active_directory: ~azure.mgmt.servicefabric.models.AzureActiveDirectory + :keyword certificate: The certificate to use for securing the cluster. The certificate provided + will be used for node to node security within the cluster, SSL certificate for cluster + management endpoint and default admin client. + :paramtype certificate: ~azure.mgmt.servicefabric.models.CertificateDescription + :keyword certificate_common_names: Describes a list of server certificates referenced by common + name that are used to secure the cluster. + :paramtype certificate_common_names: + ~azure.mgmt.servicefabric.models.ServerCertificateCommonNames + :keyword client_certificate_common_names: The list of client certificates referenced by common + name that are allowed to manage the cluster. + :paramtype client_certificate_common_names: + list[~azure.mgmt.servicefabric.models.ClientCertificateCommonName] + :keyword client_certificate_thumbprints: The list of client certificates referenced by + thumbprint that are allowed to manage the cluster. + :paramtype client_certificate_thumbprints: + list[~azure.mgmt.servicefabric.models.ClientCertificateThumbprint] + :keyword cluster_code_version: The Service Fabric runtime version of the cluster. This property + can only by set the user when **upgradeMode** is set to 'Manual'. To get list of available + Service Fabric versions for new clusters use `ClusterVersion API <./ClusterVersion.md>`_. To + get the list of available version for existing clusters use **availableClusterVersions**. + :paramtype cluster_code_version: str + :keyword diagnostics_storage_account_config: The storage account information for storing + Service Fabric diagnostic logs. + :paramtype diagnostics_storage_account_config: + ~azure.mgmt.servicefabric.models.DiagnosticsStorageAccountConfig + :keyword event_store_service_enabled: Indicates if the event store service is enabled. + :paramtype event_store_service_enabled: bool + :keyword fabric_settings: The list of custom fabric settings to configure the cluster. + :paramtype fabric_settings: list[~azure.mgmt.servicefabric.models.SettingsSectionDescription] + :keyword management_endpoint: The http management endpoint of the cluster. + :paramtype management_endpoint: str + :keyword node_types: The list of node types in the cluster. + :paramtype node_types: list[~azure.mgmt.servicefabric.models.NodeTypeDescription] + :keyword reliability_level: The reliability level sets the replica set size of system services. + Learn about `ReliabilityLevel + `_. + + + * None - Run the System services with a target replica set count of 1. This should only be + used for test clusters. + * Bronze - Run the System services with a target replica set count of 3. This should only be + used for test clusters. + * Silver - Run the System services with a target replica set count of 5. + * Gold - Run the System services with a target replica set count of 7. + * Platinum - Run the System services with a target replica set count of 9. Possible values + include: "None", "Bronze", "Silver", "Gold", "Platinum". + :paramtype reliability_level: str or ~azure.mgmt.servicefabric.models.ReliabilityLevel + :keyword reverse_proxy_certificate: The server certificate used by reverse proxy. + :paramtype reverse_proxy_certificate: ~azure.mgmt.servicefabric.models.CertificateDescription + :keyword reverse_proxy_certificate_common_names: Describes a list of server certificates + referenced by common name that are used to secure the cluster. + :paramtype reverse_proxy_certificate_common_names: + ~azure.mgmt.servicefabric.models.ServerCertificateCommonNames + :keyword upgrade_description: The policy to use when upgrading the cluster. + :paramtype upgrade_description: ~azure.mgmt.servicefabric.models.ClusterUpgradePolicy + :keyword upgrade_mode: The upgrade mode of the cluster when new Service Fabric runtime version + is available. Possible values include: "Automatic", "Manual". Default value: "Automatic". + :paramtype upgrade_mode: str or ~azure.mgmt.servicefabric.models.UpgradeMode + :keyword application_type_versions_cleanup_policy: The policy used to clean up unused versions. + :paramtype application_type_versions_cleanup_policy: + ~azure.mgmt.servicefabric.models.ApplicationTypeVersionsCleanupPolicy + :keyword vm_image: The VM image VMSS has been configured with. Generic names such as Windows or + Linux can be used. + :paramtype vm_image: str + :keyword sf_zonal_upgrade_mode: This property controls the logical grouping of VMs in upgrade + domains (UDs). This property can't be modified if a node type with multiple Availability Zones + is already present in the cluster. Possible values include: "Parallel", "Hierarchical". + :paramtype sf_zonal_upgrade_mode: str or ~azure.mgmt.servicefabric.models.SfZonalUpgradeMode + :keyword vmss_zonal_upgrade_mode: This property defines the upgrade mode for the virtual + machine scale set, it is mandatory if a node type with multiple Availability Zones is added. + Possible values include: "Parallel", "Hierarchical". + :paramtype vmss_zonal_upgrade_mode: str or + ~azure.mgmt.servicefabric.models.VmssZonalUpgradeMode + :keyword infrastructure_service_manager: Indicates if infrastructure service manager is + enabled. + :paramtype infrastructure_service_manager: bool + :keyword upgrade_wave: Indicates when new cluster runtime version upgrades will be applied + after they are released. By default is Wave0. Only applies when **upgradeMode** is set to + 'Automatic'. Possible values include: "Wave0", "Wave1", "Wave2". + :paramtype upgrade_wave: str or ~azure.mgmt.servicefabric.models.ClusterUpgradeCadence + :keyword upgrade_pause_start_timestamp_utc: Indicates the start date and time to pause + automatic runtime version upgrades on the cluster for an specific period of time on the cluster + (UTC). + :paramtype upgrade_pause_start_timestamp_utc: ~datetime.datetime + :keyword upgrade_pause_end_timestamp_utc: Indicates the end date and time to pause automatic + runtime version upgrades on the cluster for an specific period of time on the cluster (UTC). + :paramtype upgrade_pause_end_timestamp_utc: ~datetime.datetime + :keyword wave_upgrade_paused: Boolean to pause automatic runtime version upgrades to the + cluster. + :paramtype wave_upgrade_paused: bool + :keyword notifications: Indicates a list of notification channels for cluster events. + :paramtype notifications: list[~azure.mgmt.servicefabric.models.Notification] + """ super(Cluster, self).__init__(location=location, tags=tags, **kwargs) self.add_on_features = add_on_features self.available_cluster_versions = None @@ -1561,10 +2023,10 @@ def __init__( class ClusterCodeVersionsListResult(msrest.serialization.Model): """The list results of the Service Fabric runtime versions. - :param value: - :type value: list[~azure.mgmt.servicefabric.models.ClusterCodeVersionsResult] - :param next_link: The URL to use for getting the next set of results. - :type next_link: str + :ivar value: + :vartype value: list[~azure.mgmt.servicefabric.models.ClusterCodeVersionsResult] + :ivar next_link: The URL to use for getting the next set of results. + :vartype next_link: str """ _attribute_map = { @@ -1579,6 +2041,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: + :paramtype value: list[~azure.mgmt.servicefabric.models.ClusterCodeVersionsResult] + :keyword next_link: The URL to use for getting the next set of results. + :paramtype next_link: str + """ super(ClusterCodeVersionsListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1587,19 +2055,19 @@ def __init__( class ClusterCodeVersionsResult(msrest.serialization.Model): """The result of the Service Fabric runtime versions. - :param id: The identification of the result. - :type id: str - :param name: The name of the result. - :type name: str - :param type: The result resource type. - :type type: str - :param code_version: The Service Fabric runtime version of the cluster. - :type code_version: str - :param support_expiry_utc: The date of expiry of support of the version. - :type support_expiry_utc: str - :param environment: Indicates if this version is for Windows or Linux operating system. - Possible values include: "Windows", "Linux". - :type environment: str or ~azure.mgmt.servicefabric.models.ClusterEnvironment + :ivar id: The identification of the result. + :vartype id: str + :ivar name: The name of the result. + :vartype name: str + :ivar type: The result resource type. + :vartype type: str + :ivar code_version: The Service Fabric runtime version of the cluster. + :vartype code_version: str + :ivar support_expiry_utc: The date of expiry of support of the version. + :vartype support_expiry_utc: str + :ivar environment: Indicates if this version is for Windows or Linux operating system. Possible + values include: "Windows", "Linux". + :vartype environment: str or ~azure.mgmt.servicefabric.models.ClusterEnvironment """ _attribute_map = { @@ -1622,6 +2090,21 @@ def __init__( environment: Optional[Union[str, "ClusterEnvironment"]] = None, **kwargs ): + """ + :keyword id: The identification of the result. + :paramtype id: str + :keyword name: The name of the result. + :paramtype name: str + :keyword type: The result resource type. + :paramtype type: str + :keyword code_version: The Service Fabric runtime version of the cluster. + :paramtype code_version: str + :keyword support_expiry_utc: The date of expiry of support of the version. + :paramtype support_expiry_utc: str + :keyword environment: Indicates if this version is for Windows or Linux operating system. + Possible values include: "Windows", "Linux". + :paramtype environment: str or ~azure.mgmt.servicefabric.models.ClusterEnvironment + """ super(ClusterCodeVersionsResult, self).__init__(**kwargs) self.id = id self.name = name @@ -1634,7 +2117,7 @@ def __init__( class ClusterHealthPolicy(msrest.serialization.Model): """Defines a health policy used to evaluate the health of the cluster or of a cluster node. - :param max_percent_unhealthy_nodes: The maximum allowed percentage of unhealthy nodes before + :ivar max_percent_unhealthy_nodes: The maximum allowed percentage of unhealthy nodes before reporting an error. For example, to allow 10% of nodes to be unhealthy, this value would be 10. The percentage represents the maximum tolerated percentage of nodes that can be unhealthy @@ -1648,8 +2131,8 @@ class ClusterHealthPolicy(msrest.serialization.Model): In large clusters, some nodes will always be down or out for repairs, so this percentage should be configured to tolerate that. - :type max_percent_unhealthy_nodes: int - :param max_percent_unhealthy_applications: The maximum allowed percentage of unhealthy + :vartype max_percent_unhealthy_nodes: int + :ivar max_percent_unhealthy_applications: The maximum allowed percentage of unhealthy applications before reporting an error. For example, to allow 10% of applications to be unhealthy, this value would be 10. @@ -1662,10 +2145,10 @@ class ClusterHealthPolicy(msrest.serialization.Model): included in the ApplicationTypeHealthPolicyMap. The computation rounds up to tolerate one failure on small numbers of applications. Default percentage is zero. - :type max_percent_unhealthy_applications: int - :param application_health_policies: Defines the application health policy map used to evaluate + :vartype max_percent_unhealthy_applications: int + :ivar application_health_policies: Defines the application health policy map used to evaluate the health of an application or one of its children entities. - :type application_health_policies: dict[str, + :vartype application_health_policies: dict[str, ~azure.mgmt.servicefabric.models.ApplicationHealthPolicy] """ @@ -1688,6 +2171,41 @@ def __init__( application_health_policies: Optional[Dict[str, "ApplicationHealthPolicy"]] = None, **kwargs ): + """ + :keyword max_percent_unhealthy_nodes: The maximum allowed percentage of unhealthy nodes before + reporting an error. For example, to allow 10% of nodes to be unhealthy, this value would be 10. + + The percentage represents the maximum tolerated percentage of nodes that can be unhealthy + before the cluster is considered in error. + If the percentage is respected but there is at least one unhealthy node, the health is + evaluated as Warning. + The percentage is calculated by dividing the number of unhealthy nodes over the total number + of nodes in the cluster. + The computation rounds up to tolerate one failure on small numbers of nodes. Default + percentage is zero. + + In large clusters, some nodes will always be down or out for repairs, so this percentage + should be configured to tolerate that. + :paramtype max_percent_unhealthy_nodes: int + :keyword max_percent_unhealthy_applications: The maximum allowed percentage of unhealthy + applications before reporting an error. For example, to allow 10% of applications to be + unhealthy, this value would be 10. + + The percentage represents the maximum tolerated percentage of applications that can be + unhealthy before the cluster is considered in error. + If the percentage is respected but there is at least one unhealthy application, the health is + evaluated as Warning. + This is calculated by dividing the number of unhealthy applications over the total number of + application instances in the cluster, excluding applications of application types that are + included in the ApplicationTypeHealthPolicyMap. + The computation rounds up to tolerate one failure on small numbers of applications. Default + percentage is zero. + :paramtype max_percent_unhealthy_applications: int + :keyword application_health_policies: Defines the application health policy map used to + evaluate the health of an application or one of its children entities. + :paramtype application_health_policies: dict[str, + ~azure.mgmt.servicefabric.models.ApplicationHealthPolicy] + """ super(ClusterHealthPolicy, self).__init__(**kwargs) self.max_percent_unhealthy_nodes = max_percent_unhealthy_nodes self.max_percent_unhealthy_applications = max_percent_unhealthy_applications @@ -1697,10 +2215,10 @@ def __init__( class ClusterListResult(msrest.serialization.Model): """Cluster list results. - :param value: - :type value: list[~azure.mgmt.servicefabric.models.Cluster] - :param next_link: The URL to use for getting the next set of results. - :type next_link: str + :ivar value: + :vartype value: list[~azure.mgmt.servicefabric.models.Cluster] + :ivar next_link: The URL to use for getting the next set of results. + :vartype next_link: str """ _attribute_map = { @@ -1715,6 +2233,12 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: + :paramtype value: list[~azure.mgmt.servicefabric.models.Cluster] + :keyword next_link: The URL to use for getting the next set of results. + :paramtype next_link: str + """ super(ClusterListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1723,39 +2247,39 @@ def __init__( class ClusterUpdateParameters(msrest.serialization.Model): """Cluster update request. - :param tags: A set of tags. Cluster update parameters. - :type tags: dict[str, str] - :param add_on_features: The list of add-on features to enable in the cluster. - :type add_on_features: list[str or ~azure.mgmt.servicefabric.models.AddOnFeatures] - :param certificate: The certificate to use for securing the cluster. The certificate provided + :ivar tags: A set of tags. Cluster update parameters. + :vartype tags: dict[str, str] + :ivar add_on_features: The list of add-on features to enable in the cluster. + :vartype add_on_features: list[str or ~azure.mgmt.servicefabric.models.AddOnFeatures] + :ivar certificate: The certificate to use for securing the cluster. The certificate provided will be used for node to node security within the cluster, SSL certificate for cluster management endpoint and default admin client. - :type certificate: ~azure.mgmt.servicefabric.models.CertificateDescription - :param certificate_common_names: Describes a list of server certificates referenced by common + :vartype certificate: ~azure.mgmt.servicefabric.models.CertificateDescription + :ivar certificate_common_names: Describes a list of server certificates referenced by common name that are used to secure the cluster. - :type certificate_common_names: ~azure.mgmt.servicefabric.models.ServerCertificateCommonNames - :param client_certificate_common_names: The list of client certificates referenced by common + :vartype certificate_common_names: + ~azure.mgmt.servicefabric.models.ServerCertificateCommonNames + :ivar client_certificate_common_names: The list of client certificates referenced by common name that are allowed to manage the cluster. This will overwrite the existing list. - :type client_certificate_common_names: + :vartype client_certificate_common_names: list[~azure.mgmt.servicefabric.models.ClientCertificateCommonName] - :param client_certificate_thumbprints: The list of client certificates referenced by thumbprint + :ivar client_certificate_thumbprints: The list of client certificates referenced by thumbprint that are allowed to manage the cluster. This will overwrite the existing list. - :type client_certificate_thumbprints: + :vartype client_certificate_thumbprints: list[~azure.mgmt.servicefabric.models.ClientCertificateThumbprint] - :param cluster_code_version: The Service Fabric runtime version of the cluster. This property + :ivar cluster_code_version: The Service Fabric runtime version of the cluster. This property can only by set the user when **upgradeMode** is set to 'Manual'. To get list of available Service Fabric versions for new clusters use `ClusterVersion API <./ClusterVersion.md>`_. To get the list of available version for existing clusters use **availableClusterVersions**. - :type cluster_code_version: str - :param event_store_service_enabled: Indicates if the event store service is enabled. - :type event_store_service_enabled: bool - :param fabric_settings: The list of custom fabric settings to configure the cluster. This will + :vartype cluster_code_version: str + :ivar event_store_service_enabled: Indicates if the event store service is enabled. + :vartype event_store_service_enabled: bool + :ivar fabric_settings: The list of custom fabric settings to configure the cluster. This will overwrite the existing list. - :type fabric_settings: list[~azure.mgmt.servicefabric.models.SettingsSectionDescription] - :param node_types: The list of node types in the cluster. This will overwrite the existing - list. - :type node_types: list[~azure.mgmt.servicefabric.models.NodeTypeDescription] - :param reliability_level: The reliability level sets the replica set size of system services. + :vartype fabric_settings: list[~azure.mgmt.servicefabric.models.SettingsSectionDescription] + :ivar node_types: The list of node types in the cluster. This will overwrite the existing list. + :vartype node_types: list[~azure.mgmt.servicefabric.models.NodeTypeDescription] + :ivar reliability_level: The reliability level sets the replica set size of system services. Learn about `ReliabilityLevel `_. @@ -1768,41 +2292,41 @@ class ClusterUpdateParameters(msrest.serialization.Model): * Gold - Run the System services with a target replica set count of 7. * Platinum - Run the System services with a target replica set count of 9. Possible values include: "None", "Bronze", "Silver", "Gold", "Platinum". - :type reliability_level: str or ~azure.mgmt.servicefabric.models.ReliabilityLevel - :param reverse_proxy_certificate: The server certificate used by reverse proxy. - :type reverse_proxy_certificate: ~azure.mgmt.servicefabric.models.CertificateDescription - :param upgrade_description: The policy to use when upgrading the cluster. - :type upgrade_description: ~azure.mgmt.servicefabric.models.ClusterUpgradePolicy - :param application_type_versions_cleanup_policy: The policy used to clean up unused versions. - :type application_type_versions_cleanup_policy: + :vartype reliability_level: str or ~azure.mgmt.servicefabric.models.ReliabilityLevel + :ivar reverse_proxy_certificate: The server certificate used by reverse proxy. + :vartype reverse_proxy_certificate: ~azure.mgmt.servicefabric.models.CertificateDescription + :ivar upgrade_description: The policy to use when upgrading the cluster. + :vartype upgrade_description: ~azure.mgmt.servicefabric.models.ClusterUpgradePolicy + :ivar application_type_versions_cleanup_policy: The policy used to clean up unused versions. + :vartype application_type_versions_cleanup_policy: ~azure.mgmt.servicefabric.models.ApplicationTypeVersionsCleanupPolicy - :param upgrade_mode: The upgrade mode of the cluster when new Service Fabric runtime version is + :ivar upgrade_mode: The upgrade mode of the cluster when new Service Fabric runtime version is available. Possible values include: "Automatic", "Manual". Default value: "Automatic". - :type upgrade_mode: str or ~azure.mgmt.servicefabric.models.UpgradeMode - :param sf_zonal_upgrade_mode: This property controls the logical grouping of VMs in upgrade + :vartype upgrade_mode: str or ~azure.mgmt.servicefabric.models.UpgradeMode + :ivar sf_zonal_upgrade_mode: This property controls the logical grouping of VMs in upgrade domains (UDs). This property can't be modified if a node type with multiple Availability Zones is already present in the cluster. Possible values include: "Parallel", "Hierarchical". - :type sf_zonal_upgrade_mode: str or ~azure.mgmt.servicefabric.models.SfZonalUpgradeMode - :param vmss_zonal_upgrade_mode: This property defines the upgrade mode for the virtual machine + :vartype sf_zonal_upgrade_mode: str or ~azure.mgmt.servicefabric.models.SfZonalUpgradeMode + :ivar vmss_zonal_upgrade_mode: This property defines the upgrade mode for the virtual machine scale set, it is mandatory if a node type with multiple Availability Zones is added. Possible values include: "Parallel", "Hierarchical". - :type vmss_zonal_upgrade_mode: str or ~azure.mgmt.servicefabric.models.VmssZonalUpgradeMode - :param infrastructure_service_manager: Indicates if infrastructure service manager is enabled. - :type infrastructure_service_manager: bool - :param upgrade_wave: Indicates when new cluster runtime version upgrades will be applied after + :vartype vmss_zonal_upgrade_mode: str or ~azure.mgmt.servicefabric.models.VmssZonalUpgradeMode + :ivar infrastructure_service_manager: Indicates if infrastructure service manager is enabled. + :vartype infrastructure_service_manager: bool + :ivar upgrade_wave: Indicates when new cluster runtime version upgrades will be applied after they are released. By default is Wave0. Only applies when **upgradeMode** is set to 'Automatic'. Possible values include: "Wave0", "Wave1", "Wave2". - :type upgrade_wave: str or ~azure.mgmt.servicefabric.models.ClusterUpgradeCadence - :param upgrade_pause_start_timestamp_utc: The start timestamp to pause runtime version upgrades + :vartype upgrade_wave: str or ~azure.mgmt.servicefabric.models.ClusterUpgradeCadence + :ivar upgrade_pause_start_timestamp_utc: The start timestamp to pause runtime version upgrades on the cluster (UTC). - :type upgrade_pause_start_timestamp_utc: ~datetime.datetime - :param upgrade_pause_end_timestamp_utc: The end timestamp of pause runtime version upgrades on + :vartype upgrade_pause_start_timestamp_utc: ~datetime.datetime + :ivar upgrade_pause_end_timestamp_utc: The end timestamp of pause runtime version upgrades on the cluster (UTC). - :type upgrade_pause_end_timestamp_utc: ~datetime.datetime - :param wave_upgrade_paused: Boolean to pause automatic runtime version upgrades to the cluster. - :type wave_upgrade_paused: bool - :param notifications: Indicates a list of notification channels for cluster events. - :type notifications: list[~azure.mgmt.servicefabric.models.Notification] + :vartype upgrade_pause_end_timestamp_utc: ~datetime.datetime + :ivar wave_upgrade_paused: Boolean to pause automatic runtime version upgrades to the cluster. + :vartype wave_upgrade_paused: bool + :ivar notifications: Indicates a list of notification channels for cluster events. + :vartype notifications: list[~azure.mgmt.servicefabric.models.Notification] """ _attribute_map = { @@ -1859,6 +2383,92 @@ def __init__( notifications: Optional[List["Notification"]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Cluster update parameters. + :paramtype tags: dict[str, str] + :keyword add_on_features: The list of add-on features to enable in the cluster. + :paramtype add_on_features: list[str or ~azure.mgmt.servicefabric.models.AddOnFeatures] + :keyword certificate: The certificate to use for securing the cluster. The certificate provided + will be used for node to node security within the cluster, SSL certificate for cluster + management endpoint and default admin client. + :paramtype certificate: ~azure.mgmt.servicefabric.models.CertificateDescription + :keyword certificate_common_names: Describes a list of server certificates referenced by common + name that are used to secure the cluster. + :paramtype certificate_common_names: + ~azure.mgmt.servicefabric.models.ServerCertificateCommonNames + :keyword client_certificate_common_names: The list of client certificates referenced by common + name that are allowed to manage the cluster. This will overwrite the existing list. + :paramtype client_certificate_common_names: + list[~azure.mgmt.servicefabric.models.ClientCertificateCommonName] + :keyword client_certificate_thumbprints: The list of client certificates referenced by + thumbprint that are allowed to manage the cluster. This will overwrite the existing list. + :paramtype client_certificate_thumbprints: + list[~azure.mgmt.servicefabric.models.ClientCertificateThumbprint] + :keyword cluster_code_version: The Service Fabric runtime version of the cluster. This property + can only by set the user when **upgradeMode** is set to 'Manual'. To get list of available + Service Fabric versions for new clusters use `ClusterVersion API <./ClusterVersion.md>`_. To + get the list of available version for existing clusters use **availableClusterVersions**. + :paramtype cluster_code_version: str + :keyword event_store_service_enabled: Indicates if the event store service is enabled. + :paramtype event_store_service_enabled: bool + :keyword fabric_settings: The list of custom fabric settings to configure the cluster. This + will overwrite the existing list. + :paramtype fabric_settings: list[~azure.mgmt.servicefabric.models.SettingsSectionDescription] + :keyword node_types: The list of node types in the cluster. This will overwrite the existing + list. + :paramtype node_types: list[~azure.mgmt.servicefabric.models.NodeTypeDescription] + :keyword reliability_level: The reliability level sets the replica set size of system services. + Learn about `ReliabilityLevel + `_. + + + * None - Run the System services with a target replica set count of 1. This should only be + used for test clusters. + * Bronze - Run the System services with a target replica set count of 3. This should only be + used for test clusters. + * Silver - Run the System services with a target replica set count of 5. + * Gold - Run the System services with a target replica set count of 7. + * Platinum - Run the System services with a target replica set count of 9. Possible values + include: "None", "Bronze", "Silver", "Gold", "Platinum". + :paramtype reliability_level: str or ~azure.mgmt.servicefabric.models.ReliabilityLevel + :keyword reverse_proxy_certificate: The server certificate used by reverse proxy. + :paramtype reverse_proxy_certificate: ~azure.mgmt.servicefabric.models.CertificateDescription + :keyword upgrade_description: The policy to use when upgrading the cluster. + :paramtype upgrade_description: ~azure.mgmt.servicefabric.models.ClusterUpgradePolicy + :keyword application_type_versions_cleanup_policy: The policy used to clean up unused versions. + :paramtype application_type_versions_cleanup_policy: + ~azure.mgmt.servicefabric.models.ApplicationTypeVersionsCleanupPolicy + :keyword upgrade_mode: The upgrade mode of the cluster when new Service Fabric runtime version + is available. Possible values include: "Automatic", "Manual". Default value: "Automatic". + :paramtype upgrade_mode: str or ~azure.mgmt.servicefabric.models.UpgradeMode + :keyword sf_zonal_upgrade_mode: This property controls the logical grouping of VMs in upgrade + domains (UDs). This property can't be modified if a node type with multiple Availability Zones + is already present in the cluster. Possible values include: "Parallel", "Hierarchical". + :paramtype sf_zonal_upgrade_mode: str or ~azure.mgmt.servicefabric.models.SfZonalUpgradeMode + :keyword vmss_zonal_upgrade_mode: This property defines the upgrade mode for the virtual + machine scale set, it is mandatory if a node type with multiple Availability Zones is added. + Possible values include: "Parallel", "Hierarchical". + :paramtype vmss_zonal_upgrade_mode: str or + ~azure.mgmt.servicefabric.models.VmssZonalUpgradeMode + :keyword infrastructure_service_manager: Indicates if infrastructure service manager is + enabled. + :paramtype infrastructure_service_manager: bool + :keyword upgrade_wave: Indicates when new cluster runtime version upgrades will be applied + after they are released. By default is Wave0. Only applies when **upgradeMode** is set to + 'Automatic'. Possible values include: "Wave0", "Wave1", "Wave2". + :paramtype upgrade_wave: str or ~azure.mgmt.servicefabric.models.ClusterUpgradeCadence + :keyword upgrade_pause_start_timestamp_utc: The start timestamp to pause runtime version + upgrades on the cluster (UTC). + :paramtype upgrade_pause_start_timestamp_utc: ~datetime.datetime + :keyword upgrade_pause_end_timestamp_utc: The end timestamp of pause runtime version upgrades + on the cluster (UTC). + :paramtype upgrade_pause_end_timestamp_utc: ~datetime.datetime + :keyword wave_upgrade_paused: Boolean to pause automatic runtime version upgrades to the + cluster. + :paramtype wave_upgrade_paused: bool + :keyword notifications: Indicates a list of notification channels for cluster events. + :paramtype notifications: list[~azure.mgmt.servicefabric.models.Notification] + """ super(ClusterUpdateParameters, self).__init__(**kwargs) self.tags = tags self.add_on_features = add_on_features @@ -1890,31 +2500,31 @@ class ClusterUpgradeDeltaHealthPolicy(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param max_percent_delta_unhealthy_nodes: Required. The maximum allowed percentage of nodes + :ivar max_percent_delta_unhealthy_nodes: Required. The maximum allowed percentage of nodes health degradation allowed during cluster upgrades. The delta is measured between the state of the nodes at the beginning of upgrade and the state of the nodes at the time of the health evaluation. The check is performed after every upgrade domain upgrade completion to make sure the global state of the cluster is within tolerated limits. - :type max_percent_delta_unhealthy_nodes: int - :param max_percent_upgrade_domain_delta_unhealthy_nodes: Required. The maximum allowed + :vartype max_percent_delta_unhealthy_nodes: int + :ivar max_percent_upgrade_domain_delta_unhealthy_nodes: Required. The maximum allowed percentage of upgrade domain nodes health degradation allowed during cluster upgrades. The delta is measured between the state of the upgrade domain nodes at the beginning of upgrade and the state of the upgrade domain nodes at the time of the health evaluation. The check is performed after every upgrade domain upgrade completion for all completed upgrade domains to make sure the state of the upgrade domains is within tolerated limits. - :type max_percent_upgrade_domain_delta_unhealthy_nodes: int - :param max_percent_delta_unhealthy_applications: Required. The maximum allowed percentage of + :vartype max_percent_upgrade_domain_delta_unhealthy_nodes: int + :ivar max_percent_delta_unhealthy_applications: Required. The maximum allowed percentage of applications health degradation allowed during cluster upgrades. The delta is measured between the state of the applications at the beginning of upgrade and the state of the applications at the time of the health evaluation. The check is performed after every upgrade domain upgrade completion to make sure the global state of the cluster is within tolerated limits. System services are not included in this. - :type max_percent_delta_unhealthy_applications: int - :param application_delta_health_policies: Defines the application delta health policy map used + :vartype max_percent_delta_unhealthy_applications: int + :ivar application_delta_health_policies: Defines the application delta health policy map used to evaluate the health of an application or one of its child entities when upgrading the cluster. - :type application_delta_health_policies: dict[str, + :vartype application_delta_health_policies: dict[str, ~azure.mgmt.servicefabric.models.ApplicationDeltaHealthPolicy] """ @@ -1940,6 +2550,34 @@ def __init__( application_delta_health_policies: Optional[Dict[str, "ApplicationDeltaHealthPolicy"]] = None, **kwargs ): + """ + :keyword max_percent_delta_unhealthy_nodes: Required. The maximum allowed percentage of nodes + health degradation allowed during cluster upgrades. + The delta is measured between the state of the nodes at the beginning of upgrade and the state + of the nodes at the time of the health evaluation. + The check is performed after every upgrade domain upgrade completion to make sure the global + state of the cluster is within tolerated limits. + :paramtype max_percent_delta_unhealthy_nodes: int + :keyword max_percent_upgrade_domain_delta_unhealthy_nodes: Required. The maximum allowed + percentage of upgrade domain nodes health degradation allowed during cluster upgrades. + The delta is measured between the state of the upgrade domain nodes at the beginning of + upgrade and the state of the upgrade domain nodes at the time of the health evaluation. + The check is performed after every upgrade domain upgrade completion for all completed upgrade + domains to make sure the state of the upgrade domains is within tolerated limits. + :paramtype max_percent_upgrade_domain_delta_unhealthy_nodes: int + :keyword max_percent_delta_unhealthy_applications: Required. The maximum allowed percentage of + applications health degradation allowed during cluster upgrades. + The delta is measured between the state of the applications at the beginning of upgrade and + the state of the applications at the time of the health evaluation. + The check is performed after every upgrade domain upgrade completion to make sure the global + state of the cluster is within tolerated limits. System services are not included in this. + :paramtype max_percent_delta_unhealthy_applications: int + :keyword application_delta_health_policies: Defines the application delta health policy map + used to evaluate the health of an application or one of its child entities when upgrading the + cluster. + :paramtype application_delta_health_policies: dict[str, + ~azure.mgmt.servicefabric.models.ApplicationDeltaHealthPolicy] + """ super(ClusterUpgradeDeltaHealthPolicy, self).__init__(**kwargs) self.max_percent_delta_unhealthy_nodes = max_percent_delta_unhealthy_nodes self.max_percent_upgrade_domain_delta_unhealthy_nodes = max_percent_upgrade_domain_delta_unhealthy_nodes @@ -1952,38 +2590,38 @@ class ClusterUpgradePolicy(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param force_restart: If true, then processes are forcefully restarted during upgrade even when + :ivar force_restart: If true, then processes are forcefully restarted during upgrade even when the code version has not changed (the upgrade only changes configuration or data). - :type force_restart: bool - :param upgrade_replica_set_check_timeout: Required. The maximum amount of time to block + :vartype force_restart: bool + :ivar upgrade_replica_set_check_timeout: Required. The maximum amount of time to block processing of an upgrade domain and prevent loss of availability when there are unexpected issues. When this timeout expires, processing of the upgrade domain will proceed regardless of availability loss issues. The timeout is reset at the start of each upgrade domain. The timeout can be in either hh:mm:ss or in d.hh:mm:ss.ms format. - :type upgrade_replica_set_check_timeout: str - :param health_check_wait_duration: Required. The length of time to wait after completing an + :vartype upgrade_replica_set_check_timeout: str + :ivar health_check_wait_duration: Required. The length of time to wait after completing an upgrade domain before performing health checks. The duration can be in either hh:mm:ss or in d.hh:mm:ss.ms format. - :type health_check_wait_duration: str - :param health_check_stable_duration: Required. The amount of time that the application or + :vartype health_check_wait_duration: str + :ivar health_check_stable_duration: Required. The amount of time that the application or cluster must remain healthy before the upgrade proceeds to the next upgrade domain. The duration can be in either hh:mm:ss or in d.hh:mm:ss.ms format. - :type health_check_stable_duration: str - :param health_check_retry_timeout: Required. The amount of time to retry health evaluation when + :vartype health_check_stable_duration: str + :ivar health_check_retry_timeout: Required. The amount of time to retry health evaluation when the application or cluster is unhealthy before the upgrade rolls back. The timeout can be in either hh:mm:ss or in d.hh:mm:ss.ms format. - :type health_check_retry_timeout: str - :param upgrade_timeout: Required. The amount of time the overall upgrade has to complete before + :vartype health_check_retry_timeout: str + :ivar upgrade_timeout: Required. The amount of time the overall upgrade has to complete before the upgrade rolls back. The timeout can be in either hh:mm:ss or in d.hh:mm:ss.ms format. - :type upgrade_timeout: str - :param upgrade_domain_timeout: Required. The amount of time each upgrade domain has to complete + :vartype upgrade_timeout: str + :ivar upgrade_domain_timeout: Required. The amount of time each upgrade domain has to complete before the upgrade rolls back. The timeout can be in either hh:mm:ss or in d.hh:mm:ss.ms format. - :type upgrade_domain_timeout: str - :param health_policy: Required. The cluster health policy used when upgrading the cluster. - :type health_policy: ~azure.mgmt.servicefabric.models.ClusterHealthPolicy - :param delta_health_policy: The cluster delta health policy used when upgrading the cluster. - :type delta_health_policy: ~azure.mgmt.servicefabric.models.ClusterUpgradeDeltaHealthPolicy + :vartype upgrade_domain_timeout: str + :ivar health_policy: Required. The cluster health policy used when upgrading the cluster. + :vartype health_policy: ~azure.mgmt.servicefabric.models.ClusterHealthPolicy + :ivar delta_health_policy: The cluster delta health policy used when upgrading the cluster. + :vartype delta_health_policy: ~azure.mgmt.servicefabric.models.ClusterUpgradeDeltaHealthPolicy """ _validation = { @@ -2022,6 +2660,42 @@ def __init__( delta_health_policy: Optional["ClusterUpgradeDeltaHealthPolicy"] = None, **kwargs ): + """ + :keyword force_restart: If true, then processes are forcefully restarted during upgrade even + when the code version has not changed (the upgrade only changes configuration or data). + :paramtype force_restart: bool + :keyword upgrade_replica_set_check_timeout: Required. The maximum amount of time to block + processing of an upgrade domain and prevent loss of availability when there are unexpected + issues. When this timeout expires, processing of the upgrade domain will proceed regardless of + availability loss issues. The timeout is reset at the start of each upgrade domain. The timeout + can be in either hh:mm:ss or in d.hh:mm:ss.ms format. + :paramtype upgrade_replica_set_check_timeout: str + :keyword health_check_wait_duration: Required. The length of time to wait after completing an + upgrade domain before performing health checks. The duration can be in either hh:mm:ss or in + d.hh:mm:ss.ms format. + :paramtype health_check_wait_duration: str + :keyword health_check_stable_duration: Required. The amount of time that the application or + cluster must remain healthy before the upgrade proceeds to the next upgrade domain. The + duration can be in either hh:mm:ss or in d.hh:mm:ss.ms format. + :paramtype health_check_stable_duration: str + :keyword health_check_retry_timeout: Required. The amount of time to retry health evaluation + when the application or cluster is unhealthy before the upgrade rolls back. The timeout can be + in either hh:mm:ss or in d.hh:mm:ss.ms format. + :paramtype health_check_retry_timeout: str + :keyword upgrade_timeout: Required. The amount of time the overall upgrade has to complete + before the upgrade rolls back. The timeout can be in either hh:mm:ss or in d.hh:mm:ss.ms + format. + :paramtype upgrade_timeout: str + :keyword upgrade_domain_timeout: Required. The amount of time each upgrade domain has to + complete before the upgrade rolls back. The timeout can be in either hh:mm:ss or in + d.hh:mm:ss.ms format. + :paramtype upgrade_domain_timeout: str + :keyword health_policy: Required. The cluster health policy used when upgrading the cluster. + :paramtype health_policy: ~azure.mgmt.servicefabric.models.ClusterHealthPolicy + :keyword delta_health_policy: The cluster delta health policy used when upgrading the cluster. + :paramtype delta_health_policy: + ~azure.mgmt.servicefabric.models.ClusterUpgradeDeltaHealthPolicy + """ super(ClusterUpgradePolicy, self).__init__(**kwargs) self.force_restart = force_restart self.upgrade_replica_set_check_timeout = upgrade_replica_set_check_timeout @@ -2037,13 +2711,13 @@ def __init__( class ClusterVersionDetails(msrest.serialization.Model): """The detail of the Service Fabric runtime version result. - :param code_version: The Service Fabric runtime version of the cluster. - :type code_version: str - :param support_expiry_utc: The date of expiry of support of the version. - :type support_expiry_utc: str - :param environment: Indicates if this version is for Windows or Linux operating system. - Possible values include: "Windows", "Linux". - :type environment: str or ~azure.mgmt.servicefabric.models.ClusterEnvironment + :ivar code_version: The Service Fabric runtime version of the cluster. + :vartype code_version: str + :ivar support_expiry_utc: The date of expiry of support of the version. + :vartype support_expiry_utc: str + :ivar environment: Indicates if this version is for Windows or Linux operating system. Possible + values include: "Windows", "Linux". + :vartype environment: str or ~azure.mgmt.servicefabric.models.ClusterEnvironment """ _attribute_map = { @@ -2060,6 +2734,15 @@ def __init__( environment: Optional[Union[str, "ClusterEnvironment"]] = None, **kwargs ): + """ + :keyword code_version: The Service Fabric runtime version of the cluster. + :paramtype code_version: str + :keyword support_expiry_utc: The date of expiry of support of the version. + :paramtype support_expiry_utc: str + :keyword environment: Indicates if this version is for Windows or Linux operating system. + Possible values include: "Windows", "Linux". + :paramtype environment: str or ~azure.mgmt.servicefabric.models.ClusterEnvironment + """ super(ClusterVersionDetails, self).__init__(**kwargs) self.code_version = code_version self.support_expiry_utc = support_expiry_utc @@ -2071,19 +2754,19 @@ class DiagnosticsStorageAccountConfig(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param storage_account_name: Required. The Azure storage account name. - :type storage_account_name: str - :param protected_account_key_name: Required. The protected diagnostics storage key name. - :type protected_account_key_name: str - :param protected_account_key_name2: The secondary protected diagnostics storage key name. If - one of the storage account keys is rotated the cluster will fallback to using the other. - :type protected_account_key_name2: str - :param blob_endpoint: Required. The blob endpoint of the azure storage account. - :type blob_endpoint: str - :param queue_endpoint: Required. The queue endpoint of the azure storage account. - :type queue_endpoint: str - :param table_endpoint: Required. The table endpoint of the azure storage account. - :type table_endpoint: str + :ivar storage_account_name: Required. The Azure storage account name. + :vartype storage_account_name: str + :ivar protected_account_key_name: Required. The protected diagnostics storage key name. + :vartype protected_account_key_name: str + :ivar protected_account_key_name2: The secondary protected diagnostics storage key name. If one + of the storage account keys is rotated the cluster will fallback to using the other. + :vartype protected_account_key_name2: str + :ivar blob_endpoint: Required. The blob endpoint of the azure storage account. + :vartype blob_endpoint: str + :ivar queue_endpoint: Required. The queue endpoint of the azure storage account. + :vartype queue_endpoint: str + :ivar table_endpoint: Required. The table endpoint of the azure storage account. + :vartype table_endpoint: str """ _validation = { @@ -2114,6 +2797,21 @@ def __init__( protected_account_key_name2: Optional[str] = None, **kwargs ): + """ + :keyword storage_account_name: Required. The Azure storage account name. + :paramtype storage_account_name: str + :keyword protected_account_key_name: Required. The protected diagnostics storage key name. + :paramtype protected_account_key_name: str + :keyword protected_account_key_name2: The secondary protected diagnostics storage key name. If + one of the storage account keys is rotated the cluster will fallback to using the other. + :paramtype protected_account_key_name2: str + :keyword blob_endpoint: Required. The blob endpoint of the azure storage account. + :paramtype blob_endpoint: str + :keyword queue_endpoint: Required. The queue endpoint of the azure storage account. + :paramtype queue_endpoint: str + :keyword table_endpoint: Required. The table endpoint of the azure storage account. + :paramtype table_endpoint: str + """ super(DiagnosticsStorageAccountConfig, self).__init__(**kwargs) self.storage_account_name = storage_account_name self.protected_account_key_name = protected_account_key_name @@ -2128,10 +2826,10 @@ class EndpointRangeDescription(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param start_port: Required. Starting port of a range of ports. - :type start_port: int - :param end_port: Required. End port of a range of ports. - :type end_port: int + :ivar start_port: Required. Starting port of a range of ports. + :vartype start_port: int + :ivar end_port: Required. End port of a range of ports. + :vartype end_port: int """ _validation = { @@ -2151,6 +2849,12 @@ def __init__( end_port: int, **kwargs ): + """ + :keyword start_port: Required. Starting port of a range of ports. + :paramtype start_port: int + :keyword end_port: Required. End port of a range of ports. + :paramtype end_port: int + """ super(EndpointRangeDescription, self).__init__(**kwargs) self.start_port = start_port self.end_port = end_port @@ -2159,8 +2863,8 @@ def __init__( class ErrorModel(msrest.serialization.Model): """The structure of the error. - :param error: The error details. - :type error: ~azure.mgmt.servicefabric.models.ErrorModelError + :ivar error: The error details. + :vartype error: ~azure.mgmt.servicefabric.models.ErrorModelError """ _attribute_map = { @@ -2173,6 +2877,10 @@ def __init__( error: Optional["ErrorModelError"] = None, **kwargs ): + """ + :keyword error: The error details. + :paramtype error: ~azure.mgmt.servicefabric.models.ErrorModelError + """ super(ErrorModel, self).__init__(**kwargs) self.error = error @@ -2180,10 +2888,10 @@ def __init__( class ErrorModelError(msrest.serialization.Model): """The error details. - :param code: The error code. - :type code: str - :param message: The error message. - :type message: str + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str """ _attribute_map = { @@ -2198,6 +2906,12 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword code: The error code. + :paramtype code: str + :keyword message: The error message. + :paramtype message: str + """ super(ErrorModelError, self).__init__(**kwargs) self.code = code self.message = message @@ -2214,13 +2928,13 @@ class ManagedIdentity(msrest.serialization.Model): :ivar tenant_id: The tenant id of the managed identity. This property will only be provided for a system assigned identity. :vartype tenant_id: str - :param type: The type of managed identity for the resource. Possible values include: + :ivar type: The type of managed identity for the resource. Possible values include: "SystemAssigned", "UserAssigned", "SystemAssigned, UserAssigned", "None". - :type type: str or ~azure.mgmt.servicefabric.models.ManagedIdentityType - :param user_assigned_identities: The list of user identities associated with the resource. The + :vartype type: str or ~azure.mgmt.servicefabric.models.ManagedIdentityType + :ivar user_assigned_identities: The list of user identities associated with the resource. The user identity dictionary key references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. - :type user_assigned_identities: dict[str, + :vartype user_assigned_identities: dict[str, ~azure.mgmt.servicefabric.models.UserAssignedIdentity] """ @@ -2243,6 +2957,16 @@ def __init__( user_assigned_identities: Optional[Dict[str, "UserAssignedIdentity"]] = None, **kwargs ): + """ + :keyword type: The type of managed identity for the resource. Possible values include: + "SystemAssigned", "UserAssigned", "SystemAssigned, UserAssigned", "None". + :paramtype type: str or ~azure.mgmt.servicefabric.models.ManagedIdentityType + :keyword user_assigned_identities: The list of user identities associated with the resource. + The user identity dictionary key references will be ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + :paramtype user_assigned_identities: dict[str, + ~azure.mgmt.servicefabric.models.UserAssignedIdentity] + """ super(ManagedIdentity, self).__init__(**kwargs) self.principal_id = None self.tenant_id = None @@ -2258,9 +2982,9 @@ class PartitionSchemeDescription(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param partition_scheme: Required. Specifies how the service is partitioned.Constant filled by - server. Possible values include: "Invalid", "Singleton", "UniformInt64Range", "Named". - :type partition_scheme: str or ~azure.mgmt.servicefabric.models.PartitionScheme + :ivar partition_scheme: Required. Specifies how the service is partitioned.Constant filled by + server. Possible values include: "Invalid", "Singleton", "UniformInt64Range", "Named". + :vartype partition_scheme: str or ~azure.mgmt.servicefabric.models.PartitionScheme """ _validation = { @@ -2279,6 +3003,8 @@ def __init__( self, **kwargs ): + """ + """ super(PartitionSchemeDescription, self).__init__(**kwargs) self.partition_scheme = None # type: Optional[str] @@ -2288,14 +3014,14 @@ class NamedPartitionSchemeDescription(PartitionSchemeDescription): All required parameters must be populated in order to send to Azure. - :param partition_scheme: Required. Specifies how the service is partitioned.Constant filled by - server. Possible values include: "Invalid", "Singleton", "UniformInt64Range", "Named". - :type partition_scheme: str or ~azure.mgmt.servicefabric.models.PartitionScheme - :param count: Required. The number of partitions. - :type count: int - :param names: Required. Array of size specified by the ‘count’ parameter, for the names of the + :ivar partition_scheme: Required. Specifies how the service is partitioned.Constant filled by + server. Possible values include: "Invalid", "Singleton", "UniformInt64Range", "Named". + :vartype partition_scheme: str or ~azure.mgmt.servicefabric.models.PartitionScheme + :ivar count: Required. The number of partitions. + :vartype count: int + :ivar names: Required. Array of size specified by the ‘count’ parameter, for the names of the partitions. - :type names: list[str] + :vartype names: list[str] """ _validation = { @@ -2317,6 +3043,13 @@ def __init__( names: List[str], **kwargs ): + """ + :keyword count: Required. The number of partitions. + :paramtype count: int + :keyword names: Required. Array of size specified by the ‘count’ parameter, for the names of + the partitions. + :paramtype names: list[str] + """ super(NamedPartitionSchemeDescription, self).__init__(**kwargs) self.partition_scheme = 'Named' # type: str self.count = count @@ -2328,19 +3061,19 @@ class NodeTypeDescription(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The name of the node type. - :type name: str - :param placement_properties: The placement tags applied to nodes in the node type, which can be + :ivar name: Required. The name of the node type. + :vartype name: str + :ivar placement_properties: The placement tags applied to nodes in the node type, which can be used to indicate where certain services (workload) should run. - :type placement_properties: dict[str, str] - :param capacities: The capacity tags applied to the nodes in the node type, the cluster - resource manager uses these tags to understand how much resource a node has. - :type capacities: dict[str, str] - :param client_connection_endpoint_port: Required. The TCP cluster management endpoint port. - :type client_connection_endpoint_port: int - :param http_gateway_endpoint_port: Required. The HTTP cluster management endpoint port. - :type http_gateway_endpoint_port: int - :param durability_level: The durability level of the node type. Learn about `DurabilityLevel + :vartype placement_properties: dict[str, str] + :ivar capacities: The capacity tags applied to the nodes in the node type, the cluster resource + manager uses these tags to understand how much resource a node has. + :vartype capacities: dict[str, str] + :ivar client_connection_endpoint_port: Required. The TCP cluster management endpoint port. + :vartype client_connection_endpoint_port: int + :ivar http_gateway_endpoint_port: Required. The HTTP cluster management endpoint port. + :vartype http_gateway_endpoint_port: int + :ivar durability_level: The durability level of the node type. Learn about `DurabilityLevel `_. @@ -2349,30 +3082,30 @@ class NodeTypeDescription(msrest.serialization.Model): * Gold - The infrastructure jobs can be paused for a duration of 2 hours per UD. Gold durability can be enabled only on full node VM skus like D15_V2, G5 etc. Possible values include: "Bronze", "Silver", "Gold". - :type durability_level: str or ~azure.mgmt.servicefabric.models.DurabilityLevel - :param application_ports: The range of ports from which cluster assigned port to Service Fabric + :vartype durability_level: str or ~azure.mgmt.servicefabric.models.DurabilityLevel + :ivar application_ports: The range of ports from which cluster assigned port to Service Fabric applications. - :type application_ports: ~azure.mgmt.servicefabric.models.EndpointRangeDescription - :param ephemeral_ports: The range of ephemeral ports that nodes in this node type should be + :vartype application_ports: ~azure.mgmt.servicefabric.models.EndpointRangeDescription + :ivar ephemeral_ports: The range of ephemeral ports that nodes in this node type should be configured with. - :type ephemeral_ports: ~azure.mgmt.servicefabric.models.EndpointRangeDescription - :param is_primary: Required. The node type on which system services will run. Only one node - type should be marked as primary. Primary node type cannot be deleted or changed for existing + :vartype ephemeral_ports: ~azure.mgmt.servicefabric.models.EndpointRangeDescription + :ivar is_primary: Required. The node type on which system services will run. Only one node type + should be marked as primary. Primary node type cannot be deleted or changed for existing clusters. - :type is_primary: bool - :param vm_instance_count: Required. VMInstanceCount should be 1 to n, where n indicates the + :vartype is_primary: bool + :ivar vm_instance_count: Required. VMInstanceCount should be 1 to n, where n indicates the number of VM instances corresponding to this nodeType. VMInstanceCount = 0 can be done only in these scenarios: NodeType is a secondary nodeType. Durability = Bronze or Durability >= Bronze and InfrastructureServiceManager = true. If VMInstanceCount = 0, implies the VMs for this nodeType will not be used for the initial cluster size computation. - :type vm_instance_count: int - :param reverse_proxy_endpoint_port: The endpoint used by reverse proxy. - :type reverse_proxy_endpoint_port: int - :param is_stateless: Indicates if the node type can only host Stateless workloads. - :type is_stateless: bool - :param multiple_availability_zones: Indicates if the node type is enabled to support multiple + :vartype vm_instance_count: int + :ivar reverse_proxy_endpoint_port: The endpoint used by reverse proxy. + :vartype reverse_proxy_endpoint_port: int + :ivar is_stateless: Indicates if the node type can only host Stateless workloads. + :vartype is_stateless: bool + :ivar multiple_availability_zones: Indicates if the node type is enabled to support multiple zones. - :type multiple_availability_zones: bool + :vartype multiple_availability_zones: bool """ _validation = { @@ -2417,6 +3150,53 @@ def __init__( multiple_availability_zones: Optional[bool] = None, **kwargs ): + """ + :keyword name: Required. The name of the node type. + :paramtype name: str + :keyword placement_properties: The placement tags applied to nodes in the node type, which can + be used to indicate where certain services (workload) should run. + :paramtype placement_properties: dict[str, str] + :keyword capacities: The capacity tags applied to the nodes in the node type, the cluster + resource manager uses these tags to understand how much resource a node has. + :paramtype capacities: dict[str, str] + :keyword client_connection_endpoint_port: Required. The TCP cluster management endpoint port. + :paramtype client_connection_endpoint_port: int + :keyword http_gateway_endpoint_port: Required. The HTTP cluster management endpoint port. + :paramtype http_gateway_endpoint_port: int + :keyword durability_level: The durability level of the node type. Learn about `DurabilityLevel + `_. + + + * Bronze - No privileges. This is the default. + * Silver - The infrastructure jobs can be paused for a duration of 10 minutes per UD. + * Gold - The infrastructure jobs can be paused for a duration of 2 hours per UD. Gold + durability can be enabled only on full node VM skus like D15_V2, G5 etc. Possible values + include: "Bronze", "Silver", "Gold". + :paramtype durability_level: str or ~azure.mgmt.servicefabric.models.DurabilityLevel + :keyword application_ports: The range of ports from which cluster assigned port to Service + Fabric applications. + :paramtype application_ports: ~azure.mgmt.servicefabric.models.EndpointRangeDescription + :keyword ephemeral_ports: The range of ephemeral ports that nodes in this node type should be + configured with. + :paramtype ephemeral_ports: ~azure.mgmt.servicefabric.models.EndpointRangeDescription + :keyword is_primary: Required. The node type on which system services will run. Only one node + type should be marked as primary. Primary node type cannot be deleted or changed for existing + clusters. + :paramtype is_primary: bool + :keyword vm_instance_count: Required. VMInstanceCount should be 1 to n, where n indicates the + number of VM instances corresponding to this nodeType. VMInstanceCount = 0 can be done only in + these scenarios: NodeType is a secondary nodeType. Durability = Bronze or Durability >= Bronze + and InfrastructureServiceManager = true. If VMInstanceCount = 0, implies the VMs for this + nodeType will not be used for the initial cluster size computation. + :paramtype vm_instance_count: int + :keyword reverse_proxy_endpoint_port: The endpoint used by reverse proxy. + :paramtype reverse_proxy_endpoint_port: int + :keyword is_stateless: Indicates if the node type can only host Stateless workloads. + :paramtype is_stateless: bool + :keyword multiple_availability_zones: Indicates if the node type is enabled to support multiple + zones. + :paramtype multiple_availability_zones: bool + """ super(NodeTypeDescription, self).__init__(**kwargs) self.name = name self.placement_properties = placement_properties @@ -2438,16 +3218,16 @@ class Notification(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param is_enabled: Required. Indicates if the notification is enabled. - :type is_enabled: bool - :param notification_category: Required. The category of notification. Possible values include: + :ivar is_enabled: Required. Indicates if the notification is enabled. + :vartype is_enabled: bool + :ivar notification_category: Required. The category of notification. Possible values include: "WaveProgress". - :type notification_category: str or ~azure.mgmt.servicefabric.models.NotificationCategory - :param notification_level: Required. The level of notification. Possible values include: + :vartype notification_category: str or ~azure.mgmt.servicefabric.models.NotificationCategory + :ivar notification_level: Required. The level of notification. Possible values include: "Critical", "All". - :type notification_level: str or ~azure.mgmt.servicefabric.models.NotificationLevel - :param notification_targets: Required. List of targets that subscribe to the notification. - :type notification_targets: list[~azure.mgmt.servicefabric.models.NotificationTarget] + :vartype notification_level: str or ~azure.mgmt.servicefabric.models.NotificationLevel + :ivar notification_targets: Required. List of targets that subscribe to the notification. + :vartype notification_targets: list[~azure.mgmt.servicefabric.models.NotificationTarget] """ _validation = { @@ -2473,6 +3253,18 @@ def __init__( notification_targets: List["NotificationTarget"], **kwargs ): + """ + :keyword is_enabled: Required. Indicates if the notification is enabled. + :paramtype is_enabled: bool + :keyword notification_category: Required. The category of notification. Possible values + include: "WaveProgress". + :paramtype notification_category: str or ~azure.mgmt.servicefabric.models.NotificationCategory + :keyword notification_level: Required. The level of notification. Possible values include: + "Critical", "All". + :paramtype notification_level: str or ~azure.mgmt.servicefabric.models.NotificationLevel + :keyword notification_targets: Required. List of targets that subscribe to the notification. + :paramtype notification_targets: list[~azure.mgmt.servicefabric.models.NotificationTarget] + """ super(Notification, self).__init__(**kwargs) self.is_enabled = is_enabled self.notification_category = notification_category @@ -2485,12 +3277,12 @@ class NotificationTarget(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param notification_channel: Required. The notification channel indicates the type of receivers + :ivar notification_channel: Required. The notification channel indicates the type of receivers subscribed to the notification, either user or subscription. Possible values include: "EmailUser", "EmailSubscription". - :type notification_channel: str or ~azure.mgmt.servicefabric.models.NotificationChannel - :param receivers: Required. List of targets that subscribe to the notification. - :type receivers: list[str] + :vartype notification_channel: str or ~azure.mgmt.servicefabric.models.NotificationChannel + :ivar receivers: Required. List of targets that subscribe to the notification. + :vartype receivers: list[str] """ _validation = { @@ -2510,6 +3302,14 @@ def __init__( receivers: List[str], **kwargs ): + """ + :keyword notification_channel: Required. The notification channel indicates the type of + receivers subscribed to the notification, either user or subscription. Possible values include: + "EmailUser", "EmailSubscription". + :paramtype notification_channel: str or ~azure.mgmt.servicefabric.models.NotificationChannel + :keyword receivers: Required. List of targets that subscribe to the notification. + :paramtype receivers: list[str] + """ super(NotificationTarget, self).__init__(**kwargs) self.notification_channel = notification_channel self.receivers = receivers @@ -2520,8 +3320,8 @@ class OperationListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param value: List of operations supported by the Service Fabric resource provider. - :type value: list[~azure.mgmt.servicefabric.models.OperationResult] + :ivar value: List of operations supported by the Service Fabric resource provider. + :vartype value: list[~azure.mgmt.servicefabric.models.OperationResult] :ivar next_link: URL to get the next set of operation list results if there are any. :vartype next_link: str """ @@ -2541,6 +3341,10 @@ def __init__( value: Optional[List["OperationResult"]] = None, **kwargs ): + """ + :keyword value: List of operations supported by the Service Fabric resource provider. + :paramtype value: list[~azure.mgmt.servicefabric.models.OperationResult] + """ super(OperationListResult, self).__init__(**kwargs) self.value = value self.next_link = None @@ -2549,16 +3353,16 @@ def __init__( class OperationResult(msrest.serialization.Model): """Available operation list result. - :param name: The name of the operation. - :type name: str - :param is_data_action: Indicates whether the operation is a data action. - :type is_data_action: bool - :param display: The object that represents the operation. - :type display: ~azure.mgmt.servicefabric.models.AvailableOperationDisplay - :param origin: Origin result. - :type origin: str - :param next_link: The URL to use for getting the next set of results. - :type next_link: str + :ivar name: The name of the operation. + :vartype name: str + :ivar is_data_action: Indicates whether the operation is a data action. + :vartype is_data_action: bool + :ivar display: The object that represents the operation. + :vartype display: ~azure.mgmt.servicefabric.models.AvailableOperationDisplay + :ivar origin: Origin result. + :vartype origin: str + :ivar next_link: The URL to use for getting the next set of results. + :vartype next_link: str """ _attribute_map = { @@ -2579,6 +3383,18 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword name: The name of the operation. + :paramtype name: str + :keyword is_data_action: Indicates whether the operation is a data action. + :paramtype is_data_action: bool + :keyword display: The object that represents the operation. + :paramtype display: ~azure.mgmt.servicefabric.models.AvailableOperationDisplay + :keyword origin: Origin result. + :paramtype origin: str + :keyword next_link: The URL to use for getting the next set of results. + :paramtype next_link: str + """ super(OperationResult, self).__init__(**kwargs) self.name = name self.is_data_action = is_data_action @@ -2592,11 +3408,10 @@ class ServerCertificateCommonName(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param certificate_common_name: Required. The common name of the server certificate. - :type certificate_common_name: str - :param certificate_issuer_thumbprint: Required. The issuer thumbprint of the server - certificate. - :type certificate_issuer_thumbprint: str + :ivar certificate_common_name: Required. The common name of the server certificate. + :vartype certificate_common_name: str + :ivar certificate_issuer_thumbprint: Required. The issuer thumbprint of the server certificate. + :vartype certificate_issuer_thumbprint: str """ _validation = { @@ -2616,6 +3431,13 @@ def __init__( certificate_issuer_thumbprint: str, **kwargs ): + """ + :keyword certificate_common_name: Required. The common name of the server certificate. + :paramtype certificate_common_name: str + :keyword certificate_issuer_thumbprint: Required. The issuer thumbprint of the server + certificate. + :paramtype certificate_issuer_thumbprint: str + """ super(ServerCertificateCommonName, self).__init__(**kwargs) self.certificate_common_name = certificate_common_name self.certificate_issuer_thumbprint = certificate_issuer_thumbprint @@ -2624,13 +3446,13 @@ def __init__( class ServerCertificateCommonNames(msrest.serialization.Model): """Describes a list of server certificates referenced by common name that are used to secure the cluster. - :param common_names: The list of server certificates referenced by common name that are used to + :ivar common_names: The list of server certificates referenced by common name that are used to secure the cluster. - :type common_names: list[~azure.mgmt.servicefabric.models.ServerCertificateCommonName] - :param x509_store_name: The local certificate store location. Possible values include: + :vartype common_names: list[~azure.mgmt.servicefabric.models.ServerCertificateCommonName] + :ivar x509_store_name: The local certificate store location. Possible values include: "AddressBook", "AuthRoot", "CertificateAuthority", "Disallowed", "My", "Root", "TrustedPeople", "TrustedPublisher". - :type x509_store_name: str or ~azure.mgmt.servicefabric.models.StoreName + :vartype x509_store_name: str or ~azure.mgmt.servicefabric.models.StoreName """ _attribute_map = { @@ -2645,6 +3467,15 @@ def __init__( x509_store_name: Optional[Union[str, "StoreName"]] = None, **kwargs ): + """ + :keyword common_names: The list of server certificates referenced by common name that are used + to secure the cluster. + :paramtype common_names: list[~azure.mgmt.servicefabric.models.ServerCertificateCommonName] + :keyword x509_store_name: The local certificate store location. Possible values include: + "AddressBook", "AuthRoot", "CertificateAuthority", "Disallowed", "My", "Root", "TrustedPeople", + "TrustedPublisher". + :paramtype x509_store_name: str or ~azure.mgmt.servicefabric.models.StoreName + """ super(ServerCertificateCommonNames, self).__init__(**kwargs) self.common_names = common_names self.x509_store_name = x509_store_name @@ -2655,13 +3486,13 @@ class ServiceCorrelationDescription(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param scheme: Required. The ServiceCorrelationScheme which describes the relationship between + :ivar scheme: Required. The ServiceCorrelationScheme which describes the relationship between this service and the service specified via ServiceName. Possible values include: "Invalid", "Affinity", "AlignedAffinity", "NonAlignedAffinity". - :type scheme: str or ~azure.mgmt.servicefabric.models.ServiceCorrelationScheme - :param service_name: Required. The name of the service that the correlation relationship is + :vartype scheme: str or ~azure.mgmt.servicefabric.models.ServiceCorrelationScheme + :ivar service_name: Required. The name of the service that the correlation relationship is established with. - :type service_name: str + :vartype service_name: str """ _validation = { @@ -2681,6 +3512,15 @@ def __init__( service_name: str, **kwargs ): + """ + :keyword scheme: Required. The ServiceCorrelationScheme which describes the relationship + between this service and the service specified via ServiceName. Possible values include: + "Invalid", "Affinity", "AlignedAffinity", "NonAlignedAffinity". + :paramtype scheme: str or ~azure.mgmt.servicefabric.models.ServiceCorrelationScheme + :keyword service_name: Required. The name of the service that the correlation relationship is + established with. + :paramtype service_name: str + """ super(ServiceCorrelationDescription, self).__init__(**kwargs) self.scheme = scheme self.service_name = service_name @@ -2691,22 +3531,22 @@ class ServiceLoadMetricDescription(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The name of the metric. If the service chooses to report load during + :ivar name: Required. The name of the metric. If the service chooses to report load during runtime, the load metric name should match the name that is specified in Name exactly. Note that metric names are case sensitive. - :type name: str - :param weight: The service load metric relative weight, compared to other metrics configured - for this service, as a number. Possible values include: "Zero", "Low", "Medium", "High". - :type weight: str or ~azure.mgmt.servicefabric.models.ServiceLoadMetricWeight - :param primary_default_load: Used only for Stateful services. The default amount of load, as a + :vartype name: str + :ivar weight: The service load metric relative weight, compared to other metrics configured for + this service, as a number. Possible values include: "Zero", "Low", "Medium", "High". + :vartype weight: str or ~azure.mgmt.servicefabric.models.ServiceLoadMetricWeight + :ivar primary_default_load: Used only for Stateful services. The default amount of load, as a number, that this service creates for this metric when it is a Primary replica. - :type primary_default_load: int - :param secondary_default_load: Used only for Stateful services. The default amount of load, as - a number, that this service creates for this metric when it is a Secondary replica. - :type secondary_default_load: int - :param default_load: Used only for Stateless services. The default amount of load, as a number, + :vartype primary_default_load: int + :ivar secondary_default_load: Used only for Stateful services. The default amount of load, as a + number, that this service creates for this metric when it is a Secondary replica. + :vartype secondary_default_load: int + :ivar default_load: Used only for Stateless services. The default amount of load, as a number, that this service creates for this metric. - :type default_load: int + :vartype default_load: int """ _validation = { @@ -2731,6 +3571,24 @@ def __init__( default_load: Optional[int] = None, **kwargs ): + """ + :keyword name: Required. The name of the metric. If the service chooses to report load during + runtime, the load metric name should match the name that is specified in Name exactly. Note + that metric names are case sensitive. + :paramtype name: str + :keyword weight: The service load metric relative weight, compared to other metrics configured + for this service, as a number. Possible values include: "Zero", "Low", "Medium", "High". + :paramtype weight: str or ~azure.mgmt.servicefabric.models.ServiceLoadMetricWeight + :keyword primary_default_load: Used only for Stateful services. The default amount of load, as + a number, that this service creates for this metric when it is a Primary replica. + :paramtype primary_default_load: int + :keyword secondary_default_load: Used only for Stateful services. The default amount of load, + as a number, that this service creates for this metric when it is a Secondary replica. + :paramtype secondary_default_load: int + :keyword default_load: Used only for Stateless services. The default amount of load, as a + number, that this service creates for this metric. + :paramtype default_load: int + """ super(ServiceLoadMetricDescription, self).__init__(**kwargs) self.name = name self.weight = weight @@ -2747,11 +3605,11 @@ class ServicePlacementPolicyDescription(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param type: Required. The type of placement policy for a service fabric service. Following are - the possible values.Constant filled by server. Possible values include: "Invalid", + :ivar type: Required. The type of placement policy for a service fabric service. Following are + the possible values.Constant filled by server. Possible values include: "Invalid", "InvalidDomain", "RequiredDomain", "PreferredPrimaryDomain", "RequiredDomainDistribution", "NonPartiallyPlaceService". - :type type: str or ~azure.mgmt.servicefabric.models.ServicePlacementPolicyType + :vartype type: str or ~azure.mgmt.servicefabric.models.ServicePlacementPolicyType """ _validation = { @@ -2770,6 +3628,8 @@ def __init__( self, **kwargs ): + """ + """ super(ServicePlacementPolicyDescription, self).__init__(**kwargs) self.type = None # type: Optional[str] @@ -2785,50 +3645,52 @@ class ServiceResource(ProxyResource): :vartype name: str :ivar type: Azure resource type. :vartype type: str - :param location: It will be deprecated in New API, resource location depends on the parent + :ivar location: It will be deprecated in New API, resource location depends on the parent resource. - :type location: str - :param tags: A set of tags. Azure resource tags. - :type tags: dict[str, str] + :vartype location: str + :ivar tags: A set of tags. Azure resource tags. + :vartype tags: dict[str, str] :ivar etag: Azure resource etag. :vartype etag: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.servicefabric.models.SystemData - :param placement_constraints: The placement constraints as a string. Placement constraints are + :ivar placement_constraints: The placement constraints as a string. Placement constraints are boolean expressions on node properties and allow for restricting a service to particular nodes based on the service requirements. For example, to place a service on nodes where NodeType is blue specify the following: "NodeColor == blue)". - :type placement_constraints: str - :param correlation_scheme: A list that describes the correlation of the service with other + :vartype placement_constraints: str + :ivar correlation_scheme: A list that describes the correlation of the service with other services. - :type correlation_scheme: list[~azure.mgmt.servicefabric.models.ServiceCorrelationDescription] - :param service_load_metrics: The service load metrics is given as an array of + :vartype correlation_scheme: + list[~azure.mgmt.servicefabric.models.ServiceCorrelationDescription] + :ivar service_load_metrics: The service load metrics is given as an array of ServiceLoadMetricDescription objects. - :type service_load_metrics: list[~azure.mgmt.servicefabric.models.ServiceLoadMetricDescription] - :param service_placement_policies: A list that describes the correlation of the service with + :vartype service_load_metrics: + list[~azure.mgmt.servicefabric.models.ServiceLoadMetricDescription] + :ivar service_placement_policies: A list that describes the correlation of the service with other services. - :type service_placement_policies: + :vartype service_placement_policies: list[~azure.mgmt.servicefabric.models.ServicePlacementPolicyDescription] - :param default_move_cost: Specifies the move cost for the service. Possible values include: + :ivar default_move_cost: Specifies the move cost for the service. Possible values include: "Zero", "Low", "Medium", "High". - :type default_move_cost: str or ~azure.mgmt.servicefabric.models.MoveCost + :vartype default_move_cost: str or ~azure.mgmt.servicefabric.models.MoveCost :ivar provisioning_state: The current deployment or provisioning state, which only appears in the response. :vartype provisioning_state: str - :param service_kind: The kind of service (Stateless or Stateful).Constant filled by server. + :ivar service_kind: The kind of service (Stateless or Stateful).Constant filled by server. Possible values include: "Invalid", "Stateless", "Stateful". - :type service_kind: str or ~azure.mgmt.servicefabric.models.ServiceKind - :param service_type_name: The name of the service type. - :type service_type_name: str - :param partition_description: Describes how the service is partitioned. - :type partition_description: ~azure.mgmt.servicefabric.models.PartitionSchemeDescription - :param service_package_activation_mode: The activation Mode of the service package. Possible + :vartype service_kind: str or ~azure.mgmt.servicefabric.models.ServiceKind + :ivar service_type_name: The name of the service type. + :vartype service_type_name: str + :ivar partition_description: Describes how the service is partitioned. + :vartype partition_description: ~azure.mgmt.servicefabric.models.PartitionSchemeDescription + :ivar service_package_activation_mode: The activation Mode of the service package. Possible values include: "SharedProcess", "ExclusiveProcess". - :type service_package_activation_mode: str or + :vartype service_package_activation_mode: str or ~azure.mgmt.servicefabric.models.ArmServicePackageActivationMode - :param service_dns_name: Dns name used for the service. If this is specified, then the service + :ivar service_dns_name: Dns name used for the service. If this is specified, then the service can be accessed via its DNS name instead of service name. - :type service_dns_name: str + :vartype service_dns_name: str """ _validation = { @@ -2877,6 +3739,44 @@ def __init__( service_dns_name: Optional[str] = None, **kwargs ): + """ + :keyword location: It will be deprecated in New API, resource location depends on the parent + resource. + :paramtype location: str + :keyword tags: A set of tags. Azure resource tags. + :paramtype tags: dict[str, str] + :keyword placement_constraints: The placement constraints as a string. Placement constraints + are boolean expressions on node properties and allow for restricting a service to particular + nodes based on the service requirements. For example, to place a service on nodes where + NodeType is blue specify the following: "NodeColor == blue)". + :paramtype placement_constraints: str + :keyword correlation_scheme: A list that describes the correlation of the service with other + services. + :paramtype correlation_scheme: + list[~azure.mgmt.servicefabric.models.ServiceCorrelationDescription] + :keyword service_load_metrics: The service load metrics is given as an array of + ServiceLoadMetricDescription objects. + :paramtype service_load_metrics: + list[~azure.mgmt.servicefabric.models.ServiceLoadMetricDescription] + :keyword service_placement_policies: A list that describes the correlation of the service with + other services. + :paramtype service_placement_policies: + list[~azure.mgmt.servicefabric.models.ServicePlacementPolicyDescription] + :keyword default_move_cost: Specifies the move cost for the service. Possible values include: + "Zero", "Low", "Medium", "High". + :paramtype default_move_cost: str or ~azure.mgmt.servicefabric.models.MoveCost + :keyword service_type_name: The name of the service type. + :paramtype service_type_name: str + :keyword partition_description: Describes how the service is partitioned. + :paramtype partition_description: ~azure.mgmt.servicefabric.models.PartitionSchemeDescription + :keyword service_package_activation_mode: The activation Mode of the service package. Possible + values include: "SharedProcess", "ExclusiveProcess". + :paramtype service_package_activation_mode: str or + ~azure.mgmt.servicefabric.models.ArmServicePackageActivationMode + :keyword service_dns_name: Dns name used for the service. If this is specified, then the + service can be accessed via its DNS name instead of service name. + :paramtype service_dns_name: str + """ super(ServiceResource, self).__init__(location=location, tags=tags, **kwargs) self.placement_constraints = placement_constraints self.correlation_scheme = correlation_scheme @@ -2896,8 +3796,8 @@ class ServiceResourceList(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param value: - :type value: list[~azure.mgmt.servicefabric.models.ServiceResource] + :ivar value: + :vartype value: list[~azure.mgmt.servicefabric.models.ServiceResource] :ivar next_link: URL to get the next set of service list results if there are any. :vartype next_link: str """ @@ -2917,6 +3817,10 @@ def __init__( value: Optional[List["ServiceResource"]] = None, **kwargs ): + """ + :keyword value: + :paramtype value: list[~azure.mgmt.servicefabric.models.ServiceResource] + """ super(ServiceResourceList, self).__init__(**kwargs) self.value = value self.next_link = None @@ -2925,24 +3829,26 @@ def __init__( class ServiceResourcePropertiesBase(msrest.serialization.Model): """The common service resource properties. - :param placement_constraints: The placement constraints as a string. Placement constraints are + :ivar placement_constraints: The placement constraints as a string. Placement constraints are boolean expressions on node properties and allow for restricting a service to particular nodes based on the service requirements. For example, to place a service on nodes where NodeType is blue specify the following: "NodeColor == blue)". - :type placement_constraints: str - :param correlation_scheme: A list that describes the correlation of the service with other + :vartype placement_constraints: str + :ivar correlation_scheme: A list that describes the correlation of the service with other services. - :type correlation_scheme: list[~azure.mgmt.servicefabric.models.ServiceCorrelationDescription] - :param service_load_metrics: The service load metrics is given as an array of + :vartype correlation_scheme: + list[~azure.mgmt.servicefabric.models.ServiceCorrelationDescription] + :ivar service_load_metrics: The service load metrics is given as an array of ServiceLoadMetricDescription objects. - :type service_load_metrics: list[~azure.mgmt.servicefabric.models.ServiceLoadMetricDescription] - :param service_placement_policies: A list that describes the correlation of the service with + :vartype service_load_metrics: + list[~azure.mgmt.servicefabric.models.ServiceLoadMetricDescription] + :ivar service_placement_policies: A list that describes the correlation of the service with other services. - :type service_placement_policies: + :vartype service_placement_policies: list[~azure.mgmt.servicefabric.models.ServicePlacementPolicyDescription] - :param default_move_cost: Specifies the move cost for the service. Possible values include: + :ivar default_move_cost: Specifies the move cost for the service. Possible values include: "Zero", "Low", "Medium", "High". - :type default_move_cost: str or ~azure.mgmt.servicefabric.models.MoveCost + :vartype default_move_cost: str or ~azure.mgmt.servicefabric.models.MoveCost """ _attribute_map = { @@ -2963,6 +3869,28 @@ def __init__( default_move_cost: Optional[Union[str, "MoveCost"]] = None, **kwargs ): + """ + :keyword placement_constraints: The placement constraints as a string. Placement constraints + are boolean expressions on node properties and allow for restricting a service to particular + nodes based on the service requirements. For example, to place a service on nodes where + NodeType is blue specify the following: "NodeColor == blue)". + :paramtype placement_constraints: str + :keyword correlation_scheme: A list that describes the correlation of the service with other + services. + :paramtype correlation_scheme: + list[~azure.mgmt.servicefabric.models.ServiceCorrelationDescription] + :keyword service_load_metrics: The service load metrics is given as an array of + ServiceLoadMetricDescription objects. + :paramtype service_load_metrics: + list[~azure.mgmt.servicefabric.models.ServiceLoadMetricDescription] + :keyword service_placement_policies: A list that describes the correlation of the service with + other services. + :paramtype service_placement_policies: + list[~azure.mgmt.servicefabric.models.ServicePlacementPolicyDescription] + :keyword default_move_cost: Specifies the move cost for the service. Possible values include: + "Zero", "Low", "Medium", "High". + :paramtype default_move_cost: str or ~azure.mgmt.servicefabric.models.MoveCost + """ super(ServiceResourcePropertiesBase, self).__init__(**kwargs) self.placement_constraints = placement_constraints self.correlation_scheme = correlation_scheme @@ -2981,41 +3909,43 @@ class ServiceResourceProperties(ServiceResourcePropertiesBase): All required parameters must be populated in order to send to Azure. - :param placement_constraints: The placement constraints as a string. Placement constraints are + :ivar placement_constraints: The placement constraints as a string. Placement constraints are boolean expressions on node properties and allow for restricting a service to particular nodes based on the service requirements. For example, to place a service on nodes where NodeType is blue specify the following: "NodeColor == blue)". - :type placement_constraints: str - :param correlation_scheme: A list that describes the correlation of the service with other + :vartype placement_constraints: str + :ivar correlation_scheme: A list that describes the correlation of the service with other services. - :type correlation_scheme: list[~azure.mgmt.servicefabric.models.ServiceCorrelationDescription] - :param service_load_metrics: The service load metrics is given as an array of + :vartype correlation_scheme: + list[~azure.mgmt.servicefabric.models.ServiceCorrelationDescription] + :ivar service_load_metrics: The service load metrics is given as an array of ServiceLoadMetricDescription objects. - :type service_load_metrics: list[~azure.mgmt.servicefabric.models.ServiceLoadMetricDescription] - :param service_placement_policies: A list that describes the correlation of the service with + :vartype service_load_metrics: + list[~azure.mgmt.servicefabric.models.ServiceLoadMetricDescription] + :ivar service_placement_policies: A list that describes the correlation of the service with other services. - :type service_placement_policies: + :vartype service_placement_policies: list[~azure.mgmt.servicefabric.models.ServicePlacementPolicyDescription] - :param default_move_cost: Specifies the move cost for the service. Possible values include: + :ivar default_move_cost: Specifies the move cost for the service. Possible values include: "Zero", "Low", "Medium", "High". - :type default_move_cost: str or ~azure.mgmt.servicefabric.models.MoveCost + :vartype default_move_cost: str or ~azure.mgmt.servicefabric.models.MoveCost :ivar provisioning_state: The current deployment or provisioning state, which only appears in the response. :vartype provisioning_state: str - :param service_kind: Required. The kind of service (Stateless or Stateful).Constant filled by - server. Possible values include: "Invalid", "Stateless", "Stateful". - :type service_kind: str or ~azure.mgmt.servicefabric.models.ServiceKind - :param service_type_name: The name of the service type. - :type service_type_name: str - :param partition_description: Describes how the service is partitioned. - :type partition_description: ~azure.mgmt.servicefabric.models.PartitionSchemeDescription - :param service_package_activation_mode: The activation Mode of the service package. Possible + :ivar service_kind: Required. The kind of service (Stateless or Stateful).Constant filled by + server. Possible values include: "Invalid", "Stateless", "Stateful". + :vartype service_kind: str or ~azure.mgmt.servicefabric.models.ServiceKind + :ivar service_type_name: The name of the service type. + :vartype service_type_name: str + :ivar partition_description: Describes how the service is partitioned. + :vartype partition_description: ~azure.mgmt.servicefabric.models.PartitionSchemeDescription + :ivar service_package_activation_mode: The activation Mode of the service package. Possible values include: "SharedProcess", "ExclusiveProcess". - :type service_package_activation_mode: str or + :vartype service_package_activation_mode: str or ~azure.mgmt.servicefabric.models.ArmServicePackageActivationMode - :param service_dns_name: Dns name used for the service. If this is specified, then the service + :ivar service_dns_name: Dns name used for the service. If this is specified, then the service can be accessed via its DNS name instead of service name. - :type service_dns_name: str + :vartype service_dns_name: str """ _validation = { @@ -3055,6 +3985,39 @@ def __init__( service_dns_name: Optional[str] = None, **kwargs ): + """ + :keyword placement_constraints: The placement constraints as a string. Placement constraints + are boolean expressions on node properties and allow for restricting a service to particular + nodes based on the service requirements. For example, to place a service on nodes where + NodeType is blue specify the following: "NodeColor == blue)". + :paramtype placement_constraints: str + :keyword correlation_scheme: A list that describes the correlation of the service with other + services. + :paramtype correlation_scheme: + list[~azure.mgmt.servicefabric.models.ServiceCorrelationDescription] + :keyword service_load_metrics: The service load metrics is given as an array of + ServiceLoadMetricDescription objects. + :paramtype service_load_metrics: + list[~azure.mgmt.servicefabric.models.ServiceLoadMetricDescription] + :keyword service_placement_policies: A list that describes the correlation of the service with + other services. + :paramtype service_placement_policies: + list[~azure.mgmt.servicefabric.models.ServicePlacementPolicyDescription] + :keyword default_move_cost: Specifies the move cost for the service. Possible values include: + "Zero", "Low", "Medium", "High". + :paramtype default_move_cost: str or ~azure.mgmt.servicefabric.models.MoveCost + :keyword service_type_name: The name of the service type. + :paramtype service_type_name: str + :keyword partition_description: Describes how the service is partitioned. + :paramtype partition_description: ~azure.mgmt.servicefabric.models.PartitionSchemeDescription + :keyword service_package_activation_mode: The activation Mode of the service package. Possible + values include: "SharedProcess", "ExclusiveProcess". + :paramtype service_package_activation_mode: str or + ~azure.mgmt.servicefabric.models.ArmServicePackageActivationMode + :keyword service_dns_name: Dns name used for the service. If this is specified, then the + service can be accessed via its DNS name instead of service name. + :paramtype service_dns_name: str + """ super(ServiceResourceProperties, self).__init__(placement_constraints=placement_constraints, correlation_scheme=correlation_scheme, service_load_metrics=service_load_metrics, service_placement_policies=service_placement_policies, default_move_cost=default_move_cost, **kwargs) self.provisioning_state = None self.service_kind = 'ServiceResourceProperties' # type: str @@ -3075,36 +4038,38 @@ class ServiceResourceUpdate(ProxyResource): :vartype name: str :ivar type: Azure resource type. :vartype type: str - :param location: It will be deprecated in New API, resource location depends on the parent + :ivar location: It will be deprecated in New API, resource location depends on the parent resource. - :type location: str - :param tags: A set of tags. Azure resource tags. - :type tags: dict[str, str] + :vartype location: str + :ivar tags: A set of tags. Azure resource tags. + :vartype tags: dict[str, str] :ivar etag: Azure resource etag. :vartype etag: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.servicefabric.models.SystemData - :param placement_constraints: The placement constraints as a string. Placement constraints are + :ivar placement_constraints: The placement constraints as a string. Placement constraints are boolean expressions on node properties and allow for restricting a service to particular nodes based on the service requirements. For example, to place a service on nodes where NodeType is blue specify the following: "NodeColor == blue)". - :type placement_constraints: str - :param correlation_scheme: A list that describes the correlation of the service with other + :vartype placement_constraints: str + :ivar correlation_scheme: A list that describes the correlation of the service with other services. - :type correlation_scheme: list[~azure.mgmt.servicefabric.models.ServiceCorrelationDescription] - :param service_load_metrics: The service load metrics is given as an array of + :vartype correlation_scheme: + list[~azure.mgmt.servicefabric.models.ServiceCorrelationDescription] + :ivar service_load_metrics: The service load metrics is given as an array of ServiceLoadMetricDescription objects. - :type service_load_metrics: list[~azure.mgmt.servicefabric.models.ServiceLoadMetricDescription] - :param service_placement_policies: A list that describes the correlation of the service with + :vartype service_load_metrics: + list[~azure.mgmt.servicefabric.models.ServiceLoadMetricDescription] + :ivar service_placement_policies: A list that describes the correlation of the service with other services. - :type service_placement_policies: + :vartype service_placement_policies: list[~azure.mgmt.servicefabric.models.ServicePlacementPolicyDescription] - :param default_move_cost: Specifies the move cost for the service. Possible values include: + :ivar default_move_cost: Specifies the move cost for the service. Possible values include: "Zero", "Low", "Medium", "High". - :type default_move_cost: str or ~azure.mgmt.servicefabric.models.MoveCost - :param service_kind: The kind of service (Stateless or Stateful).Constant filled by server. + :vartype default_move_cost: str or ~azure.mgmt.servicefabric.models.MoveCost + :ivar service_kind: The kind of service (Stateless or Stateful).Constant filled by server. Possible values include: "Invalid", "Stateless", "Stateful". - :type service_kind: str or ~azure.mgmt.servicefabric.models.ServiceKind + :vartype service_kind: str or ~azure.mgmt.servicefabric.models.ServiceKind """ _validation = { @@ -3143,6 +4108,33 @@ def __init__( default_move_cost: Optional[Union[str, "MoveCost"]] = None, **kwargs ): + """ + :keyword location: It will be deprecated in New API, resource location depends on the parent + resource. + :paramtype location: str + :keyword tags: A set of tags. Azure resource tags. + :paramtype tags: dict[str, str] + :keyword placement_constraints: The placement constraints as a string. Placement constraints + are boolean expressions on node properties and allow for restricting a service to particular + nodes based on the service requirements. For example, to place a service on nodes where + NodeType is blue specify the following: "NodeColor == blue)". + :paramtype placement_constraints: str + :keyword correlation_scheme: A list that describes the correlation of the service with other + services. + :paramtype correlation_scheme: + list[~azure.mgmt.servicefabric.models.ServiceCorrelationDescription] + :keyword service_load_metrics: The service load metrics is given as an array of + ServiceLoadMetricDescription objects. + :paramtype service_load_metrics: + list[~azure.mgmt.servicefabric.models.ServiceLoadMetricDescription] + :keyword service_placement_policies: A list that describes the correlation of the service with + other services. + :paramtype service_placement_policies: + list[~azure.mgmt.servicefabric.models.ServicePlacementPolicyDescription] + :keyword default_move_cost: Specifies the move cost for the service. Possible values include: + "Zero", "Low", "Medium", "High". + :paramtype default_move_cost: str or ~azure.mgmt.servicefabric.models.MoveCost + """ super(ServiceResourceUpdate, self).__init__(location=location, tags=tags, **kwargs) self.placement_constraints = placement_constraints self.correlation_scheme = correlation_scheme @@ -3160,27 +4152,29 @@ class ServiceResourceUpdateProperties(ServiceResourcePropertiesBase): All required parameters must be populated in order to send to Azure. - :param placement_constraints: The placement constraints as a string. Placement constraints are + :ivar placement_constraints: The placement constraints as a string. Placement constraints are boolean expressions on node properties and allow for restricting a service to particular nodes based on the service requirements. For example, to place a service on nodes where NodeType is blue specify the following: "NodeColor == blue)". - :type placement_constraints: str - :param correlation_scheme: A list that describes the correlation of the service with other + :vartype placement_constraints: str + :ivar correlation_scheme: A list that describes the correlation of the service with other services. - :type correlation_scheme: list[~azure.mgmt.servicefabric.models.ServiceCorrelationDescription] - :param service_load_metrics: The service load metrics is given as an array of + :vartype correlation_scheme: + list[~azure.mgmt.servicefabric.models.ServiceCorrelationDescription] + :ivar service_load_metrics: The service load metrics is given as an array of ServiceLoadMetricDescription objects. - :type service_load_metrics: list[~azure.mgmt.servicefabric.models.ServiceLoadMetricDescription] - :param service_placement_policies: A list that describes the correlation of the service with + :vartype service_load_metrics: + list[~azure.mgmt.servicefabric.models.ServiceLoadMetricDescription] + :ivar service_placement_policies: A list that describes the correlation of the service with other services. - :type service_placement_policies: + :vartype service_placement_policies: list[~azure.mgmt.servicefabric.models.ServicePlacementPolicyDescription] - :param default_move_cost: Specifies the move cost for the service. Possible values include: + :ivar default_move_cost: Specifies the move cost for the service. Possible values include: "Zero", "Low", "Medium", "High". - :type default_move_cost: str or ~azure.mgmt.servicefabric.models.MoveCost - :param service_kind: Required. The kind of service (Stateless or Stateful).Constant filled by - server. Possible values include: "Invalid", "Stateless", "Stateful". - :type service_kind: str or ~azure.mgmt.servicefabric.models.ServiceKind + :vartype default_move_cost: str or ~azure.mgmt.servicefabric.models.MoveCost + :ivar service_kind: Required. The kind of service (Stateless or Stateful).Constant filled by + server. Possible values include: "Invalid", "Stateless", "Stateful". + :vartype service_kind: str or ~azure.mgmt.servicefabric.models.ServiceKind """ _validation = { @@ -3210,6 +4204,28 @@ def __init__( default_move_cost: Optional[Union[str, "MoveCost"]] = None, **kwargs ): + """ + :keyword placement_constraints: The placement constraints as a string. Placement constraints + are boolean expressions on node properties and allow for restricting a service to particular + nodes based on the service requirements. For example, to place a service on nodes where + NodeType is blue specify the following: "NodeColor == blue)". + :paramtype placement_constraints: str + :keyword correlation_scheme: A list that describes the correlation of the service with other + services. + :paramtype correlation_scheme: + list[~azure.mgmt.servicefabric.models.ServiceCorrelationDescription] + :keyword service_load_metrics: The service load metrics is given as an array of + ServiceLoadMetricDescription objects. + :paramtype service_load_metrics: + list[~azure.mgmt.servicefabric.models.ServiceLoadMetricDescription] + :keyword service_placement_policies: A list that describes the correlation of the service with + other services. + :paramtype service_placement_policies: + list[~azure.mgmt.servicefabric.models.ServicePlacementPolicyDescription] + :keyword default_move_cost: Specifies the move cost for the service. Possible values include: + "Zero", "Low", "Medium", "High". + :paramtype default_move_cost: str or ~azure.mgmt.servicefabric.models.MoveCost + """ super(ServiceResourceUpdateProperties, self).__init__(placement_constraints=placement_constraints, correlation_scheme=correlation_scheme, service_load_metrics=service_load_metrics, service_placement_policies=service_placement_policies, default_move_cost=default_move_cost, **kwargs) self.service_kind = 'ServiceResourceUpdateProperties' # type: str @@ -3217,13 +4233,13 @@ def __init__( class ServiceTypeDeltaHealthPolicy(msrest.serialization.Model): """Represents the delta health policy used to evaluate the health of services belonging to a service type when upgrading the cluster. - :param max_percent_delta_unhealthy_services: The maximum allowed percentage of services health + :ivar max_percent_delta_unhealthy_services: The maximum allowed percentage of services health degradation allowed during cluster upgrades. The delta is measured between the state of the services at the beginning of upgrade and the state of the services at the time of the health evaluation. The check is performed after every upgrade domain upgrade completion to make sure the global state of the cluster is within tolerated limits. - :type max_percent_delta_unhealthy_services: int + :vartype max_percent_delta_unhealthy_services: int """ _validation = { @@ -3240,6 +4256,15 @@ def __init__( max_percent_delta_unhealthy_services: Optional[int] = 0, **kwargs ): + """ + :keyword max_percent_delta_unhealthy_services: The maximum allowed percentage of services + health degradation allowed during cluster upgrades. + The delta is measured between the state of the services at the beginning of upgrade and the + state of the services at the time of the health evaluation. + The check is performed after every upgrade domain upgrade completion to make sure the global + state of the cluster is within tolerated limits. + :paramtype max_percent_delta_unhealthy_services: int + """ super(ServiceTypeDeltaHealthPolicy, self).__init__(**kwargs) self.max_percent_delta_unhealthy_services = max_percent_delta_unhealthy_services @@ -3247,9 +4272,9 @@ def __init__( class ServiceTypeHealthPolicy(msrest.serialization.Model): """Represents the health policy used to evaluate the health of services belonging to a service type. - :param max_percent_unhealthy_services: The maximum percentage of services allowed to be + :ivar max_percent_unhealthy_services: The maximum percentage of services allowed to be unhealthy before your application is considered in error. - :type max_percent_unhealthy_services: int + :vartype max_percent_unhealthy_services: int """ _validation = { @@ -3266,6 +4291,11 @@ def __init__( max_percent_unhealthy_services: Optional[int] = 0, **kwargs ): + """ + :keyword max_percent_unhealthy_services: The maximum percentage of services allowed to be + unhealthy before your application is considered in error. + :paramtype max_percent_unhealthy_services: int + """ super(ServiceTypeHealthPolicy, self).__init__(**kwargs) self.max_percent_unhealthy_services = max_percent_unhealthy_services @@ -3275,10 +4305,10 @@ class SettingsParameterDescription(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The parameter name of fabric setting. - :type name: str - :param value: Required. The parameter value of fabric setting. - :type value: str + :ivar name: Required. The parameter name of fabric setting. + :vartype name: str + :ivar value: Required. The parameter value of fabric setting. + :vartype value: str """ _validation = { @@ -3298,6 +4328,12 @@ def __init__( value: str, **kwargs ): + """ + :keyword name: Required. The parameter name of fabric setting. + :paramtype name: str + :keyword value: Required. The parameter value of fabric setting. + :paramtype value: str + """ super(SettingsParameterDescription, self).__init__(**kwargs) self.name = name self.value = value @@ -3308,10 +4344,10 @@ class SettingsSectionDescription(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The section name of the fabric settings. - :type name: str - :param parameters: Required. The collection of parameters in the section. - :type parameters: list[~azure.mgmt.servicefabric.models.SettingsParameterDescription] + :ivar name: Required. The section name of the fabric settings. + :vartype name: str + :ivar parameters: Required. The collection of parameters in the section. + :vartype parameters: list[~azure.mgmt.servicefabric.models.SettingsParameterDescription] """ _validation = { @@ -3331,6 +4367,12 @@ def __init__( parameters: List["SettingsParameterDescription"], **kwargs ): + """ + :keyword name: Required. The section name of the fabric settings. + :paramtype name: str + :keyword parameters: Required. The collection of parameters in the section. + :paramtype parameters: list[~azure.mgmt.servicefabric.models.SettingsParameterDescription] + """ super(SettingsSectionDescription, self).__init__(**kwargs) self.name = name self.parameters = parameters @@ -3341,9 +4383,9 @@ class SingletonPartitionSchemeDescription(PartitionSchemeDescription): All required parameters must be populated in order to send to Azure. - :param partition_scheme: Required. Specifies how the service is partitioned.Constant filled by - server. Possible values include: "Invalid", "Singleton", "UniformInt64Range", "Named". - :type partition_scheme: str or ~azure.mgmt.servicefabric.models.PartitionScheme + :ivar partition_scheme: Required. Specifies how the service is partitioned.Constant filled by + server. Possible values include: "Invalid", "Singleton", "UniformInt64Range", "Named". + :vartype partition_scheme: str or ~azure.mgmt.servicefabric.models.PartitionScheme """ _validation = { @@ -3358,6 +4400,8 @@ def __init__( self, **kwargs ): + """ + """ super(SingletonPartitionSchemeDescription, self).__init__(**kwargs) self.partition_scheme = 'Singleton' # type: str @@ -3369,57 +4413,59 @@ class StatefulServiceProperties(ServiceResourceProperties): All required parameters must be populated in order to send to Azure. - :param placement_constraints: The placement constraints as a string. Placement constraints are + :ivar placement_constraints: The placement constraints as a string. Placement constraints are boolean expressions on node properties and allow for restricting a service to particular nodes based on the service requirements. For example, to place a service on nodes where NodeType is blue specify the following: "NodeColor == blue)". - :type placement_constraints: str - :param correlation_scheme: A list that describes the correlation of the service with other + :vartype placement_constraints: str + :ivar correlation_scheme: A list that describes the correlation of the service with other services. - :type correlation_scheme: list[~azure.mgmt.servicefabric.models.ServiceCorrelationDescription] - :param service_load_metrics: The service load metrics is given as an array of + :vartype correlation_scheme: + list[~azure.mgmt.servicefabric.models.ServiceCorrelationDescription] + :ivar service_load_metrics: The service load metrics is given as an array of ServiceLoadMetricDescription objects. - :type service_load_metrics: list[~azure.mgmt.servicefabric.models.ServiceLoadMetricDescription] - :param service_placement_policies: A list that describes the correlation of the service with + :vartype service_load_metrics: + list[~azure.mgmt.servicefabric.models.ServiceLoadMetricDescription] + :ivar service_placement_policies: A list that describes the correlation of the service with other services. - :type service_placement_policies: + :vartype service_placement_policies: list[~azure.mgmt.servicefabric.models.ServicePlacementPolicyDescription] - :param default_move_cost: Specifies the move cost for the service. Possible values include: + :ivar default_move_cost: Specifies the move cost for the service. Possible values include: "Zero", "Low", "Medium", "High". - :type default_move_cost: str or ~azure.mgmt.servicefabric.models.MoveCost + :vartype default_move_cost: str or ~azure.mgmt.servicefabric.models.MoveCost :ivar provisioning_state: The current deployment or provisioning state, which only appears in the response. :vartype provisioning_state: str - :param service_kind: Required. The kind of service (Stateless or Stateful).Constant filled by - server. Possible values include: "Invalid", "Stateless", "Stateful". - :type service_kind: str or ~azure.mgmt.servicefabric.models.ServiceKind - :param service_type_name: The name of the service type. - :type service_type_name: str - :param partition_description: Describes how the service is partitioned. - :type partition_description: ~azure.mgmt.servicefabric.models.PartitionSchemeDescription - :param service_package_activation_mode: The activation Mode of the service package. Possible + :ivar service_kind: Required. The kind of service (Stateless or Stateful).Constant filled by + server. Possible values include: "Invalid", "Stateless", "Stateful". + :vartype service_kind: str or ~azure.mgmt.servicefabric.models.ServiceKind + :ivar service_type_name: The name of the service type. + :vartype service_type_name: str + :ivar partition_description: Describes how the service is partitioned. + :vartype partition_description: ~azure.mgmt.servicefabric.models.PartitionSchemeDescription + :ivar service_package_activation_mode: The activation Mode of the service package. Possible values include: "SharedProcess", "ExclusiveProcess". - :type service_package_activation_mode: str or + :vartype service_package_activation_mode: str or ~azure.mgmt.servicefabric.models.ArmServicePackageActivationMode - :param service_dns_name: Dns name used for the service. If this is specified, then the service + :ivar service_dns_name: Dns name used for the service. If this is specified, then the service can be accessed via its DNS name instead of service name. - :type service_dns_name: str - :param has_persisted_state: A flag indicating whether this is a persistent service which stores + :vartype service_dns_name: str + :ivar has_persisted_state: A flag indicating whether this is a persistent service which stores states on the local disk. If it is then the value of this property is true, if not it is false. - :type has_persisted_state: bool - :param target_replica_set_size: The target replica set size as a number. - :type target_replica_set_size: int - :param min_replica_set_size: The minimum replica set size as a number. - :type min_replica_set_size: int - :param replica_restart_wait_duration: The duration between when a replica goes down and when a + :vartype has_persisted_state: bool + :ivar target_replica_set_size: The target replica set size as a number. + :vartype target_replica_set_size: int + :ivar min_replica_set_size: The minimum replica set size as a number. + :vartype min_replica_set_size: int + :ivar replica_restart_wait_duration: The duration between when a replica goes down and when a new replica is created, represented in ISO 8601 format (hh:mm:ss.s). - :type replica_restart_wait_duration: ~datetime.datetime - :param quorum_loss_wait_duration: The maximum duration for which a partition is allowed to be - in a state of quorum loss, represented in ISO 8601 format (hh:mm:ss.s). - :type quorum_loss_wait_duration: ~datetime.datetime - :param stand_by_replica_keep_duration: The definition on how long StandBy replicas should be + :vartype replica_restart_wait_duration: ~datetime.datetime + :ivar quorum_loss_wait_duration: The maximum duration for which a partition is allowed to be in + a state of quorum loss, represented in ISO 8601 format (hh:mm:ss.s). + :vartype quorum_loss_wait_duration: ~datetime.datetime + :ivar stand_by_replica_keep_duration: The definition on how long StandBy replicas should be maintained before being removed, represented in ISO 8601 format (hh:mm:ss.s). - :type stand_by_replica_keep_duration: ~datetime.datetime + :vartype stand_by_replica_keep_duration: ~datetime.datetime """ _validation = { @@ -3469,6 +4515,56 @@ def __init__( stand_by_replica_keep_duration: Optional[datetime.datetime] = None, **kwargs ): + """ + :keyword placement_constraints: The placement constraints as a string. Placement constraints + are boolean expressions on node properties and allow for restricting a service to particular + nodes based on the service requirements. For example, to place a service on nodes where + NodeType is blue specify the following: "NodeColor == blue)". + :paramtype placement_constraints: str + :keyword correlation_scheme: A list that describes the correlation of the service with other + services. + :paramtype correlation_scheme: + list[~azure.mgmt.servicefabric.models.ServiceCorrelationDescription] + :keyword service_load_metrics: The service load metrics is given as an array of + ServiceLoadMetricDescription objects. + :paramtype service_load_metrics: + list[~azure.mgmt.servicefabric.models.ServiceLoadMetricDescription] + :keyword service_placement_policies: A list that describes the correlation of the service with + other services. + :paramtype service_placement_policies: + list[~azure.mgmt.servicefabric.models.ServicePlacementPolicyDescription] + :keyword default_move_cost: Specifies the move cost for the service. Possible values include: + "Zero", "Low", "Medium", "High". + :paramtype default_move_cost: str or ~azure.mgmt.servicefabric.models.MoveCost + :keyword service_type_name: The name of the service type. + :paramtype service_type_name: str + :keyword partition_description: Describes how the service is partitioned. + :paramtype partition_description: ~azure.mgmt.servicefabric.models.PartitionSchemeDescription + :keyword service_package_activation_mode: The activation Mode of the service package. Possible + values include: "SharedProcess", "ExclusiveProcess". + :paramtype service_package_activation_mode: str or + ~azure.mgmt.servicefabric.models.ArmServicePackageActivationMode + :keyword service_dns_name: Dns name used for the service. If this is specified, then the + service can be accessed via its DNS name instead of service name. + :paramtype service_dns_name: str + :keyword has_persisted_state: A flag indicating whether this is a persistent service which + stores states on the local disk. If it is then the value of this property is true, if not it is + false. + :paramtype has_persisted_state: bool + :keyword target_replica_set_size: The target replica set size as a number. + :paramtype target_replica_set_size: int + :keyword min_replica_set_size: The minimum replica set size as a number. + :paramtype min_replica_set_size: int + :keyword replica_restart_wait_duration: The duration between when a replica goes down and when + a new replica is created, represented in ISO 8601 format (hh:mm:ss.s). + :paramtype replica_restart_wait_duration: ~datetime.datetime + :keyword quorum_loss_wait_duration: The maximum duration for which a partition is allowed to be + in a state of quorum loss, represented in ISO 8601 format (hh:mm:ss.s). + :paramtype quorum_loss_wait_duration: ~datetime.datetime + :keyword stand_by_replica_keep_duration: The definition on how long StandBy replicas should be + maintained before being removed, represented in ISO 8601 format (hh:mm:ss.s). + :paramtype stand_by_replica_keep_duration: ~datetime.datetime + """ super(StatefulServiceProperties, self).__init__(placement_constraints=placement_constraints, correlation_scheme=correlation_scheme, service_load_metrics=service_load_metrics, service_placement_policies=service_placement_policies, default_move_cost=default_move_cost, service_type_name=service_type_name, partition_description=partition_description, service_package_activation_mode=service_package_activation_mode, service_dns_name=service_dns_name, **kwargs) self.service_kind = 'Stateful' # type: str self.has_persisted_state = has_persisted_state @@ -3484,40 +4580,42 @@ class StatefulServiceUpdateProperties(ServiceResourceUpdateProperties): All required parameters must be populated in order to send to Azure. - :param placement_constraints: The placement constraints as a string. Placement constraints are + :ivar placement_constraints: The placement constraints as a string. Placement constraints are boolean expressions on node properties and allow for restricting a service to particular nodes based on the service requirements. For example, to place a service on nodes where NodeType is blue specify the following: "NodeColor == blue)". - :type placement_constraints: str - :param correlation_scheme: A list that describes the correlation of the service with other + :vartype placement_constraints: str + :ivar correlation_scheme: A list that describes the correlation of the service with other services. - :type correlation_scheme: list[~azure.mgmt.servicefabric.models.ServiceCorrelationDescription] - :param service_load_metrics: The service load metrics is given as an array of + :vartype correlation_scheme: + list[~azure.mgmt.servicefabric.models.ServiceCorrelationDescription] + :ivar service_load_metrics: The service load metrics is given as an array of ServiceLoadMetricDescription objects. - :type service_load_metrics: list[~azure.mgmt.servicefabric.models.ServiceLoadMetricDescription] - :param service_placement_policies: A list that describes the correlation of the service with + :vartype service_load_metrics: + list[~azure.mgmt.servicefabric.models.ServiceLoadMetricDescription] + :ivar service_placement_policies: A list that describes the correlation of the service with other services. - :type service_placement_policies: + :vartype service_placement_policies: list[~azure.mgmt.servicefabric.models.ServicePlacementPolicyDescription] - :param default_move_cost: Specifies the move cost for the service. Possible values include: + :ivar default_move_cost: Specifies the move cost for the service. Possible values include: "Zero", "Low", "Medium", "High". - :type default_move_cost: str or ~azure.mgmt.servicefabric.models.MoveCost - :param service_kind: Required. The kind of service (Stateless or Stateful).Constant filled by - server. Possible values include: "Invalid", "Stateless", "Stateful". - :type service_kind: str or ~azure.mgmt.servicefabric.models.ServiceKind - :param target_replica_set_size: The target replica set size as a number. - :type target_replica_set_size: int - :param min_replica_set_size: The minimum replica set size as a number. - :type min_replica_set_size: int - :param replica_restart_wait_duration: The duration between when a replica goes down and when a + :vartype default_move_cost: str or ~azure.mgmt.servicefabric.models.MoveCost + :ivar service_kind: Required. The kind of service (Stateless or Stateful).Constant filled by + server. Possible values include: "Invalid", "Stateless", "Stateful". + :vartype service_kind: str or ~azure.mgmt.servicefabric.models.ServiceKind + :ivar target_replica_set_size: The target replica set size as a number. + :vartype target_replica_set_size: int + :ivar min_replica_set_size: The minimum replica set size as a number. + :vartype min_replica_set_size: int + :ivar replica_restart_wait_duration: The duration between when a replica goes down and when a new replica is created, represented in ISO 8601 format (hh:mm:ss.s). - :type replica_restart_wait_duration: ~datetime.datetime - :param quorum_loss_wait_duration: The maximum duration for which a partition is allowed to be - in a state of quorum loss, represented in ISO 8601 format (hh:mm:ss.s). - :type quorum_loss_wait_duration: ~datetime.datetime - :param stand_by_replica_keep_duration: The definition on how long StandBy replicas should be + :vartype replica_restart_wait_duration: ~datetime.datetime + :ivar quorum_loss_wait_duration: The maximum duration for which a partition is allowed to be in + a state of quorum loss, represented in ISO 8601 format (hh:mm:ss.s). + :vartype quorum_loss_wait_duration: ~datetime.datetime + :ivar stand_by_replica_keep_duration: The definition on how long StandBy replicas should be maintained before being removed, represented in ISO 8601 format (hh:mm:ss.s). - :type stand_by_replica_keep_duration: ~datetime.datetime + :vartype stand_by_replica_keep_duration: ~datetime.datetime """ _validation = { @@ -3555,6 +4653,41 @@ def __init__( stand_by_replica_keep_duration: Optional[datetime.datetime] = None, **kwargs ): + """ + :keyword placement_constraints: The placement constraints as a string. Placement constraints + are boolean expressions on node properties and allow for restricting a service to particular + nodes based on the service requirements. For example, to place a service on nodes where + NodeType is blue specify the following: "NodeColor == blue)". + :paramtype placement_constraints: str + :keyword correlation_scheme: A list that describes the correlation of the service with other + services. + :paramtype correlation_scheme: + list[~azure.mgmt.servicefabric.models.ServiceCorrelationDescription] + :keyword service_load_metrics: The service load metrics is given as an array of + ServiceLoadMetricDescription objects. + :paramtype service_load_metrics: + list[~azure.mgmt.servicefabric.models.ServiceLoadMetricDescription] + :keyword service_placement_policies: A list that describes the correlation of the service with + other services. + :paramtype service_placement_policies: + list[~azure.mgmt.servicefabric.models.ServicePlacementPolicyDescription] + :keyword default_move_cost: Specifies the move cost for the service. Possible values include: + "Zero", "Low", "Medium", "High". + :paramtype default_move_cost: str or ~azure.mgmt.servicefabric.models.MoveCost + :keyword target_replica_set_size: The target replica set size as a number. + :paramtype target_replica_set_size: int + :keyword min_replica_set_size: The minimum replica set size as a number. + :paramtype min_replica_set_size: int + :keyword replica_restart_wait_duration: The duration between when a replica goes down and when + a new replica is created, represented in ISO 8601 format (hh:mm:ss.s). + :paramtype replica_restart_wait_duration: ~datetime.datetime + :keyword quorum_loss_wait_duration: The maximum duration for which a partition is allowed to be + in a state of quorum loss, represented in ISO 8601 format (hh:mm:ss.s). + :paramtype quorum_loss_wait_duration: ~datetime.datetime + :keyword stand_by_replica_keep_duration: The definition on how long StandBy replicas should be + maintained before being removed, represented in ISO 8601 format (hh:mm:ss.s). + :paramtype stand_by_replica_keep_duration: ~datetime.datetime + """ super(StatefulServiceUpdateProperties, self).__init__(placement_constraints=placement_constraints, correlation_scheme=correlation_scheme, service_load_metrics=service_load_metrics, service_placement_policies=service_placement_policies, default_move_cost=default_move_cost, **kwargs) self.service_kind = 'Stateful' # type: str self.target_replica_set_size = target_replica_set_size @@ -3571,51 +4704,52 @@ class StatelessServiceProperties(ServiceResourceProperties): All required parameters must be populated in order to send to Azure. - :param placement_constraints: The placement constraints as a string. Placement constraints are + :ivar placement_constraints: The placement constraints as a string. Placement constraints are boolean expressions on node properties and allow for restricting a service to particular nodes based on the service requirements. For example, to place a service on nodes where NodeType is blue specify the following: "NodeColor == blue)". - :type placement_constraints: str - :param correlation_scheme: A list that describes the correlation of the service with other + :vartype placement_constraints: str + :ivar correlation_scheme: A list that describes the correlation of the service with other services. - :type correlation_scheme: list[~azure.mgmt.servicefabric.models.ServiceCorrelationDescription] - :param service_load_metrics: The service load metrics is given as an array of + :vartype correlation_scheme: + list[~azure.mgmt.servicefabric.models.ServiceCorrelationDescription] + :ivar service_load_metrics: The service load metrics is given as an array of ServiceLoadMetricDescription objects. - :type service_load_metrics: list[~azure.mgmt.servicefabric.models.ServiceLoadMetricDescription] - :param service_placement_policies: A list that describes the correlation of the service with + :vartype service_load_metrics: + list[~azure.mgmt.servicefabric.models.ServiceLoadMetricDescription] + :ivar service_placement_policies: A list that describes the correlation of the service with other services. - :type service_placement_policies: + :vartype service_placement_policies: list[~azure.mgmt.servicefabric.models.ServicePlacementPolicyDescription] - :param default_move_cost: Specifies the move cost for the service. Possible values include: + :ivar default_move_cost: Specifies the move cost for the service. Possible values include: "Zero", "Low", "Medium", "High". - :type default_move_cost: str or ~azure.mgmt.servicefabric.models.MoveCost + :vartype default_move_cost: str or ~azure.mgmt.servicefabric.models.MoveCost :ivar provisioning_state: The current deployment or provisioning state, which only appears in the response. :vartype provisioning_state: str - :param service_kind: Required. The kind of service (Stateless or Stateful).Constant filled by - server. Possible values include: "Invalid", "Stateless", "Stateful". - :type service_kind: str or ~azure.mgmt.servicefabric.models.ServiceKind - :param service_type_name: The name of the service type. - :type service_type_name: str - :param partition_description: Describes how the service is partitioned. - :type partition_description: ~azure.mgmt.servicefabric.models.PartitionSchemeDescription - :param service_package_activation_mode: The activation Mode of the service package. Possible + :ivar service_kind: Required. The kind of service (Stateless or Stateful).Constant filled by + server. Possible values include: "Invalid", "Stateless", "Stateful". + :vartype service_kind: str or ~azure.mgmt.servicefabric.models.ServiceKind + :ivar service_type_name: The name of the service type. + :vartype service_type_name: str + :ivar partition_description: Describes how the service is partitioned. + :vartype partition_description: ~azure.mgmt.servicefabric.models.PartitionSchemeDescription + :ivar service_package_activation_mode: The activation Mode of the service package. Possible values include: "SharedProcess", "ExclusiveProcess". - :type service_package_activation_mode: str or + :vartype service_package_activation_mode: str or ~azure.mgmt.servicefabric.models.ArmServicePackageActivationMode - :param service_dns_name: Dns name used for the service. If this is specified, then the service + :ivar service_dns_name: Dns name used for the service. If this is specified, then the service can be accessed via its DNS name instead of service name. - :type service_dns_name: str - :param instance_count: The instance count. - :type instance_count: int - :param instance_close_delay_duration: Delay duration for RequestDrain feature to ensures that + :vartype service_dns_name: str + :ivar instance_count: The instance count. + :vartype instance_count: int + :ivar instance_close_delay_duration: Delay duration for RequestDrain feature to ensures that the endpoint advertised by the stateless instance is removed before the delay starts prior to closing the instance. This delay enables existing requests to drain gracefully before the instance actually goes down (https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-application-upgrade-advanced#avoid-connection-drops-during-stateless-service-planned-downtime-preview). - It is first interpreted as a string representing an ISO 8601 duration. If that fails, then it - is interpreted as a number representing the total number of milliseconds. - :type instance_close_delay_duration: str + It is represented in ISO 8601 format (hh:mm:ss.s). + :vartype instance_close_delay_duration: str """ _validation = { @@ -3656,6 +4790,48 @@ def __init__( instance_close_delay_duration: Optional[str] = None, **kwargs ): + """ + :keyword placement_constraints: The placement constraints as a string. Placement constraints + are boolean expressions on node properties and allow for restricting a service to particular + nodes based on the service requirements. For example, to place a service on nodes where + NodeType is blue specify the following: "NodeColor == blue)". + :paramtype placement_constraints: str + :keyword correlation_scheme: A list that describes the correlation of the service with other + services. + :paramtype correlation_scheme: + list[~azure.mgmt.servicefabric.models.ServiceCorrelationDescription] + :keyword service_load_metrics: The service load metrics is given as an array of + ServiceLoadMetricDescription objects. + :paramtype service_load_metrics: + list[~azure.mgmt.servicefabric.models.ServiceLoadMetricDescription] + :keyword service_placement_policies: A list that describes the correlation of the service with + other services. + :paramtype service_placement_policies: + list[~azure.mgmt.servicefabric.models.ServicePlacementPolicyDescription] + :keyword default_move_cost: Specifies the move cost for the service. Possible values include: + "Zero", "Low", "Medium", "High". + :paramtype default_move_cost: str or ~azure.mgmt.servicefabric.models.MoveCost + :keyword service_type_name: The name of the service type. + :paramtype service_type_name: str + :keyword partition_description: Describes how the service is partitioned. + :paramtype partition_description: ~azure.mgmt.servicefabric.models.PartitionSchemeDescription + :keyword service_package_activation_mode: The activation Mode of the service package. Possible + values include: "SharedProcess", "ExclusiveProcess". + :paramtype service_package_activation_mode: str or + ~azure.mgmt.servicefabric.models.ArmServicePackageActivationMode + :keyword service_dns_name: Dns name used for the service. If this is specified, then the + service can be accessed via its DNS name instead of service name. + :paramtype service_dns_name: str + :keyword instance_count: The instance count. + :paramtype instance_count: int + :keyword instance_close_delay_duration: Delay duration for RequestDrain feature to ensures that + the endpoint advertised by the stateless instance is removed before the delay starts prior to + closing the instance. This delay enables existing requests to drain gracefully before the + instance actually goes down + (https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-application-upgrade-advanced#avoid-connection-drops-during-stateless-service-planned-downtime-preview). + It is represented in ISO 8601 format (hh:mm:ss.s). + :paramtype instance_close_delay_duration: str + """ super(StatelessServiceProperties, self).__init__(placement_constraints=placement_constraints, correlation_scheme=correlation_scheme, service_load_metrics=service_load_metrics, service_placement_policies=service_placement_policies, default_move_cost=default_move_cost, service_type_name=service_type_name, partition_description=partition_description, service_package_activation_mode=service_package_activation_mode, service_dns_name=service_dns_name, **kwargs) self.service_kind = 'Stateless' # type: str self.instance_count = instance_count @@ -3667,37 +4843,39 @@ class StatelessServiceUpdateProperties(ServiceResourceUpdateProperties): All required parameters must be populated in order to send to Azure. - :param placement_constraints: The placement constraints as a string. Placement constraints are + :ivar placement_constraints: The placement constraints as a string. Placement constraints are boolean expressions on node properties and allow for restricting a service to particular nodes based on the service requirements. For example, to place a service on nodes where NodeType is blue specify the following: "NodeColor == blue)". - :type placement_constraints: str - :param correlation_scheme: A list that describes the correlation of the service with other + :vartype placement_constraints: str + :ivar correlation_scheme: A list that describes the correlation of the service with other services. - :type correlation_scheme: list[~azure.mgmt.servicefabric.models.ServiceCorrelationDescription] - :param service_load_metrics: The service load metrics is given as an array of + :vartype correlation_scheme: + list[~azure.mgmt.servicefabric.models.ServiceCorrelationDescription] + :ivar service_load_metrics: The service load metrics is given as an array of ServiceLoadMetricDescription objects. - :type service_load_metrics: list[~azure.mgmt.servicefabric.models.ServiceLoadMetricDescription] - :param service_placement_policies: A list that describes the correlation of the service with + :vartype service_load_metrics: + list[~azure.mgmt.servicefabric.models.ServiceLoadMetricDescription] + :ivar service_placement_policies: A list that describes the correlation of the service with other services. - :type service_placement_policies: + :vartype service_placement_policies: list[~azure.mgmt.servicefabric.models.ServicePlacementPolicyDescription] - :param default_move_cost: Specifies the move cost for the service. Possible values include: + :ivar default_move_cost: Specifies the move cost for the service. Possible values include: "Zero", "Low", "Medium", "High". - :type default_move_cost: str or ~azure.mgmt.servicefabric.models.MoveCost - :param service_kind: Required. The kind of service (Stateless or Stateful).Constant filled by - server. Possible values include: "Invalid", "Stateless", "Stateful". - :type service_kind: str or ~azure.mgmt.servicefabric.models.ServiceKind - :param instance_count: The instance count. - :type instance_count: int - :param instance_close_delay_duration: Delay duration for RequestDrain feature to ensures that + :vartype default_move_cost: str or ~azure.mgmt.servicefabric.models.MoveCost + :ivar service_kind: Required. The kind of service (Stateless or Stateful).Constant filled by + server. Possible values include: "Invalid", "Stateless", "Stateful". + :vartype service_kind: str or ~azure.mgmt.servicefabric.models.ServiceKind + :ivar instance_count: The instance count. + :vartype instance_count: int + :ivar instance_close_delay_duration: Delay duration for RequestDrain feature to ensures that the endpoint advertised by the stateless instance is removed before the delay starts prior to closing the instance. This delay enables existing requests to drain gracefully before the instance actually goes down (https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-application-upgrade-advanced#avoid-connection-drops-during-stateless-service-planned-downtime-preview). - It is first interpreted as a string representing an ISO 8601 duration. If that fails, then it - is interpreted as a number representing the total number of milliseconds. - :type instance_close_delay_duration: str + It is first interpreted as a string representing an ISO 8601 duration. It is represented in ISO + 8601 format (hh:mm:ss.s). + :vartype instance_close_delay_duration: str """ _validation = { @@ -3728,6 +4906,38 @@ def __init__( instance_close_delay_duration: Optional[str] = None, **kwargs ): + """ + :keyword placement_constraints: The placement constraints as a string. Placement constraints + are boolean expressions on node properties and allow for restricting a service to particular + nodes based on the service requirements. For example, to place a service on nodes where + NodeType is blue specify the following: "NodeColor == blue)". + :paramtype placement_constraints: str + :keyword correlation_scheme: A list that describes the correlation of the service with other + services. + :paramtype correlation_scheme: + list[~azure.mgmt.servicefabric.models.ServiceCorrelationDescription] + :keyword service_load_metrics: The service load metrics is given as an array of + ServiceLoadMetricDescription objects. + :paramtype service_load_metrics: + list[~azure.mgmt.servicefabric.models.ServiceLoadMetricDescription] + :keyword service_placement_policies: A list that describes the correlation of the service with + other services. + :paramtype service_placement_policies: + list[~azure.mgmt.servicefabric.models.ServicePlacementPolicyDescription] + :keyword default_move_cost: Specifies the move cost for the service. Possible values include: + "Zero", "Low", "Medium", "High". + :paramtype default_move_cost: str or ~azure.mgmt.servicefabric.models.MoveCost + :keyword instance_count: The instance count. + :paramtype instance_count: int + :keyword instance_close_delay_duration: Delay duration for RequestDrain feature to ensures that + the endpoint advertised by the stateless instance is removed before the delay starts prior to + closing the instance. This delay enables existing requests to drain gracefully before the + instance actually goes down + (https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-application-upgrade-advanced#avoid-connection-drops-during-stateless-service-planned-downtime-preview). + It is first interpreted as a string representing an ISO 8601 duration. It is represented in ISO + 8601 format (hh:mm:ss.s). + :paramtype instance_close_delay_duration: str + """ super(StatelessServiceUpdateProperties, self).__init__(placement_constraints=placement_constraints, correlation_scheme=correlation_scheme, service_load_metrics=service_load_metrics, service_placement_policies=service_placement_policies, default_move_cost=default_move_cost, **kwargs) self.service_kind = 'Stateless' # type: str self.instance_count = instance_count @@ -3737,18 +4947,18 @@ def __init__( class SystemData(msrest.serialization.Model): """Metadata pertaining to creation and last modification of the resource. - :param created_by: The identity that created the resource. - :type created_by: str - :param created_by_type: The type of identity that created the resource. - :type created_by_type: str - :param created_at: The timestamp of resource creation (UTC). - :type created_at: ~datetime.datetime - :param last_modified_by: The identity that last modified the resource. - :type last_modified_by: str - :param last_modified_by_type: The type of identity that last modified the resource. - :type last_modified_by_type: str - :param last_modified_at: The timestamp of resource last modification (UTC). - :type last_modified_at: ~datetime.datetime + :ivar created_by: The identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource. + :vartype created_by_type: str + :ivar created_at: The timestamp of resource creation (UTC). + :vartype created_at: ~datetime.datetime + :ivar last_modified_by: The identity that last modified the resource. + :vartype last_modified_by: str + :ivar last_modified_by_type: The type of identity that last modified the resource. + :vartype last_modified_by_type: str + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime """ _attribute_map = { @@ -3771,6 +4981,20 @@ def __init__( last_modified_at: Optional[datetime.datetime] = None, **kwargs ): + """ + :keyword created_by: The identity that created the resource. + :paramtype created_by: str + :keyword created_by_type: The type of identity that created the resource. + :paramtype created_by_type: str + :keyword created_at: The timestamp of resource creation (UTC). + :paramtype created_at: ~datetime.datetime + :keyword last_modified_by: The identity that last modified the resource. + :paramtype last_modified_by: str + :keyword last_modified_by_type: The type of identity that last modified the resource. + :paramtype last_modified_by_type: str + :keyword last_modified_at: The timestamp of resource last modification (UTC). + :paramtype last_modified_at: ~datetime.datetime + """ super(SystemData, self).__init__(**kwargs) self.created_by = created_by self.created_by_type = created_by_type @@ -3785,17 +5009,17 @@ class UniformInt64RangePartitionSchemeDescription(PartitionSchemeDescription): All required parameters must be populated in order to send to Azure. - :param partition_scheme: Required. Specifies how the service is partitioned.Constant filled by - server. Possible values include: "Invalid", "Singleton", "UniformInt64Range", "Named". - :type partition_scheme: str or ~azure.mgmt.servicefabric.models.PartitionScheme - :param count: Required. The number of partitions. - :type count: int - :param low_key: Required. String indicating the lower bound of the partition key range that + :ivar partition_scheme: Required. Specifies how the service is partitioned.Constant filled by + server. Possible values include: "Invalid", "Singleton", "UniformInt64Range", "Named". + :vartype partition_scheme: str or ~azure.mgmt.servicefabric.models.PartitionScheme + :ivar count: Required. The number of partitions. + :vartype count: int + :ivar low_key: Required. String indicating the lower bound of the partition key range that should be split between the partition ‘count’. - :type low_key: str - :param high_key: Required. String indicating the upper bound of the partition key range that + :vartype low_key: str + :ivar high_key: Required. String indicating the upper bound of the partition key range that should be split between the partition ‘count’. - :type high_key: str + :vartype high_key: str """ _validation = { @@ -3820,6 +5044,16 @@ def __init__( high_key: str, **kwargs ): + """ + :keyword count: Required. The number of partitions. + :paramtype count: int + :keyword low_key: Required. String indicating the lower bound of the partition key range that + should be split between the partition ‘count’. + :paramtype low_key: str + :keyword high_key: Required. String indicating the upper bound of the partition key range that + should be split between the partition ‘count’. + :paramtype high_key: str + """ super(UniformInt64RangePartitionSchemeDescription, self).__init__(**kwargs) self.partition_scheme = 'UniformInt64Range' # type: str self.count = count @@ -3830,8 +5064,8 @@ def __init__( class UpgradableVersionPathResult(msrest.serialization.Model): """The list of intermediate cluster code versions for an upgrade or downgrade. Or minimum and maximum upgradable version if no target was given. - :param supported_path: - :type supported_path: list[str] + :ivar supported_path: + :vartype supported_path: list[str] """ _attribute_map = { @@ -3844,6 +5078,10 @@ def __init__( supported_path: Optional[List[str]] = None, **kwargs ): + """ + :keyword supported_path: + :paramtype supported_path: list[str] + """ super(UpgradableVersionPathResult, self).__init__(**kwargs) self.supported_path = supported_path @@ -3853,8 +5091,8 @@ class UpgradableVersionsDescription(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param target_version: Required. The target code version. - :type target_version: str + :ivar target_version: Required. The target code version. + :vartype target_version: str """ _validation = { @@ -3871,6 +5109,10 @@ def __init__( target_version: str, **kwargs ): + """ + :keyword target_version: Required. The target code version. + :paramtype target_version: str + """ super(UpgradableVersionsDescription, self).__init__(**kwargs) self.target_version = target_version @@ -3900,6 +5142,8 @@ def __init__( self, **kwargs ): + """ + """ super(UserAssignedIdentity, self).__init__(**kwargs) self.principal_id = None self.client_id = None diff --git a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/models/_service_fabric_management_client_enums.py b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/models/_service_fabric_management_client_enums.py index 7633d775047e..e681d4e7f180 100644 --- a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/models/_service_fabric_management_client_enums.py +++ b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/models/_service_fabric_management_client_enums.py @@ -6,27 +6,12 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta +from enum import Enum from six import with_metaclass +from azure.core import CaseInsensitiveEnumMeta -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class AddOnFeatures(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class AddOnFeatures(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Available cluster add-on features """ @@ -35,7 +20,7 @@ class AddOnFeatures(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): BACKUP_RESTORE_SERVICE = "BackupRestoreService" RESOURCE_MONITOR_SERVICE = "ResourceMonitorService" -class ArmServicePackageActivationMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ArmServicePackageActivationMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The activation Mode of the service package """ @@ -44,7 +29,7 @@ class ArmServicePackageActivationMode(with_metaclass(_CaseInsensitiveEnumMeta, s #: Indicates the application package activation mode will use exclusive process. EXCLUSIVE_PROCESS = "ExclusiveProcess" -class ArmUpgradeFailureAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ArmUpgradeFailureAction(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The activation Mode of the service package """ @@ -55,14 +40,14 @@ class ArmUpgradeFailureAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum #: fails. Service Fabric will not proceed to the next upgrade domain automatically. MANUAL = "Manual" -class ClusterEnvironment(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ClusterEnvironment(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Cluster operating system, the default will be Windows """ WINDOWS = "Windows" LINUX = "Linux" -class ClusterState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ClusterState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The current state of the cluster. @@ -98,7 +83,7 @@ class ClusterState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): AUTO_SCALE = "AutoScale" READY = "Ready" -class ClusterUpgradeCadence(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ClusterUpgradeCadence(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Indicates when new cluster runtime version upgrades will be applied after they are released. By default is Wave0. """ @@ -113,7 +98,12 @@ class ClusterUpgradeCadence(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)) #: clusters. WAVE2 = "Wave2" -class DurabilityLevel(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ClusterVersionsEnvironment(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + + WINDOWS = "Windows" + LINUX = "Linux" + +class DurabilityLevel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The durability level of the node type. Learn about `DurabilityLevel `_. @@ -128,12 +118,7 @@ class DurabilityLevel(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): SILVER = "Silver" GOLD = "Gold" -class Enum14(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - - WINDOWS = "Windows" - LINUX = "Linux" - -class ManagedIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ManagedIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of managed identity for the resource. """ @@ -147,7 +132,7 @@ class ManagedIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: Indicates that no identity is associated with the resource. NONE = "None" -class MoveCost(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class MoveCost(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the move cost for the service. """ @@ -160,14 +145,14 @@ class MoveCost(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: Specifies the move cost of the service as High. The value is 3. HIGH = "High" -class NotificationCategory(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class NotificationCategory(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The category of notification. """ #: Notification will be regarding wave progress. WAVE_PROGRESS = "WaveProgress" -class NotificationChannel(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class NotificationChannel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The notification channel indicates the type of receivers subscribed to the notification, either user or subscription. """ @@ -180,7 +165,7 @@ class NotificationChannel(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: notifications. EMAIL_SUBSCRIPTION = "EmailSubscription" -class NotificationLevel(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class NotificationLevel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The level of notification. """ @@ -189,7 +174,7 @@ class NotificationLevel(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: Receive all notifications. ALL = "All" -class PartitionScheme(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PartitionScheme(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Enumerates the ways that a service can be partitioned. """ @@ -206,7 +191,7 @@ class PartitionScheme(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: object. The value is 3. NAMED = "Named" -class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The provisioning state of the cluster resource. """ @@ -215,7 +200,7 @@ class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): FAILED = "Failed" CANCELED = "Canceled" -class ReliabilityLevel(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ReliabilityLevel(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The reliability level sets the replica set size of system services. Learn about `ReliabilityLevel `_. @@ -236,7 +221,7 @@ class ReliabilityLevel(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): GOLD = "Gold" PLATINUM = "Platinum" -class RollingUpgradeMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class RollingUpgradeMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The mode used to monitor health during a rolling upgrade. The values are UnmonitoredAuto, UnmonitoredManual, and Monitored. """ @@ -254,7 +239,7 @@ class RollingUpgradeMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: before proceeding. The value is 3. MONITORED = "Monitored" -class ServiceCorrelationScheme(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ServiceCorrelationScheme(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The service correlation scheme. """ @@ -273,7 +258,7 @@ class ServiceCorrelationScheme(with_metaclass(_CaseInsensitiveEnumMeta, str, Enu #: be collocated. The value is 3. NON_ALIGNED_AFFINITY = "NonAlignedAffinity" -class ServiceKind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ServiceKind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The kind of service (Stateless or Stateful). """ @@ -286,7 +271,7 @@ class ServiceKind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: value is 2. STATEFUL = "Stateful" -class ServiceLoadMetricWeight(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ServiceLoadMetricWeight(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Determines the metric weight relative to the other metrics that are configured for this service. During runtime, if two metrics end up in conflict, the Cluster Resource Manager prefers the metric with the higher weight. @@ -301,7 +286,7 @@ class ServiceLoadMetricWeight(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum #: Specifies the metric weight of the service load as High. The value is 3. HIGH = "High" -class ServicePlacementPolicyType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ServicePlacementPolicyType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of placement policy for a service fabric service. Following are the possible values. """ @@ -331,7 +316,7 @@ class ServicePlacementPolicyType(with_metaclass(_CaseInsensitiveEnumMeta, str, E #: replicas of a particular partition of the service should be placed atomically. The value is 5. NON_PARTIALLY_PLACE_SERVICE = "NonPartiallyPlaceService" -class SfZonalUpgradeMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SfZonalUpgradeMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """This property controls the logical grouping of VMs in upgrade domains (UDs). This property can't be modified if a node type with multiple Availability Zones is already present in the cluster. @@ -348,7 +333,7 @@ class SfZonalUpgradeMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: zone. This update process is safer for the cluster and the user application. HIERARCHICAL = "Hierarchical" -class StoreName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class StoreName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The local certificate store location. """ @@ -361,7 +346,7 @@ class StoreName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): TRUSTED_PEOPLE = "TrustedPeople" TRUSTED_PUBLISHER = "TrustedPublisher" -class UpgradeMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class UpgradeMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The upgrade mode of the cluster when new Service Fabric runtime version is available. """ @@ -372,7 +357,7 @@ class UpgradeMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: The cluster is upgraded by setting the **clusterCodeVersion** property in the cluster resource. MANUAL = "Manual" -class VmssZonalUpgradeMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class VmssZonalUpgradeMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """This property defines the upgrade mode for the virtual machine scale set, it is mandatory if a node type with multiple Availability Zones is added. """ diff --git a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/operations/_application_type_versions_operations.py b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/operations/_application_type_versions_operations.py index 8c05d77f7518..2b0895c2b374 100644 --- a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/operations/_application_type_versions_operations.py +++ b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/operations/_application_type_versions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,24 +6,192 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + application_type_name: str, + version: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-06-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}/versions/{version}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "applicationTypeName": _SERIALIZER.url("application_type_name", application_type_name, 'str'), + "version": _SERIALIZER.url("version", version, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + application_type_name: str, + version: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-06-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}/versions/{version}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "applicationTypeName": _SERIALIZER.url("application_type_name", application_type_name, 'str'), + "version": _SERIALIZER.url("version", version, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + application_type_name: str, + version: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-06-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}/versions/{version}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "applicationTypeName": _SERIALIZER.url("application_type_name", application_type_name, 'str'), + "version": _SERIALIZER.url("version", version, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + application_type_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-06-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}/versions") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "applicationTypeName": _SERIALIZER.url("application_type_name", application_type_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) class ApplicationTypeVersionsOperations(object): """ApplicationTypeVersionsOperations operations. @@ -46,15 +215,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - cluster_name, # type: str - application_type_name, # type: str - version, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ApplicationTypeVersionResource" + resource_group_name: str, + cluster_name: str, + application_type_name: str, + version: str, + **kwargs: Any + ) -> "_models.ApplicationTypeVersionResource": """Gets a Service Fabric application type version resource. Get a Service Fabric application type version resource created or in the process of being @@ -78,35 +247,32 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'applicationTypeName': self._serialize.url("application_type_name", application_type_name, 'str'), - 'version': self._serialize.url("version", version, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2021-06-01") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_type_name=application_type_name, + version=version, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ApplicationTypeVersionResource', pipeline_response) @@ -115,58 +281,54 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}/versions/{version}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}/versions/{version}"} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - cluster_name, # type: str - application_type_name, # type: str - version, # type: str - parameters, # type: "_models.ApplicationTypeVersionResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.ApplicationTypeVersionResource" + resource_group_name: str, + cluster_name: str, + application_type_name: str, + version: str, + parameters: "_models.ApplicationTypeVersionResource", + **kwargs: Any + ) -> "_models.ApplicationTypeVersionResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationTypeVersionResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - 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'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'applicationTypeName': self._serialize.url("application_type_name", application_type_name, 'str'), - 'version': self._serialize.url("version", version, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ApplicationTypeVersionResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-06-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ApplicationTypeVersionResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_type_name=application_type_name, + version=version, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = self._deserialize('ApplicationTypeVersionResource', pipeline_response) @@ -174,18 +336,20 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}/versions/{version}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}/versions/{version}"} # type: ignore + + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - cluster_name, # type: str - application_type_name, # type: str - version, # type: str - parameters, # type: "_models.ApplicationTypeVersionResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ApplicationTypeVersionResource"] + resource_group_name: str, + cluster_name: str, + application_type_name: str, + version: str, + parameters: "_models.ApplicationTypeVersionResource", + **kwargs: Any + ) -> LROPoller["_models.ApplicationTypeVersionResource"]: """Creates or updates a Service Fabric application type version resource. Create or update a Service Fabric application type version resource with the specified name. @@ -202,14 +366,20 @@ def begin_create_or_update( :type parameters: ~azure.mgmt.servicefabric.models.ApplicationTypeVersionResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either ApplicationTypeVersionResource or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicefabric.models.ApplicationTypeVersionResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ApplicationTypeVersionResource or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.servicefabric.models.ApplicationTypeVersionResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-06-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationTypeVersionResource"] lro_delay = kwargs.pop( @@ -224,29 +394,22 @@ def begin_create_or_update( application_type_name=application_type_name, version=version, parameters=parameters, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ApplicationTypeVersionResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - 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'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'applicationTypeName': self._serialize.url("application_type_name", application_type_name, 'str'), - 'version': self._serialize.url("version", version, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -256,69 +419,65 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}/versions/{version}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}/versions/{version}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - cluster_name, # type: str - application_type_name, # type: str - version, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + cluster_name: str, + application_type_name: str, + version: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - 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'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'applicationTypeName': self._serialize.url("application_type_name", application_type_name, 'str'), - 'version': self._serialize.url("version", version, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2021-06-01") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_type_name=application_type_name, + version=version, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}/versions/{version}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}/versions/{version}"} # type: ignore + - def begin_delete( + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - cluster_name, # type: str - application_type_name, # type: str - version, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + cluster_name: str, + application_type_name: str, + version: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a Service Fabric application type version resource. Delete a Service Fabric application type version resource with the specified name. @@ -333,14 +492,17 @@ def begin_delete( :type version: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-06-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -354,26 +516,18 @@ def begin_delete( cluster_name=cluster_name, application_type_name=application_type_name, version=version, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - 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'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'applicationTypeName': self._serialize.url("application_type_name", application_type_name, 'str'), - 'version': self._serialize.url("version", version, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -383,19 +537,20 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}/versions/{version}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}/versions/{version}"} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - cluster_name, # type: str - application_type_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ApplicationTypeVersionResourceList" - """Gets the list of application type version resources created in the specified Service Fabric application type name resource. + resource_group_name: str, + cluster_name: str, + application_type_name: str, + **kwargs: Any + ) -> "_models.ApplicationTypeVersionResourceList": + """Gets the list of application type version resources created in the specified Service Fabric + application type name resource. Gets all application type version resources created or in the process of being created in the Service Fabric application type name resource. @@ -416,34 +571,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.list.metadata['url'] # type: ignore - 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'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'applicationTypeName': self._serialize.url("application_type_name", application_type_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2021-06-01") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_type_name=application_type_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ApplicationTypeVersionResourceList', pipeline_response) @@ -452,4 +604,6 @@ def list( return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}/versions'} # type: ignore + + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}/versions"} # type: ignore + diff --git a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/operations/_application_types_operations.py b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/operations/_application_types_operations.py index 2d02f041c731..f926496e9a36 100644 --- a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/operations/_application_types_operations.py +++ b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/operations/_application_types_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,24 +6,184 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + application_type_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-06-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "applicationTypeName": _SERIALIZER.url("application_type_name", application_type_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_or_update_request( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + application_type_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-06-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "applicationTypeName": _SERIALIZER.url("application_type_name", application_type_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + application_type_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-06-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "applicationTypeName": _SERIALIZER.url("application_type_name", application_type_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-06-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) class ApplicationTypesOperations(object): """ApplicationTypesOperations operations. @@ -46,14 +207,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - cluster_name, # type: str - application_type_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ApplicationTypeResource" + resource_group_name: str, + cluster_name: str, + application_type_name: str, + **kwargs: Any + ) -> "_models.ApplicationTypeResource": """Gets a Service Fabric application type name resource. Get a Service Fabric application type name resource created or in the process of being created @@ -75,34 +236,31 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'applicationTypeName': self._serialize.url("application_type_name", application_type_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2021-06-01") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_type_name=application_type_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ApplicationTypeResource', pipeline_response) @@ -111,17 +269,19 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}"} # type: ignore + + + @distributed_trace def create_or_update( self, - resource_group_name, # type: str - cluster_name, # type: str - application_type_name, # type: str - parameters, # type: "_models.ApplicationTypeResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.ApplicationTypeResource" + resource_group_name: str, + cluster_name: str, + application_type_name: str, + parameters: "_models.ApplicationTypeResource", + **kwargs: Any + ) -> "_models.ApplicationTypeResource": """Creates or updates a Service Fabric application type name resource. Create or update a Service Fabric application type name resource with the specified name. @@ -144,39 +304,35 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - 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'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'applicationTypeName': self._serialize.url("application_type_name", application_type_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ApplicationTypeResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-06-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ApplicationTypeResource') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_type_name=application_type_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ApplicationTypeResource', pipeline_response) @@ -185,64 +341,62 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}'} # type: ignore - def _delete_initial( + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}"} # type: ignore + + + def _delete_initial( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - cluster_name, # type: str - application_type_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + cluster_name: str, + application_type_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - 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'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'applicationTypeName': self._serialize.url("application_type_name", application_type_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2021-06-01") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_type_name=application_type_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}"} # type: ignore + - def begin_delete( + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - cluster_name, # type: str - application_type_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + cluster_name: str, + application_type_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a Service Fabric application type name resource. Delete a Service Fabric application type name resource with the specified name. @@ -255,14 +409,17 @@ def begin_delete( :type application_type_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-06-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -275,25 +432,18 @@ def begin_delete( resource_group_name=resource_group_name, cluster_name=cluster_name, application_type_name=application_type_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - 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'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'applicationTypeName': self._serialize.url("application_type_name", application_type_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -303,18 +453,19 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}"} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ApplicationTypeResourceList" - """Gets the list of application type name resources created in the specified Service Fabric cluster resource. + resource_group_name: str, + cluster_name: str, + **kwargs: Any + ) -> "_models.ApplicationTypeResourceList": + """Gets the list of application type name resources created in the specified Service Fabric + cluster resource. Gets all application type name resources created or in the process of being created in the Service Fabric cluster resource. @@ -333,33 +484,30 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.list.metadata['url'] # type: ignore - 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'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2021-06-01") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ApplicationTypeResourceList', pipeline_response) @@ -368,4 +516,6 @@ def list( return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes'} # type: ignore + + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes"} # type: ignore + diff --git a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/operations/_applications_operations.py b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/operations/_applications_operations.py index 592887a5e162..b03a5367b48c 100644 --- a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/operations/_applications_operations.py +++ b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/operations/_applications_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,24 +6,230 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + application_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-06-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "applicationName": _SERIALIZER.url("application_name", application_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + application_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-06-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "applicationName": _SERIALIZER.url("application_name", application_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + application_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-06-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "applicationName": _SERIALIZER.url("application_name", application_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + application_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-06-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "applicationName": _SERIALIZER.url("application_name", application_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-06-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) class ApplicationsOperations(object): """ApplicationsOperations operations. @@ -46,14 +253,14 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - cluster_name, # type: str - application_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ApplicationResource" + resource_group_name: str, + cluster_name: str, + application_name: str, + **kwargs: Any + ) -> "_models.ApplicationResource": """Gets a Service Fabric application resource. Get a Service Fabric application resource created or in the process of being created in the @@ -75,34 +282,31 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'applicationName': self._serialize.url("application_name", application_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2021-06-01") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_name=application_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ApplicationResource', pipeline_response) @@ -111,56 +315,52 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}"} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - cluster_name, # type: str - application_name, # type: str - parameters, # type: "_models.ApplicationResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.ApplicationResource" + resource_group_name: str, + cluster_name: str, + application_name: str, + parameters: "_models.ApplicationResource", + **kwargs: Any + ) -> "_models.ApplicationResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - 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'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'applicationName': self._serialize.url("application_name", application_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ApplicationResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-06-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ApplicationResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_name=application_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = self._deserialize('ApplicationResource', pipeline_response) @@ -168,17 +368,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}"} # type: ignore + + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - cluster_name, # type: str - application_name, # type: str - parameters, # type: "_models.ApplicationResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ApplicationResource"] + resource_group_name: str, + cluster_name: str, + application_name: str, + parameters: "_models.ApplicationResource", + **kwargs: Any + ) -> LROPoller["_models.ApplicationResource"]: """Creates or updates a Service Fabric application resource. Create or update a Service Fabric application resource with the specified name. @@ -193,14 +395,19 @@ def begin_create_or_update( :type parameters: ~azure.mgmt.servicefabric.models.ApplicationResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either ApplicationResource or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ApplicationResource or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicefabric.models.ApplicationResource] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-06-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationResource"] lro_delay = kwargs.pop( @@ -214,28 +421,22 @@ def begin_create_or_update( cluster_name=cluster_name, application_name=application_name, parameters=parameters, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ApplicationResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - 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'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'applicationName': self._serialize.url("application_name", application_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -245,58 +446,52 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}"} # type: ignore def _update_initial( self, - resource_group_name, # type: str - cluster_name, # type: str - application_name, # type: str - parameters, # type: "_models.ApplicationResourceUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.ApplicationResource" + resource_group_name: str, + cluster_name: str, + application_name: str, + parameters: "_models.ApplicationResourceUpdate", + **kwargs: Any + ) -> "_models.ApplicationResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - 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'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'applicationName': self._serialize.url("application_name", application_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ApplicationResourceUpdate') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-06-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ApplicationResourceUpdate') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_name=application_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = self._deserialize('ApplicationResource', pipeline_response) @@ -304,17 +499,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}"} # type: ignore + + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - cluster_name, # type: str - application_name, # type: str - parameters, # type: "_models.ApplicationResourceUpdate" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ApplicationResource"] + resource_group_name: str, + cluster_name: str, + application_name: str, + parameters: "_models.ApplicationResourceUpdate", + **kwargs: Any + ) -> LROPoller["_models.ApplicationResource"]: """Updates a Service Fabric application resource. Update a Service Fabric application resource with the specified name. @@ -329,14 +526,19 @@ def begin_update( :type parameters: ~azure.mgmt.servicefabric.models.ApplicationResourceUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either ApplicationResource or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ApplicationResource or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicefabric.models.ApplicationResource] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-06-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationResource"] lro_delay = kwargs.pop( @@ -350,28 +552,22 @@ def begin_update( cluster_name=cluster_name, application_name=application_name, parameters=parameters, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ApplicationResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - 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'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'applicationName': self._serialize.url("application_name", application_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -381,66 +577,62 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - cluster_name, # type: str - application_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + cluster_name: str, + application_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - 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'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'applicationName': self._serialize.url("application_name", application_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2021-06-01") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_name=application_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}"} # type: ignore + - def begin_delete( + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - cluster_name, # type: str - application_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + cluster_name: str, + application_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a Service Fabric application resource. Delete a Service Fabric application resource with the specified name. @@ -453,14 +645,17 @@ def begin_delete( :type application_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-06-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -473,25 +668,18 @@ def begin_delete( resource_group_name=resource_group_name, cluster_name=cluster_name, application_name=application_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - 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'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'applicationName': self._serialize.url("application_name", application_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -501,18 +689,19 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}"} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ApplicationResourceList" - """Gets the list of application resources created in the specified Service Fabric cluster resource. + resource_group_name: str, + cluster_name: str, + **kwargs: Any + ) -> "_models.ApplicationResourceList": + """Gets the list of application resources created in the specified Service Fabric cluster + resource. Gets all application resources created or in the process of being created in the Service Fabric cluster resource. @@ -531,33 +720,30 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.list.metadata['url'] # type: ignore - 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'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2021-06-01") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ApplicationResourceList', pipeline_response) @@ -566,4 +752,6 @@ def list( return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications'} # type: ignore + + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications"} # type: ignore + diff --git a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/operations/_cluster_versions_operations.py b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/operations/_cluster_versions_operations.py index 8a7096ef2a02..fe32c3b74f77 100644 --- a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/operations/_cluster_versions_operations.py +++ b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/operations/_cluster_versions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,22 +6,167 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + location: str, + subscription_id: str, + cluster_version: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-06-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/clusterVersions/{clusterVersion}") # pylint: disable=line-too-long + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "clusterVersion": _SERIALIZER.url("cluster_version", cluster_version, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_get_by_environment_request( + location: str, + environment: Union[str, "_models.ClusterVersionsEnvironment"], + subscription_id: str, + cluster_version: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-06-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/environments/{environment}/clusterVersions/{clusterVersion}") # pylint: disable=line-too-long + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "environment": _SERIALIZER.url("environment", environment, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "clusterVersion": _SERIALIZER.url("cluster_version", cluster_version, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_request( + location: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-06-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/clusterVersions") # pylint: disable=line-too-long + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_by_environment_request( + location: str, + environment: Union[str, "_models.ClusterVersionsEnvironment"], + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-06-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/environments/{environment}/clusterVersions") # pylint: disable=line-too-long + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "environment": _SERIALIZER.url("environment", environment, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) class ClusterVersionsOperations(object): """ClusterVersionsOperations operations. @@ -44,14 +190,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - location, # type: str - cluster_version, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ClusterCodeVersionsListResult" - """Gets information about a Service Fabric cluster code version available in the specified location. + location: str, + cluster_version: str, + **kwargs: Any + ) -> "_models.ClusterCodeVersionsListResult": + """Gets information about a Service Fabric cluster code version available in the specified + location. Gets information about an available Service Fabric cluster code version. @@ -70,33 +217,30 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'location': self._serialize.url("location", location, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'clusterVersion': self._serialize.url("cluster_version", cluster_version, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + api_version = kwargs.pop('api_version', "2021-06-01") # type: str + + + request = build_get_request( + location=location, + subscription_id=self._config.subscription_id, + cluster_version=cluster_version, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ClusterCodeVersionsListResult', pipeline_response) @@ -105,17 +249,20 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/clusterVersions/{clusterVersion}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/clusterVersions/{clusterVersion}"} # type: ignore + + + @distributed_trace def get_by_environment( self, - location, # type: str - environment, # type: Union[str, "_models.Enum14"] - cluster_version, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ClusterCodeVersionsListResult" - """Gets information about a Service Fabric cluster code version available for the specified environment. + location: str, + environment: Union[str, "_models.ClusterVersionsEnvironment"], + cluster_version: str, + **kwargs: Any + ) -> "_models.ClusterCodeVersionsListResult": + """Gets information about a Service Fabric cluster code version available for the specified + environment. Gets information about an available Service Fabric cluster code version by environment. @@ -123,7 +270,7 @@ def get_by_environment( location. :type location: str :param environment: The operating system of the cluster. The default means all. - :type environment: str or ~azure.mgmt.servicefabric.models.Enum14 + :type environment: str or ~azure.mgmt.servicefabric.models.ClusterVersionsEnvironment :param cluster_version: The cluster code version. :type cluster_version: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -136,34 +283,31 @@ def get_by_environment( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get_by_environment.metadata['url'] # type: ignore - path_format_arguments = { - 'location': self._serialize.url("location", location, 'str'), - 'environment': self._serialize.url("environment", environment, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'clusterVersion': self._serialize.url("cluster_version", cluster_version, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + api_version = kwargs.pop('api_version', "2021-06-01") # type: str + + + request = build_get_by_environment_request( + location=location, + environment=environment, + subscription_id=self._config.subscription_id, + cluster_version=cluster_version, + api_version=api_version, + template_url=self.get_by_environment.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ClusterCodeVersionsListResult', pipeline_response) @@ -172,14 +316,16 @@ def get_by_environment( return cls(pipeline_response, deserialized, {}) return deserialized - get_by_environment.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/environments/{environment}/clusterVersions/{clusterVersion}'} # type: ignore + get_by_environment.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/environments/{environment}/clusterVersions/{clusterVersion}"} # type: ignore + + + @distributed_trace def list( self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ClusterCodeVersionsListResult" + location: str, + **kwargs: Any + ) -> "_models.ClusterCodeVersionsListResult": """Gets the list of Service Fabric cluster code versions available for the specified location. Gets all available code versions for Service Fabric cluster resources by location. @@ -197,32 +343,29 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'location': self._serialize.url("location", location, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + api_version = kwargs.pop('api_version', "2021-06-01") # type: str + + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ClusterCodeVersionsListResult', pipeline_response) @@ -231,15 +374,17 @@ def list( return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/clusterVersions'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/clusterVersions"} # type: ignore + + + @distributed_trace def list_by_environment( self, - location, # type: str - environment, # type: Union[str, "_models.Enum14"] - **kwargs # type: Any - ): - # type: (...) -> "_models.ClusterCodeVersionsListResult" + location: str, + environment: Union[str, "_models.ClusterVersionsEnvironment"], + **kwargs: Any + ) -> "_models.ClusterCodeVersionsListResult": """Gets the list of Service Fabric cluster code versions available for the specified environment. Gets all available code versions for Service Fabric cluster resources by environment. @@ -248,7 +393,7 @@ def list_by_environment( location. :type location: str :param environment: The operating system of the cluster. The default means all. - :type environment: str or ~azure.mgmt.servicefabric.models.Enum14 + :type environment: str or ~azure.mgmt.servicefabric.models.ClusterVersionsEnvironment :keyword callable cls: A custom type or function that will be passed the direct response :return: ClusterCodeVersionsListResult, or the result of cls(response) :rtype: ~azure.mgmt.servicefabric.models.ClusterCodeVersionsListResult @@ -259,33 +404,30 @@ def list_by_environment( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.list_by_environment.metadata['url'] # type: ignore - path_format_arguments = { - 'location': self._serialize.url("location", location, 'str'), - 'environment': self._serialize.url("environment", environment, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + api_version = kwargs.pop('api_version', "2021-06-01") # type: str + + + request = build_list_by_environment_request( + location=location, + environment=environment, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_environment.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ClusterCodeVersionsListResult', pipeline_response) @@ -294,4 +436,6 @@ def list_by_environment( return cls(pipeline_response, deserialized, {}) return deserialized - list_by_environment.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/environments/{environment}/clusterVersions'} # type: ignore + + list_by_environment.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/environments/{environment}/clusterVersions"} # type: ignore + diff --git a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/operations/_clusters_operations.py b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/operations/_clusters_operations.py index 9d855f07ba2b..4be33bdb08d2 100644 --- a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/operations/_clusters_operations.py +++ b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/operations/_clusters_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,24 +6,296 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + resource_group_name: str, + cluster_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-06-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + resource_group_name: str, + cluster_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-06-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + cluster_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-06-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + resource_group_name: str, + cluster_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-06-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_by_resource_group_request( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-06-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-06-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/clusters") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_upgradable_versions_request( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-06-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/listUpgradableVersions") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) class ClustersOperations(object): """ClustersOperations operations. @@ -46,13 +319,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Cluster" + resource_group_name: str, + cluster_name: str, + **kwargs: Any + ) -> "_models.Cluster": """Gets a Service Fabric cluster resource. Get a Service Fabric cluster resource created or in the process of being created in the @@ -72,33 +345,30 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2021-06-01") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_get_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Cluster', pipeline_response) @@ -107,54 +377,50 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}"} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - cluster_name, # type: str - parameters, # type: "_models.Cluster" - **kwargs # type: Any - ): - # type: (...) -> "_models.Cluster" + resource_group_name: str, + cluster_name: str, + parameters: "_models.Cluster", + **kwargs: Any + ) -> "_models.Cluster": cls = kwargs.pop('cls', None) # type: ClsType["_models.Cluster"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'Cluster') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-06-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'Cluster') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('Cluster', pipeline_response) @@ -166,16 +432,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}"} # type: ignore + + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - cluster_name, # type: str - parameters, # type: "_models.Cluster" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Cluster"] + resource_group_name: str, + cluster_name: str, + parameters: "_models.Cluster", + **kwargs: Any + ) -> LROPoller["_models.Cluster"]: """Creates or updates a Service Fabric cluster resource. Create or update a Service Fabric cluster resource with the specified name. @@ -188,14 +456,18 @@ def begin_create_or_update( :type parameters: ~azure.mgmt.servicefabric.models.Cluster :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Cluster or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicefabric.models.Cluster] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-06-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Cluster"] lro_delay = kwargs.pop( @@ -208,27 +480,22 @@ def begin_create_or_update( resource_group_name=resource_group_name, cluster_name=cluster_name, parameters=parameters, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Cluster', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -238,56 +505,50 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}"} # type: ignore def _update_initial( self, - resource_group_name, # type: str - cluster_name, # type: str - parameters, # type: "_models.ClusterUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.Cluster" + resource_group_name: str, + cluster_name: str, + parameters: "_models.ClusterUpdateParameters", + **kwargs: Any + ) -> "_models.Cluster": cls = kwargs.pop('cls', None) # type: ClsType["_models.Cluster"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ClusterUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-06-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ClusterUpdateParameters') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('Cluster', pipeline_response) @@ -299,16 +560,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}"} # type: ignore + + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - cluster_name, # type: str - parameters, # type: "_models.ClusterUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Cluster"] + resource_group_name: str, + cluster_name: str, + parameters: "_models.ClusterUpdateParameters", + **kwargs: Any + ) -> LROPoller["_models.Cluster"]: """Updates the configuration of a Service Fabric cluster resource. Update the configuration of a Service Fabric cluster resource with the specified name. @@ -322,14 +585,18 @@ def begin_update( :type parameters: ~azure.mgmt.servicefabric.models.ClusterUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Cluster or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicefabric.models.Cluster] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-06-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.Cluster"] lro_delay = kwargs.pop( @@ -342,27 +609,22 @@ def begin_update( resource_group_name=resource_group_name, cluster_name=cluster_name, parameters=parameters, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('Cluster', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -372,17 +634,17 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def delete( + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}"} # type: ignore + + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + cluster_name: str, + **kwargs: Any + ) -> None: """Deletes a Service Fabric cluster resource. Delete a Service Fabric cluster resource with the specified name. @@ -401,46 +663,44 @@ def delete( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2021-06-01") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.delete.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}"} # type: ignore + + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ClusterListResult" + resource_group_name: str, + **kwargs: Any + ) -> "_models.ClusterListResult": """Gets the list of Service Fabric cluster resources created in the specified resource group. Gets all Service Fabric cluster resources created or in the process of being created in the @@ -458,32 +718,29 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.list_by_resource_group.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2021-06-01") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_resource_group.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ClusterListResult', pipeline_response) @@ -492,13 +749,15 @@ def list_by_resource_group( return cls(pipeline_response, deserialized, {}) return deserialized - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters"} # type: ignore + + + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> "_models.ClusterListResult" + **kwargs: Any + ) -> "_models.ClusterListResult": """Gets the list of Service Fabric cluster resources created in the specified subscription. Gets all Service Fabric cluster resources created or in the process of being created in the @@ -514,31 +773,28 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2021-06-01") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ClusterListResult', pipeline_response) @@ -547,17 +803,20 @@ def list( return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/clusters'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/clusters"} # type: ignore + + + @distributed_trace def list_upgradable_versions( self, - resource_group_name, # type: str - cluster_name, # type: str - versions_description=None, # type: Optional["_models.UpgradableVersionsDescription"] - **kwargs # type: Any - ): - # type: (...) -> "_models.UpgradableVersionPathResult" - """Operation to get the minimum and maximum upgradable version from the current cluster version, or the required path to get to the an specific target version. + resource_group_name: str, + cluster_name: str, + versions_description: Optional["_models.UpgradableVersionsDescription"] = None, + **kwargs: Any + ) -> "_models.UpgradableVersionPathResult": + """Operation to get the minimum and maximum upgradable version from the current cluster version, + or the required path to get to the an specific target version. If a target is not provided, it will get the minimum and maximum versions available from the current cluster version. If a target is given, it will provide the required path to get from @@ -567,7 +826,8 @@ def list_upgradable_versions( :type resource_group_name: str :param cluster_name: The name of the cluster resource. :type cluster_name: str - :param versions_description: The upgrade path description with target version. + :param versions_description: The upgrade path description with target version. Default value is + None. :type versions_description: ~azure.mgmt.servicefabric.models.UpgradableVersionsDescription :keyword callable cls: A custom type or function that will be passed the direct response :return: UpgradableVersionPathResult, or the result of cls(response) @@ -579,41 +839,37 @@ def list_upgradable_versions( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.list_upgradable_versions.metadata['url'] # type: ignore - 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'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2021-06-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] - body_content_kwargs = {} # type: Dict[str, Any] if versions_description is not None: - body_content = self._serialize.body(versions_description, 'UpgradableVersionsDescription') + _json = self._serialize.body(versions_description, 'UpgradableVersionsDescription') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + _json = None + + request = build_list_upgradable_versions_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.list_upgradable_versions.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('UpgradableVersionPathResult', pipeline_response) @@ -622,4 +878,6 @@ def list_upgradable_versions( return cls(pipeline_response, deserialized, {}) return deserialized - list_upgradable_versions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/listUpgradableVersions'} # type: ignore + + list_upgradable_versions.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/listUpgradableVersions"} # type: ignore + diff --git a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/operations/_operations.py b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/operations/_operations.py index da3cbbe1c6fc..083986c0a953 100644 --- a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/operations/_operations.py +++ b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/operations/_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,23 +6,50 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-06-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/providers/Microsoft.ServiceFabric/operations") + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) class Operations(object): """Operations operations. @@ -45,11 +73,11 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.OperationListResult"] + **kwargs: Any + ) -> Iterable["_models.OperationListResult"]: """Lists all of the available Service Fabric resource provider API operations. Get the list of available Service Fabric resource provider API operations. @@ -59,35 +87,36 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicefabric.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-06-01") # type: str + cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + api_version=api_version, + template_url=next_link, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('OperationListResult', pipeline_response) + deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -96,17 +125,22 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/providers/Microsoft.ServiceFabric/operations'} # type: ignore + list.metadata = {'url': "/providers/Microsoft.ServiceFabric/operations"} # type: ignore diff --git a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/operations/_services_operations.py b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/operations/_services_operations.py index 53cdaaa58b86..d78e6e3879df 100644 --- a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/operations/_services_operations.py +++ b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/operations/_services_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,24 +6,240 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +JSONType = Any +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + application_name: str, + service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-06-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}/services/{serviceName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "applicationName": _SERIALIZER.url("application_name", application_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + application_name: str, + service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-06-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}/services/{serviceName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "applicationName": _SERIALIZER.url("application_name", application_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + application_name: str, + service_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-06-01") # type: str + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}/services/{serviceName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "applicationName": _SERIALIZER.url("application_name", application_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + if content_type is not None: + _header_parameters['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=_url, + params=_query_parameters, + headers=_header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request_initial( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + application_name: str, + service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-06-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}/services/{serviceName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "applicationName": _SERIALIZER.url("application_name", application_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + application_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = kwargs.pop('api_version', "2021-06-01") # type: str + + accept = "application/json" + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}/services") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "applicationName": _SERIALIZER.url("application_name", application_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _query_parameters = kwargs.pop("params", {}) # type: Dict[str, Any] + _query_parameters['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _header_parameters = kwargs.pop("headers", {}) # type: Dict[str, Any] + _header_parameters['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_query_parameters, + headers=_header_parameters, + **kwargs + ) class ServicesOperations(object): """ServicesOperations operations. @@ -46,15 +263,15 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def get( self, - resource_group_name, # type: str - cluster_name, # type: str - application_name, # type: str - service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ServiceResource" + resource_group_name: str, + cluster_name: str, + application_name: str, + service_name: str, + **kwargs: Any + ) -> "_models.ServiceResource": """Gets a Service Fabric service resource. Get a Service Fabric service resource created or in the process of being created in the Service @@ -79,35 +296,32 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - 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'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'applicationName': self._serialize.url("application_name", application_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2021-06-01") # type: str + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_name=application_name, + service_name=service_name, + api_version=api_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ServiceResource', pipeline_response) @@ -116,58 +330,54 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}/services/{serviceName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}/services/{serviceName}"} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - cluster_name, # type: str - application_name, # type: str - service_name, # type: str - parameters, # type: "_models.ServiceResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.ServiceResource" + resource_group_name: str, + cluster_name: str, + application_name: str, + service_name: str, + parameters: "_models.ServiceResource", + **kwargs: Any + ) -> "_models.ServiceResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - 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'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'applicationName': self._serialize.url("application_name", application_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ServiceResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-06-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ServiceResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_name=application_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = self._deserialize('ServiceResource', pipeline_response) @@ -175,18 +385,20 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}/services/{serviceName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}/services/{serviceName}"} # type: ignore + + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - cluster_name, # type: str - application_name, # type: str - service_name, # type: str - parameters, # type: "_models.ServiceResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ServiceResource"] + resource_group_name: str, + cluster_name: str, + application_name: str, + service_name: str, + parameters: "_models.ServiceResource", + **kwargs: Any + ) -> LROPoller["_models.ServiceResource"]: """Creates or updates a Service Fabric service resource. Create or update a Service Fabric service resource with the specified name. @@ -204,14 +416,19 @@ def begin_create_or_update( :type parameters: ~azure.mgmt.servicefabric.models.ServiceResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either ServiceResource or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ServiceResource or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicefabric.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-06-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] lro_delay = kwargs.pop( @@ -226,29 +443,22 @@ def begin_create_or_update( application_name=application_name, service_name=service_name, parameters=parameters, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ServiceResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - 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'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'applicationName': self._serialize.url("application_name", application_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -258,60 +468,54 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}/services/{serviceName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}/services/{serviceName}"} # type: ignore def _update_initial( self, - resource_group_name, # type: str - cluster_name, # type: str - application_name, # type: str - service_name, # type: str - parameters, # type: "_models.ServiceResourceUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.ServiceResource" + resource_group_name: str, + cluster_name: str, + application_name: str, + service_name: str, + parameters: "_models.ServiceResourceUpdate", + **kwargs: Any + ) -> "_models.ServiceResource": cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - 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'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'applicationName': self._serialize.url("application_name", application_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ServiceResourceUpdate') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + + api_version = kwargs.pop('api_version', "2021-06-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ServiceResourceUpdate') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_name=application_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = self._deserialize('ServiceResource', pipeline_response) @@ -319,18 +523,20 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}/services/{serviceName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}/services/{serviceName}"} # type: ignore + + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - cluster_name, # type: str - application_name, # type: str - service_name, # type: str - parameters, # type: "_models.ServiceResourceUpdate" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ServiceResource"] + resource_group_name: str, + cluster_name: str, + application_name: str, + service_name: str, + parameters: "_models.ServiceResourceUpdate", + **kwargs: Any + ) -> LROPoller["_models.ServiceResource"]: """Updates a Service Fabric service resource. Update a Service Fabric service resource with the specified name. @@ -348,14 +554,19 @@ def begin_update( :type parameters: ~azure.mgmt.servicefabric.models.ServiceResourceUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either ServiceResource or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ServiceResource or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicefabric.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-06-01") # type: str + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] lro_delay = kwargs.pop( @@ -370,29 +581,22 @@ def begin_update( application_name=application_name, service_name=service_name, parameters=parameters, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): + response = pipeline_response.http_response deserialized = self._deserialize('ServiceResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - 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'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'applicationName': self._serialize.url("application_name", application_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -402,69 +606,65 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}/services/{serviceName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}/services/{serviceName}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - cluster_name, # type: str - application_name, # type: str - service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + cluster_name: str, + application_name: str, + service_name: str, + **kwargs: Any + ) -> None: cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - 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'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'applicationName': self._serialize.url("application_name", application_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', "2021-06-01") # type: str + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_name=application_name, + service_name=service_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}/services/{serviceName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}/services/{serviceName}"} # type: ignore + - def begin_delete( + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - cluster_name, # type: str - application_name, # type: str - service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + cluster_name: str, + application_name: str, + service_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a Service Fabric service resource. Delete a Service Fabric service resource with the specified name. @@ -480,14 +680,17 @@ def begin_delete( :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + api_version = kwargs.pop('api_version', "2021-06-01") # type: str polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( @@ -501,26 +704,18 @@ def begin_delete( cluster_name=cluster_name, application_name=application_name, service_name=service_name, + api_version=api_version, cls=lambda x,y,z: x, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - 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'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'applicationName': self._serialize.url("application_name", application_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -530,19 +725,20 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}/services/{serviceName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}/services/{serviceName}"} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - cluster_name, # type: str - application_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ServiceResourceList" - """Gets the list of service resources created in the specified Service Fabric application resource. + resource_group_name: str, + cluster_name: str, + application_name: str, + **kwargs: Any + ) -> "_models.ServiceResourceList": + """Gets the list of service resources created in the specified Service Fabric application + resource. Gets all service resources created or in the process of being created in the Service Fabric application resource. @@ -563,34 +759,31 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.list.metadata['url'] # type: ignore - 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'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'applicationName': self._serialize.url("application_name", application_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', "2021-06-01") # type: str - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_name=application_name, + api_version=api_version, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ServiceResourceList', pipeline_response) @@ -599,4 +792,6 @@ def list( return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}/services'} # type: ignore + + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}/services"} # type: ignore + diff --git a/sdk/storage/azure-storage-file-datalake/tests/recordings/test_file.test_create_file_extra_backslashes.yaml b/sdk/storage/azure-storage-file-datalake/tests/recordings/test_file.test_create_file_extra_backslashes.yaml index 6ff8feb761fb..eac85c217470 100644 --- a/sdk/storage/azure-storage-file-datalake/tests/recordings/test_file.test_create_file_extra_backslashes.yaml +++ b/sdk/storage/azure-storage-file-datalake/tests/recordings/test_file.test_create_file_extra_backslashes.yaml @@ -11,11 +11,11 @@ interactions: Content-Length: - '0' User-Agent: - - azsdk-python-storage-dfs/12.7.0b1 Python/3.10.2 (Windows-10-10.0.19044-SP0) + - azsdk-python-storage-dfs/12.7.0 Python/3.10.2 (Windows-10-10.0.19044-SP0) x-ms-date: - - Wed, 06 Apr 2022 22:36:26 GMT + - Fri, 06 May 2022 21:52:51 GMT x-ms-version: - - '2020-10-02' + - '2021-06-08' method: PUT uri: https://storagename.blob.core.windows.net/filesystem916811e6?restype=container&timeout=5 response: @@ -25,15 +25,15 @@ interactions: content-length: - '0' date: - - Wed, 06 Apr 2022 22:36:25 GMT + - Fri, 06 May 2022 21:52:51 GMT etag: - - '"0x8DA181DE2E5EAE8"' + - '"0x8DA2FAAC44170F0"' last-modified: - - Wed, 06 Apr 2022 22:36:26 GMT + - Fri, 06 May 2022 21:52:50 GMT server: - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 x-ms-version: - - '2020-10-02' + - '2021-06-08' status: code: 201 message: Created @@ -49,11 +49,11 @@ interactions: Content-Length: - '0' User-Agent: - - azsdk-python-storage-dfs/12.7.0b1 Python/3.10.2 (Windows-10-10.0.19044-SP0) + - azsdk-python-storage-dfs/12.7.0 Python/3.10.2 (Windows-10-10.0.19044-SP0) x-ms-date: - - Wed, 06 Apr 2022 22:36:26 GMT + - Fri, 06 May 2022 21:52:51 GMT x-ms-version: - - '2020-10-02' + - '2021-06-08' method: PUT uri: https://storagename.dfs.core.windows.net/filesystem916811e6/file916811e6?resource=file response: @@ -63,17 +63,17 @@ interactions: content-length: - '0' date: - - Wed, 06 Apr 2022 22:36:26 GMT + - Fri, 06 May 2022 21:52:50 GMT etag: - - '"0x8DA181DE33191DD"' + - '"0x8DA2FAAC4A5E1DF"' last-modified: - - Wed, 06 Apr 2022 22:36:27 GMT + - Fri, 06 May 2022 21:52:51 GMT server: - Windows-Azure-HDFS/1.0 Microsoft-HTTPAPI/2.0 x-ms-request-server-encrypted: - 'true' x-ms-version: - - '2020-10-02' + - '2021-06-08' status: code: 201 message: Created @@ -89,11 +89,11 @@ interactions: Content-Length: - '0' User-Agent: - - azsdk-python-storage-dfs/12.7.0b1 Python/3.10.2 (Windows-10-10.0.19044-SP0) + - azsdk-python-storage-dfs/12.7.0 Python/3.10.2 (Windows-10-10.0.19044-SP0) x-ms-date: - - Wed, 06 Apr 2022 22:36:27 GMT + - Fri, 06 May 2022 21:52:52 GMT x-ms-version: - - '2020-10-02' + - '2021-06-08' method: PUT uri: https://storagename.dfs.core.windows.net/filesystem916811e6/file916811e6?resource=file response: @@ -103,17 +103,17 @@ interactions: content-length: - '0' date: - - Wed, 06 Apr 2022 22:36:26 GMT + - Fri, 06 May 2022 21:52:51 GMT etag: - - '"0x8DA181DE33D9E10"' + - '"0x8DA2FAAC4DB61F5"' last-modified: - - Wed, 06 Apr 2022 22:36:27 GMT + - Fri, 06 May 2022 21:52:52 GMT server: - Windows-Azure-HDFS/1.0 Microsoft-HTTPAPI/2.0 x-ms-request-server-encrypted: - 'true' x-ms-version: - - '2020-10-02' + - '2021-06-08' status: code: 201 message: Created @@ -129,11 +129,11 @@ interactions: Content-Length: - '0' User-Agent: - - azsdk-python-storage-dfs/12.7.0b1 Python/3.10.2 (Windows-10-10.0.19044-SP0) + - azsdk-python-storage-dfs/12.7.0 Python/3.10.2 (Windows-10-10.0.19044-SP0) x-ms-date: - - Wed, 06 Apr 2022 22:36:27 GMT + - Fri, 06 May 2022 21:52:52 GMT x-ms-version: - - '2020-10-02' + - '2021-06-08' method: DELETE uri: https://storagename.blob.core.windows.net/filesystem916811e6?restype=container response: @@ -143,11 +143,11 @@ interactions: content-length: - '0' date: - - Wed, 06 Apr 2022 22:36:26 GMT + - Fri, 06 May 2022 21:52:52 GMT server: - Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 x-ms-version: - - '2020-10-02' + - '2021-06-08' status: code: 202 message: Accepted diff --git a/sdk/storage/azure-storage-file-datalake/tests/recordings/test_file_async.test_create_file_extra_backslashes_async.yaml b/sdk/storage/azure-storage-file-datalake/tests/recordings/test_file_async.test_create_file_extra_backslashes_async.yaml index f8e835c07806..cdfe49283b14 100644 --- a/sdk/storage/azure-storage-file-datalake/tests/recordings/test_file_async.test_create_file_extra_backslashes_async.yaml +++ b/sdk/storage/azure-storage-file-datalake/tests/recordings/test_file_async.test_create_file_extra_backslashes_async.yaml @@ -5,11 +5,11 @@ interactions: Accept: - application/xml User-Agent: - - azsdk-python-storage-dfs/12.7.0b1 Python/3.10.2 (Windows-10-10.0.19044-SP0) + - azsdk-python-storage-dfs/12.7.0 Python/3.10.2 (Windows-10-10.0.19044-SP0) x-ms-date: - - Wed, 06 Apr 2022 22:36:34 GMT + - Fri, 06 May 2022 21:53:20 GMT x-ms-version: - - '2020-10-02' + - '2021-06-08' method: PUT uri: https://storagename.blob.core.windows.net/filesystem8a8a16e0?restype=container&timeout=5 response: @@ -17,11 +17,11 @@ interactions: string: '' headers: content-length: '0' - date: Wed, 06 Apr 2022 22:36:34 GMT - etag: '"0x8DA181DE7C7C166"' - last-modified: Wed, 06 Apr 2022 22:36:34 GMT + date: Fri, 06 May 2022 21:53:19 GMT + etag: '"0x8DA2FAAD5D0883E"' + last-modified: Fri, 06 May 2022 21:53:20 GMT server: Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - x-ms-version: '2020-10-02' + x-ms-version: '2021-06-08' status: code: 201 message: Created @@ -32,11 +32,11 @@ interactions: Accept: - application/json User-Agent: - - azsdk-python-storage-dfs/12.7.0b1 Python/3.10.2 (Windows-10-10.0.19044-SP0) + - azsdk-python-storage-dfs/12.7.0 Python/3.10.2 (Windows-10-10.0.19044-SP0) x-ms-date: - - Wed, 06 Apr 2022 22:36:35 GMT + - Fri, 06 May 2022 21:53:21 GMT x-ms-version: - - '2020-10-02' + - '2021-06-08' method: PUT uri: https://storagename.dfs.core.windows.net/filesystem8a8a16e0/file8a8a16e0?resource=file response: @@ -44,12 +44,12 @@ interactions: string: '' headers: content-length: '0' - date: Wed, 06 Apr 2022 22:36:34 GMT - etag: '"0x8DA181DE7F67F66"' - last-modified: Wed, 06 Apr 2022 22:36:35 GMT + date: Fri, 06 May 2022 21:53:20 GMT + etag: '"0x8DA2FAAD61AC7F1"' + last-modified: Fri, 06 May 2022 21:53:20 GMT server: Windows-Azure-HDFS/1.0 Microsoft-HTTPAPI/2.0 x-ms-request-server-encrypted: 'true' - x-ms-version: '2020-10-02' + x-ms-version: '2021-06-08' status: code: 201 message: Created @@ -60,11 +60,11 @@ interactions: Accept: - application/json User-Agent: - - azsdk-python-storage-dfs/12.7.0b1 Python/3.10.2 (Windows-10-10.0.19044-SP0) + - azsdk-python-storage-dfs/12.7.0 Python/3.10.2 (Windows-10-10.0.19044-SP0) x-ms-date: - - Wed, 06 Apr 2022 22:36:35 GMT + - Fri, 06 May 2022 21:53:21 GMT x-ms-version: - - '2020-10-02' + - '2021-06-08' method: PUT uri: https://storagename.dfs.core.windows.net/filesystem8a8a16e0/file8a8a16e0?resource=file response: @@ -72,12 +72,12 @@ interactions: string: '' headers: content-length: '0' - date: Wed, 06 Apr 2022 22:36:34 GMT - etag: '"0x8DA181DE80068FD"' - last-modified: Wed, 06 Apr 2022 22:36:35 GMT + date: Fri, 06 May 2022 21:53:21 GMT + etag: '"0x8DA2FAAD64D6C9E"' + last-modified: Fri, 06 May 2022 21:53:21 GMT server: Windows-Azure-HDFS/1.0 Microsoft-HTTPAPI/2.0 x-ms-request-server-encrypted: 'true' - x-ms-version: '2020-10-02' + x-ms-version: '2021-06-08' status: code: 201 message: Created @@ -88,11 +88,11 @@ interactions: Accept: - application/xml User-Agent: - - azsdk-python-storage-dfs/12.7.0b1 Python/3.10.2 (Windows-10-10.0.19044-SP0) + - azsdk-python-storage-dfs/12.7.0 Python/3.10.2 (Windows-10-10.0.19044-SP0) x-ms-date: - - Wed, 06 Apr 2022 22:36:35 GMT + - Fri, 06 May 2022 21:53:22 GMT x-ms-version: - - '2020-10-02' + - '2021-06-08' method: DELETE uri: https://storagename.blob.core.windows.net/filesystem8a8a16e0?restype=container response: @@ -100,9 +100,9 @@ interactions: string: '' headers: content-length: '0' - date: Wed, 06 Apr 2022 22:36:34 GMT + date: Fri, 06 May 2022 21:53:20 GMT server: Windows-Azure-Blob/1.0 Microsoft-HTTPAPI/2.0 - x-ms-version: '2020-10-02' + x-ms-version: '2021-06-08' status: code: 202 message: Accepted diff --git a/sdk/storage/azure-storage-file-datalake/tests/test_file.py b/sdk/storage/azure-storage-file-datalake/tests/test_file.py index 23efa9b3d88f..96df6b34ebf3 100644 --- a/sdk/storage/azure-storage-file-datalake/tests/test_file.py +++ b/sdk/storage/azure-storage-file-datalake/tests/test_file.py @@ -108,7 +108,7 @@ def test_create_file_extra_backslashes(self, datalake_storage_account_name, data file_client.file_system_name + '/', '/' + file_client.path_name, credential=datalake_storage_account_key, logging_enable=True) - response = file_client.create_file() + response = new_file_client.create_file() # Assert self.assertIsNotNone(response) diff --git a/sdk/storage/azure-storage-file-datalake/tests/test_file_async.py b/sdk/storage/azure-storage-file-datalake/tests/test_file_async.py index ac0a615c0514..fc726bc48cc3 100644 --- a/sdk/storage/azure-storage-file-datalake/tests/test_file_async.py +++ b/sdk/storage/azure-storage-file-datalake/tests/test_file_async.py @@ -115,7 +115,7 @@ async def test_create_file_extra_backslashes_async(self, datalake_storage_accoun file_client.file_system_name + '/', '/' + file_client.path_name, credential=datalake_storage_account_key, logging_enable=True) - response = await file_client.create_file() + response = await new_file_client.create_file() # Assert self.assertIsNotNone(response) diff --git a/shared_requirements.txt b/shared_requirements.txt index 53fe4975de2f..5fb01466b6e4 100644 --- a/shared_requirements.txt +++ b/shared_requirements.txt @@ -337,5 +337,9 @@ opentelemetry-sdk<2.0.0,>=1.5.0,!=1.10a0 #override azure-mgmt-scvmm azure-mgmt-core>=1.3.0,<2.0.0 #override azure-mgmt-reservations msrest>=0.6.21 #override azure-mgmt-reservations azure-mgmt-core>=1.3.0,<2.0.0 +#override azure-mgmt-chaos azure-mgmt-core>=1.3.0,<2.0.0 #override azure-mgmt-network msrest>=0.6.21 #override azure-mgmt-network azure-mgmt-core>=1.3.0,<2.0.0 +#override azure-mgmt-appcontainers msrest>=0.6.21 +#override azure-mgmt-appcontainers azure-mgmt-core>=1.3.0,<2.0.0 +#override azure-mgmt-recoveryservicesbackup azure-mgmt-core>=1.3.0,<2.0.0