From 7bf9c9e4fc57ac9985a795647d28d07866a05e6b Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Fri, 18 Feb 2022 20:47:08 +0000 Subject: [PATCH] CodeGen from PR 17883 in Azure/azure-rest-api-specs Merge 0a1907facef15509168fcda525a77217feb28dcb into 99b9fbc1db1e9a62ce1bdf0bddc4bacade05a3d8 --- .../_meta.json | 11 +- .../servicefabricmanagedclusters/__init__.py | 9 +- .../_configuration.py | 21 +- .../_metadata.json | 32 +- .../servicefabricmanagedclusters/_patch.py | 31 + ...bric_managed_clusters_management_client.py | 151 +- .../servicefabricmanagedclusters/_vendor.py | 27 + .../servicefabricmanagedclusters/_version.py | 2 +- .../aio/__init__.py | 5 + .../aio/_configuration.py | 8 +- .../aio/_patch.py | 31 + ...bric_managed_clusters_management_client.py | 140 +- .../aio/operations/__init__.py | 10 + .../_application_type_versions_operations.py | 319 +- .../_application_types_operations.py | 264 +- .../operations/_applications_operations.py | 297 +- ...managed_az_resiliency_status_operations.py | 101 + .../_managed_cluster_version_operations.py | 178 +- .../_managed_clusters_operations.py | 332 +- ...managed_unsupported_vm_sizes_operations.py | 176 + .../operations/_node_type_skus_operations.py | 130 + .../aio/operations/_node_types_operations.py | 516 ++- .../_operation_results_operations.py | 96 + .../_operation_status_operations.py | 100 + .../aio/operations/_operations.py | 49 +- .../aio/operations/_services_operations.py | 307 +- .../models/__init__.py | 266 +- .../models/_models_py3.py | 3068 +++++++++++++---- ...anaged_clusters_management_client_enums.py | 119 +- .../operations/__init__.py | 10 + .../_application_type_versions_operations.py | 623 ++-- .../_application_types_operations.py | 533 ++- .../operations/_applications_operations.py | 577 ++-- ...managed_az_resiliency_status_operations.py | 138 + .../_managed_cluster_version_operations.py | 352 +- .../_managed_clusters_operations.py | 622 ++-- ...managed_unsupported_vm_sizes_operations.py | 245 ++ .../operations/_node_type_skus_operations.py | 168 + .../operations/_node_types_operations.py | 997 ++++-- .../_operation_results_operations.py | 133 + .../_operation_status_operations.py | 137 + .../operations/_operations.py | 88 +- .../operations/_services_operations.py | 611 ++-- 43 files changed, 8271 insertions(+), 3759 deletions(-) create mode 100644 sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_patch.py create mode 100644 sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_vendor.py create mode 100644 sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/_patch.py create mode 100644 sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_managed_az_resiliency_status_operations.py create mode 100644 sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_managed_unsupported_vm_sizes_operations.py create mode 100644 sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_node_type_skus_operations.py create mode 100644 sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_operation_results_operations.py create mode 100644 sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_operation_status_operations.py create mode 100644 sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_managed_az_resiliency_status_operations.py create mode 100644 sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_managed_unsupported_vm_sizes_operations.py create mode 100644 sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_node_type_skus_operations.py create mode 100644 sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_operation_results_operations.py create mode 100644 sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_operation_status_operations.py diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/_meta.json b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/_meta.json index eb80da9a87570..3c4dd74538263 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/_meta.json +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/_meta.json @@ -1,8 +1,11 @@ { - "autorest": "3.3.0", - "use": "@autorest/python@5.6.6", - "commit": "1b38cd3ccb2224b0c838fd77c870cd72e2a5eff2", + "autorest": "3.7.2", + "use": [ + "@autorest/python@5.12.0", + "@autorest/modelerfour@4.19.3" + ], + "commit": "d292cde4295dbf43d8e9bc280581ddabd74d20e2", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest_command": "autorest specification/servicefabricmanagedclusters/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.6.6 --version=3.3.0", + "autorest_command": "autorest specification/servicefabricmanagedclusters/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --python3-only --track2 --use=@autorest/python@5.12.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2", "readme": "specification/servicefabricmanagedclusters/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/__init__.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/__init__.py index 9a29454178238..9a3fa295d7866 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/__init__.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/__init__.py @@ -12,8 +12,7 @@ __version__ = VERSION __all__ = ['ServiceFabricManagedClustersManagementClient'] -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/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_configuration.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_configuration.py index c976efafbcda5..ae805d84166d7 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_configuration.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_configuration.py @@ -6,18 +6,16 @@ # 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 @@ -35,20 +33,19 @@ class ServiceFabricManagedClustersManagementClientConfiguration(Configuration): def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(ServiceFabricManagedClustersManagementClientConfiguration, self).__init__(**kwargs) 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(ServiceFabricManagedClustersManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id - self.api_version = "2021-05-01" + self.api_version = "2022-02-01-preview" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-servicefabricmanagedclusters/{}'.format(VERSION)) self._configure(**kwargs) @@ -68,4 +65,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/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_metadata.json b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_metadata.json index ed3b24fdbc9ab..2dd09539d286b 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_metadata.json +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_metadata.json @@ -1,17 +1,17 @@ { - "chosen_version": "2021-05-01", - "total_api_version_list": ["2021-05-01"], + "chosen_version": "2022-02-01-preview", + "total_api_version_list": ["2022-02-01-preview"], "client": { "name": "ServiceFabricManagedClustersManagementClient", "filename": "_service_fabric_managed_clusters_management_client", "description": "Service Fabric Managed Clusters 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\": [\"ServiceFabricManagedClustersManagementClientConfiguration\"]}}, \"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\": [\"ServiceFabricManagedClustersManagementClientConfiguration\"]}}, \"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\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ServiceFabricManagedClustersManagementClientConfiguration\"]}}, \"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\": [\"ServiceFabricManagedClustersManagementClientConfiguration\"]}}, \"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": { "application_types": "ApplicationTypesOperations", @@ -103,8 +102,13 @@ "applications": "ApplicationsOperations", "services": "ServicesOperations", "managed_clusters": "ManagedClustersOperations", + "managed_az_resiliency_status": "ManagedAzResiliencyStatusOperations", "managed_cluster_version": "ManagedClusterVersionOperations", + "managed_unsupported_vm_sizes": "ManagedUnsupportedVMSizesOperations", + "operation_status": "OperationStatusOperations", + "operation_results": "OperationResultsOperations", "operations": "Operations", - "node_types": "NodeTypesOperations" + "node_types": "NodeTypesOperations", + "node_type_skus": "NodeTypeSkusOperations" } } \ No newline at end of file diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_patch.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_patch.py new file mode 100644 index 0000000000000..74e48ecd07cf3 --- /dev/null +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_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/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_service_fabric_managed_clusters_management_client.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_service_fabric_managed_clusters_management_client.py index 77a12593eee0a..57eda61050353 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_service_fabric_managed_clusters_management_client.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_service_fabric_managed_clusters_management_client.py @@ -6,109 +6,126 @@ # 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, Optional, TYPE_CHECKING +from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from msrest import Deserializer, Serializer +from . import models +from ._configuration import ServiceFabricManagedClustersManagementClientConfiguration +from .operations import ApplicationTypeVersionsOperations, ApplicationTypesOperations, ApplicationsOperations, ManagedAzResiliencyStatusOperations, ManagedClusterVersionOperations, ManagedClustersOperations, ManagedUnsupportedVMSizesOperations, NodeTypeSkusOperations, NodeTypesOperations, OperationResultsOperations, OperationStatusOperations, Operations, ServicesOperations + 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 ._configuration import ServiceFabricManagedClustersManagementClientConfiguration -from .operations import ApplicationTypesOperations -from .operations import ApplicationTypeVersionsOperations -from .operations import ApplicationsOperations -from .operations import ServicesOperations -from .operations import ManagedClustersOperations -from .operations import ManagedClusterVersionOperations -from .operations import Operations -from .operations import NodeTypesOperations -from . import models - -class ServiceFabricManagedClustersManagementClient(object): +class ServiceFabricManagedClustersManagementClient: """Service Fabric Managed Clusters Management Client. :ivar application_types: ApplicationTypesOperations operations - :vartype application_types: service_fabric_managed_clusters_management_client.operations.ApplicationTypesOperations + :vartype application_types: + service_fabric_managed_clusters_management_client.operations.ApplicationTypesOperations :ivar application_type_versions: ApplicationTypeVersionsOperations operations - :vartype application_type_versions: service_fabric_managed_clusters_management_client.operations.ApplicationTypeVersionsOperations + :vartype application_type_versions: + service_fabric_managed_clusters_management_client.operations.ApplicationTypeVersionsOperations :ivar applications: ApplicationsOperations operations - :vartype applications: service_fabric_managed_clusters_management_client.operations.ApplicationsOperations + :vartype applications: + service_fabric_managed_clusters_management_client.operations.ApplicationsOperations :ivar services: ServicesOperations operations - :vartype services: service_fabric_managed_clusters_management_client.operations.ServicesOperations + :vartype services: + service_fabric_managed_clusters_management_client.operations.ServicesOperations :ivar managed_clusters: ManagedClustersOperations operations - :vartype managed_clusters: service_fabric_managed_clusters_management_client.operations.ManagedClustersOperations + :vartype managed_clusters: + service_fabric_managed_clusters_management_client.operations.ManagedClustersOperations + :ivar managed_az_resiliency_status: ManagedAzResiliencyStatusOperations operations + :vartype managed_az_resiliency_status: + service_fabric_managed_clusters_management_client.operations.ManagedAzResiliencyStatusOperations :ivar managed_cluster_version: ManagedClusterVersionOperations operations - :vartype managed_cluster_version: service_fabric_managed_clusters_management_client.operations.ManagedClusterVersionOperations + :vartype managed_cluster_version: + service_fabric_managed_clusters_management_client.operations.ManagedClusterVersionOperations + :ivar managed_unsupported_vm_sizes: ManagedUnsupportedVMSizesOperations operations + :vartype managed_unsupported_vm_sizes: + service_fabric_managed_clusters_management_client.operations.ManagedUnsupportedVMSizesOperations + :ivar operation_status: OperationStatusOperations operations + :vartype operation_status: + service_fabric_managed_clusters_management_client.operations.OperationStatusOperations + :ivar operation_results: OperationResultsOperations operations + :vartype operation_results: + service_fabric_managed_clusters_management_client.operations.OperationResultsOperations :ivar operations: Operations operations :vartype operations: service_fabric_managed_clusters_management_client.operations.Operations :ivar node_types: NodeTypesOperations operations - :vartype node_types: service_fabric_managed_clusters_management_client.operations.NodeTypesOperations + :vartype node_types: + service_fabric_managed_clusters_management_client.operations.NodeTypesOperations + :ivar node_type_skus: NodeTypeSkusOperations operations + :vartype node_type_skus: + service_fabric_managed_clusters_management_client.operations.NodeTypeSkusOperations :param credential: Credential needed for the client to connect to Azure. :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 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 = ServiceFabricManagedClustersManagementClientConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = ServiceFabricManagedClustersManagementClientConfiguration(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.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.managed_clusters = ManagedClustersOperations( - self._client, self._config, self._serialize, self._deserialize) - self.managed_cluster_version = ManagedClusterVersionOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.node_types = NodeTypesOperations( - self._client, self._config, self._serialize, self._deserialize) - - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + self._serialize.client_side_validation = False + 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.managed_clusters = ManagedClustersOperations(self._client, self._config, self._serialize, self._deserialize) + self.managed_az_resiliency_status = ManagedAzResiliencyStatusOperations(self._client, self._config, self._serialize, self._deserialize) + self.managed_cluster_version = ManagedClusterVersionOperations(self._client, self._config, self._serialize, self._deserialize) + self.managed_unsupported_vm_sizes = ManagedUnsupportedVMSizesOperations(self._client, self._config, self._serialize, self._deserialize) + self.operation_status = OperationStatusOperations(self._client, self._config, self._serialize, self._deserialize) + self.operation_results = OperationResultsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.node_types = NodeTypesOperations(self._client, self._config, self._serialize, self._deserialize) + self.node_type_skus = NodeTypeSkusOperations(self._client, self._config, self._serialize, self._deserialize) + + + def _send_request( + self, + request, # type: 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/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_vendor.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_vendor.py new file mode 100644 index 0000000000000..138f663c53a4e --- /dev/null +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_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/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_version.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_version.py index c47f66669f1bf..eae7c95b6fbdb 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_version.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "1.0.0" +VERSION = "0.1.0" diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/__init__.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/__init__.py index ee979dc7fea85..5332d0c615c11 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/__init__.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/__init__.py @@ -8,3 +8,8 @@ from ._service_fabric_managed_clusters_management_client import ServiceFabricManagedClustersManagementClient __all__ = ['ServiceFabricManagedClustersManagementClient'] + +# `._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/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/_configuration.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/_configuration.py index be8b70e0afee9..a26e4ef4eda49 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/_configuration.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/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 @@ -37,15 +37,15 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(ServiceFabricManagedClustersManagementClientConfiguration, self).__init__(**kwargs) 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(ServiceFabricManagedClustersManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id - self.api_version = "2021-05-01" + self.api_version = "2022-02-01-preview" self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-servicefabricmanagedclusters/{}'.format(VERSION)) self._configure(**kwargs) @@ -64,4 +64,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/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/_patch.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/_patch.py new file mode 100644 index 0000000000000..74e48ecd07cf3 --- /dev/null +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/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/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/_service_fabric_managed_clusters_management_client.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/_service_fabric_managed_clusters_management_client.py index 51f62426d059d..556835028cd4d 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/_service_fabric_managed_clusters_management_client.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/_service_fabric_managed_clusters_management_client.py @@ -6,105 +6,127 @@ # 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, Optional, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer +from .. import models +from ._configuration import ServiceFabricManagedClustersManagementClientConfiguration +from .operations import ApplicationTypeVersionsOperations, ApplicationTypesOperations, ApplicationsOperations, ManagedAzResiliencyStatusOperations, ManagedClusterVersionOperations, ManagedClustersOperations, ManagedUnsupportedVMSizesOperations, NodeTypeSkusOperations, NodeTypesOperations, OperationResultsOperations, OperationStatusOperations, Operations, ServicesOperations + if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -from ._configuration import ServiceFabricManagedClustersManagementClientConfiguration -from .operations import ApplicationTypesOperations -from .operations import ApplicationTypeVersionsOperations -from .operations import ApplicationsOperations -from .operations import ServicesOperations -from .operations import ManagedClustersOperations -from .operations import ManagedClusterVersionOperations -from .operations import Operations -from .operations import NodeTypesOperations -from .. import models - - -class ServiceFabricManagedClustersManagementClient(object): +class ServiceFabricManagedClustersManagementClient: """Service Fabric Managed Clusters Management Client. :ivar application_types: ApplicationTypesOperations operations - :vartype application_types: service_fabric_managed_clusters_management_client.aio.operations.ApplicationTypesOperations + :vartype application_types: + service_fabric_managed_clusters_management_client.aio.operations.ApplicationTypesOperations :ivar application_type_versions: ApplicationTypeVersionsOperations operations - :vartype application_type_versions: service_fabric_managed_clusters_management_client.aio.operations.ApplicationTypeVersionsOperations + :vartype application_type_versions: + service_fabric_managed_clusters_management_client.aio.operations.ApplicationTypeVersionsOperations :ivar applications: ApplicationsOperations operations - :vartype applications: service_fabric_managed_clusters_management_client.aio.operations.ApplicationsOperations + :vartype applications: + service_fabric_managed_clusters_management_client.aio.operations.ApplicationsOperations :ivar services: ServicesOperations operations - :vartype services: service_fabric_managed_clusters_management_client.aio.operations.ServicesOperations + :vartype services: + service_fabric_managed_clusters_management_client.aio.operations.ServicesOperations :ivar managed_clusters: ManagedClustersOperations operations - :vartype managed_clusters: service_fabric_managed_clusters_management_client.aio.operations.ManagedClustersOperations + :vartype managed_clusters: + service_fabric_managed_clusters_management_client.aio.operations.ManagedClustersOperations + :ivar managed_az_resiliency_status: ManagedAzResiliencyStatusOperations operations + :vartype managed_az_resiliency_status: + service_fabric_managed_clusters_management_client.aio.operations.ManagedAzResiliencyStatusOperations :ivar managed_cluster_version: ManagedClusterVersionOperations operations - :vartype managed_cluster_version: service_fabric_managed_clusters_management_client.aio.operations.ManagedClusterVersionOperations + :vartype managed_cluster_version: + service_fabric_managed_clusters_management_client.aio.operations.ManagedClusterVersionOperations + :ivar managed_unsupported_vm_sizes: ManagedUnsupportedVMSizesOperations operations + :vartype managed_unsupported_vm_sizes: + service_fabric_managed_clusters_management_client.aio.operations.ManagedUnsupportedVMSizesOperations + :ivar operation_status: OperationStatusOperations operations + :vartype operation_status: + service_fabric_managed_clusters_management_client.aio.operations.OperationStatusOperations + :ivar operation_results: OperationResultsOperations operations + :vartype operation_results: + service_fabric_managed_clusters_management_client.aio.operations.OperationResultsOperations :ivar operations: Operations operations - :vartype operations: service_fabric_managed_clusters_management_client.aio.operations.Operations + :vartype operations: + service_fabric_managed_clusters_management_client.aio.operations.Operations :ivar node_types: NodeTypesOperations operations - :vartype node_types: service_fabric_managed_clusters_management_client.aio.operations.NodeTypesOperations + :vartype node_types: + service_fabric_managed_clusters_management_client.aio.operations.NodeTypesOperations + :ivar node_type_skus: NodeTypeSkusOperations operations + :vartype node_type_skus: + service_fabric_managed_clusters_management_client.aio.operations.NodeTypeSkusOperations :param credential: Credential needed for the client to connect to Azure. :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 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 = ServiceFabricManagedClustersManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = ServiceFabricManagedClustersManagementClientConfiguration(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.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.managed_clusters = ManagedClustersOperations(self._client, self._config, self._serialize, self._deserialize) + self.managed_az_resiliency_status = ManagedAzResiliencyStatusOperations(self._client, self._config, self._serialize, self._deserialize) + self.managed_cluster_version = ManagedClusterVersionOperations(self._client, self._config, self._serialize, self._deserialize) + self.managed_unsupported_vm_sizes = ManagedUnsupportedVMSizesOperations(self._client, self._config, self._serialize, self._deserialize) + self.operation_status = OperationStatusOperations(self._client, self._config, self._serialize, self._deserialize) + self.operation_results = OperationResultsOperations(self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.node_types = NodeTypesOperations(self._client, self._config, self._serialize, self._deserialize) + self.node_type_skus = NodeTypeSkusOperations(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.managed_clusters = ManagedClustersOperations( - self._client, self._config, self._serialize, self._deserialize) - self.managed_cluster_version = ManagedClusterVersionOperations( - self._client, self._config, self._serialize, self._deserialize) - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) - self.node_types = NodeTypesOperations( - 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/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/__init__.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/__init__.py index c4e1c9fcc149f..03d5bfe84af0d 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/__init__.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/__init__.py @@ -11,9 +11,14 @@ from ._applications_operations import ApplicationsOperations from ._services_operations import ServicesOperations from ._managed_clusters_operations import ManagedClustersOperations +from ._managed_az_resiliency_status_operations import ManagedAzResiliencyStatusOperations from ._managed_cluster_version_operations import ManagedClusterVersionOperations +from ._managed_unsupported_vm_sizes_operations import ManagedUnsupportedVMSizesOperations +from ._operation_status_operations import OperationStatusOperations +from ._operation_results_operations import OperationResultsOperations from ._operations import Operations from ._node_types_operations import NodeTypesOperations +from ._node_type_skus_operations import NodeTypeSkusOperations __all__ = [ 'ApplicationTypesOperations', @@ -21,7 +26,12 @@ 'ApplicationsOperations', 'ServicesOperations', 'ManagedClustersOperations', + 'ManagedAzResiliencyStatusOperations', 'ManagedClusterVersionOperations', + 'ManagedUnsupportedVMSizesOperations', + 'OperationStatusOperations', + 'OperationResultsOperations', 'Operations', 'NodeTypesOperations', + 'NodeTypeSkusOperations', ] diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_application_type_versions_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_application_type_versions_operations.py index 3d015523d791c..a03328de3609e 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_application_type_versions_operations.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_application_type_versions_operations.py @@ -5,19 +5,24 @@ # 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, Union import warnings 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._application_type_versions_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_application_types_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,13 +48,14 @@ 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, cluster_name: str, application_type_name: str, version: str, - **kwargs + **kwargs: Any ) -> "_models.ApplicationTypeVersionResource": """Gets a Service Fabric managed application type version resource. @@ -66,7 +72,8 @@ async def get( :type version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ApplicationTypeVersionResource, or the result of cls(response) - :rtype: ~service_fabric_managed_clusters_management_client.models.ApplicationTypeVersionResource + :rtype: + ~service_fabric_managed_clusters_management_client.models.ApplicationTypeVersionResource :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationTypeVersionResource"] @@ -74,35 +81,25 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-05-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') + + 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, + 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) 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) @@ -111,8 +108,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applicationTypes/{applicationTypeName}/versions/{version}'} # type: ignore + async def _create_or_update_initial( self, resource_group_name: str, @@ -120,48 +119,37 @@ async def _create_or_update_initial( application_type_name: str, version: str, parameters: "_models.ApplicationTypeVersionResource", - **kwargs + **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-05-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _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, + 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) - 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) 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('ApplicationTypeVersionResource', pipeline_response) @@ -173,8 +161,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/managedclusters/{clusterName}/applicationTypes/{applicationTypeName}/versions/{version}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -182,7 +173,7 @@ async def begin_create_or_update( application_type_name: str, version: str, parameters: "_models.ApplicationTypeVersionResource", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.ApplicationTypeVersionResource"]: """Creates or updates a Service Fabric managed application type version resource. @@ -198,18 +189,24 @@ async def begin_create_or_update( :param version: The application type version. :type version: str :param parameters: The application type version resource. - :type parameters: ~service_fabric_managed_clusters_management_client.models.ApplicationTypeVersionResource + :type parameters: + ~service_fabric_managed_clusters_management_client.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: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or 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[~service_fabric_managed_clusters_management_client.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[~service_fabric_managed_clusters_management_client.models.ApplicationTypeVersionResource] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationTypeVersionResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -223,29 +220,21 @@ async def begin_create_or_update( application_type_name=application_type_name, version=version, parameters=parameters, + 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, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -257,8 +246,10 @@ def get_long_running_output(pipeline_response): ) 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/managedclusters/{clusterName}/applicationTypes/{applicationTypeName}/versions/{version}'} # type: ignore + @distributed_trace_async async def update( self, resource_group_name: str, @@ -266,7 +257,7 @@ async def update( application_type_name: str, version: str, parameters: "_models.ApplicationTypeVersionUpdateParameters", - **kwargs + **kwargs: Any ) -> "_models.ApplicationTypeVersionResource": """Updates the tags of an application type version resource of a given managed cluster. @@ -281,10 +272,12 @@ async def update( :param version: The application type version. :type version: str :param parameters: The application type version resource updated tags. - :type parameters: ~service_fabric_managed_clusters_management_client.models.ApplicationTypeVersionUpdateParameters + :type parameters: + ~service_fabric_managed_clusters_management_client.models.ApplicationTypeVersionUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: ApplicationTypeVersionResource, or the result of cls(response) - :rtype: ~service_fabric_managed_clusters_management_client.models.ApplicationTypeVersionResource + :rtype: + ~service_fabric_managed_clusters_management_client.models.ApplicationTypeVersionResource :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationTypeVersionResource"] @@ -292,40 +285,30 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-05-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.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'), - '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ApplicationTypeVersionUpdateParameters') - # 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') + request = build_update_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, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ApplicationTypeVersionUpdateParameters') - 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) 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) @@ -334,64 +317,57 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applicationTypes/{applicationTypeName}/versions/{version}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, cluster_name: str, application_type_name: str, version: str, - **kwargs + **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-05-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') + + 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, + 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) 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) - 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/managedclusters/{clusterName}/applicationTypes/{applicationTypeName}/versions/{version}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, cluster_name: str, application_type_name: str, version: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes a Service Fabric managed application type version resource. @@ -407,15 +383,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: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or 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 """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -431,23 +409,14 @@ async def begin_delete( 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, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -459,16 +428,19 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applicationTypes/{applicationTypeName}/versions/{version}'} # type: ignore + @distributed_trace def list_by_application_types( self, resource_group_name: str, cluster_name: str, application_type_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.ApplicationTypeVersionResourceList"]: - """Gets the list of application type version resources created in the specified Service Fabric managed application type name resource. + """Gets the list of application type version resources created in the specified Service Fabric + managed application type name resource. Gets all application type version resources created or in the process of being created in the Service Fabric managed application type name resource. @@ -480,8 +452,10 @@ def list_by_application_types( :param application_type_name: The name of the application type name resource. :type application_type_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ApplicationTypeVersionResourceList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~service_fabric_managed_clusters_management_client.models.ApplicationTypeVersionResourceList] + :return: An iterator like instance of either ApplicationTypeVersionResourceList or the result + of cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~service_fabric_managed_clusters_management_client.models.ApplicationTypeVersionResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationTypeVersionResourceList"] @@ -489,37 +463,35 @@ def list_by_application_types( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-05-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_by_application_types.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') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_application_types_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_type_name=application_type_name, + template_url=self.list_by_application_types.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_by_application_types_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_type_name=application_type_name, + 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('ApplicationTypeVersionResourceList', pipeline_response) + deserialized = self._deserialize("ApplicationTypeVersionResourceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -532,12 +504,13 @@ async def get_next(next_link=None): 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 ) diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_application_types_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_application_types_operations.py index acabc81ba1603..7837a433f908f 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_application_types_operations.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_application_types_operations.py @@ -5,19 +5,24 @@ # 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, Union import warnings 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._application_types_operations import build_create_or_update_request, build_delete_request_initial, build_get_request, build_list_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,12 +48,13 @@ 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, cluster_name: str, application_type_name: str, - **kwargs + **kwargs: Any ) -> "_models.ApplicationTypeResource": """Gets a Service Fabric managed application type name resource. @@ -71,34 +77,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-05-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') - - # 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, + 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) 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) @@ -107,15 +103,18 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applicationTypes/{applicationTypeName}'} # type: ignore + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, cluster_name: str, application_type_name: str, parameters: "_models.ApplicationTypeResource", - **kwargs + **kwargs: Any ) -> "_models.ApplicationTypeResource": """Creates or updates a Service Fabric managed application type name resource. @@ -129,7 +128,8 @@ async def create_or_update( :param application_type_name: The name of the application type name resource. :type application_type_name: str :param parameters: The application type name resource. - :type parameters: ~service_fabric_managed_clusters_management_client.models.ApplicationTypeResource + :type parameters: + ~service_fabric_managed_clusters_management_client.models.ApplicationTypeResource :keyword callable cls: A custom type or function that will be passed the direct response :return: ApplicationTypeResource, or the result of cls(response) :rtype: ~service_fabric_managed_clusters_management_client.models.ApplicationTypeResource @@ -140,39 +140,29 @@ async def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-05-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _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, + 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) - 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) 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) @@ -181,15 +171,18 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applicationTypes/{applicationTypeName}'} # type: ignore + + @distributed_trace_async async def update( self, resource_group_name: str, cluster_name: str, application_type_name: str, parameters: "_models.ApplicationTypeUpdateParameters", - **kwargs + **kwargs: Any ) -> "_models.ApplicationTypeResource": """Updates the tags of an application type resource of a given managed cluster. @@ -202,7 +195,8 @@ async def update( :param application_type_name: The name of the application type name resource. :type application_type_name: str :param parameters: The application type resource updated tags. - :type parameters: ~service_fabric_managed_clusters_management_client.models.ApplicationTypeUpdateParameters + :type parameters: + ~service_fabric_managed_clusters_management_client.models.ApplicationTypeUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: ApplicationTypeResource, or the result of cls(response) :rtype: ~service_fabric_managed_clusters_management_client.models.ApplicationTypeResource @@ -213,39 +207,29 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-05-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'ApplicationTypeUpdateParameters') + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_type_name=application_type_name, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ApplicationTypeUpdateParameters') - 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) 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) @@ -254,61 +238,54 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applicationTypes/{applicationTypeName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, cluster_name: str, application_type_name: str, - **kwargs + **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-05-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') - - # 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, + 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) 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) - 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/managedclusters/{clusterName}/applicationTypes/{applicationTypeName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, cluster_name: str, application_type_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes a Service Fabric managed application type name resource. @@ -322,15 +299,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: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or 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 """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -345,22 +324,14 @@ async def begin_delete( 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, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -372,15 +343,18 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applicationTypes/{applicationTypeName}'} # type: ignore + @distributed_trace def list( self, resource_group_name: str, cluster_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.ApplicationTypeResourceList"]: - """Gets the list of application type name resources created in the specified Service Fabric managed cluster resource. + """Gets the list of application type name resources created in the specified Service Fabric + managed cluster resource. Gets all application type name resources created or in the process of being created in the Service Fabric managed cluster resource. @@ -390,8 +364,10 @@ def list( :param cluster_name: The name of the cluster resource. :type cluster_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ApplicationTypeResourceList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~service_fabric_managed_clusters_management_client.models.ApplicationTypeResourceList] + :return: An iterator like instance of either ApplicationTypeResourceList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~service_fabric_managed_clusters_management_client.models.ApplicationTypeResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationTypeResourceList"] @@ -399,36 +375,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-05-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 - 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') - - 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, + cluster_name=cluster_name, + 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, + cluster_name=cluster_name, + 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('ApplicationTypeResourceList', pipeline_response) + deserialized = self._deserialize("ApplicationTypeResourceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -441,12 +414,13 @@ async def get_next(next_link=None): 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 ) diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_applications_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_applications_operations.py index 12087dffdcbf4..28c380480d13e 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_applications_operations.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_applications_operations.py @@ -5,19 +5,24 @@ # 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, Union import warnings 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._applications_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,12 +48,13 @@ 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, cluster_name: str, application_name: str, - **kwargs + **kwargs: Any ) -> "_models.ApplicationResource": """Gets a Service Fabric managed application resource. @@ -71,34 +77,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-05-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') - # 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, + 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) 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) @@ -107,55 +103,46 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applications/{applicationName}'} # type: ignore + async def _create_or_update_initial( self, resource_group_name: str, cluster_name: str, application_name: str, parameters: "_models.ApplicationResource", - **kwargs + **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-05-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _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, + 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) - 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) 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('ApplicationResource', pipeline_response) @@ -167,15 +154,18 @@ 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/managedclusters/{clusterName}/applications/{applicationName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, cluster_name: str, application_name: str, parameters: "_models.ApplicationResource", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.ApplicationResource"]: """Creates or updates a Service Fabric managed application resource. @@ -191,15 +181,20 @@ async def begin_create_or_update( :type parameters: ~service_fabric_managed_clusters_management_client.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: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or 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[~service_fabric_managed_clusters_management_client.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[~service_fabric_managed_clusters_management_client.models.ApplicationResource] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -212,28 +207,21 @@ async def begin_create_or_update( cluster_name=cluster_name, application_name=application_name, parameters=parameters, + 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, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -245,15 +233,17 @@ def get_long_running_output(pipeline_response): ) 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/managedclusters/{clusterName}/applications/{applicationName}'} # type: ignore + @distributed_trace_async async def update( self, resource_group_name: str, cluster_name: str, application_name: str, parameters: "_models.ApplicationUpdateParameters", - **kwargs + **kwargs: Any ) -> "_models.ApplicationResource": """Updates the tags of an application resource of a given managed cluster. @@ -266,7 +256,8 @@ async def update( :param application_name: The name of the application resource. :type application_name: str :param parameters: The application resource updated tags. - :type parameters: ~service_fabric_managed_clusters_management_client.models.ApplicationUpdateParameters + :type parameters: + ~service_fabric_managed_clusters_management_client.models.ApplicationUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: ApplicationResource, or the result of cls(response) :rtype: ~service_fabric_managed_clusters_management_client.models.ApplicationResource @@ -277,39 +268,29 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-05-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.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'), - '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ApplicationUpdateParameters') - # 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') + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_name=application_name, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ApplicationUpdateParameters') - 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) 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) @@ -318,61 +299,54 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applications/{applicationName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, cluster_name: str, application_name: str, - **kwargs + **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-05-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') - # 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, + 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) 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) - 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/managedclusters/{clusterName}/applications/{applicationName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, cluster_name: str, application_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes a Service Fabric managed application resource. @@ -386,15 +360,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: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or 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 """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -409,22 +385,14 @@ async def begin_delete( 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, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -436,15 +404,18 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applications/{applicationName}'} # type: ignore + @distributed_trace def list( self, resource_group_name: str, cluster_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.ApplicationResourceList"]: - """Gets the list of managed application resources created in the specified Service Fabric cluster resource. + """Gets the list of managed application resources created in the specified Service Fabric cluster + resource. Gets all managed application resources created or in the process of being created in the Service Fabric cluster resource. @@ -454,8 +425,10 @@ def list( :param cluster_name: The name of the cluster resource. :type cluster_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ApplicationResourceList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~service_fabric_managed_clusters_management_client.models.ApplicationResourceList] + :return: An iterator like instance of either ApplicationResourceList or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~service_fabric_managed_clusters_management_client.models.ApplicationResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationResourceList"] @@ -463,36 +436,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-05-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 - 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') - - 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, + cluster_name=cluster_name, + 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, + cluster_name=cluster_name, + 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('ApplicationResourceList', pipeline_response) + deserialized = self._deserialize("ApplicationResourceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -505,12 +475,13 @@ async def get_next(next_link=None): 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 ) diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_managed_az_resiliency_status_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_managed_az_resiliency_status_operations.py new file mode 100644 index 0000000000000..b5f6206061672 --- /dev/null +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_managed_az_resiliency_status_operations.py @@ -0,0 +1,101 @@ +# 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 functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar +import warnings + +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_az_resiliency_status_operations import build_get_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ManagedAzResiliencyStatusOperations: + """ManagedAzResiliencyStatusOperations 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: ~service_fabric_managed_clusters_management_client.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( + self, + resource_group_name: str, + cluster_name: str, + **kwargs: Any + ) -> "_models.ManagedAzResiliencyStatus": + """Get Az Resiliency Status of all the Base resources constituting Service Fabric Managed + Clusters. + + Get Az Resiliency Status of all the Base resources constituting Service Fabric Managed + Clusters. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. + :type cluster_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedAzResiliencyStatus, or the result of cls(response) + :rtype: ~service_fabric_managed_clusters_management_client.models.ManagedAzResiliencyStatus + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedAzResiliencyStatus"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + 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) + 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, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ManagedAzResiliencyStatus', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/azresiliencystatus'} # type: ignore + diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_managed_cluster_version_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_managed_cluster_version_operations.py index 8653bea7345be..fe26295520b76 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_managed_cluster_version_operations.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_managed_cluster_version_operations.py @@ -5,16 +5,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, List, Optional, TypeVar +import functools +from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar, Union import warnings 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._managed_cluster_version_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 +44,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 + **kwargs: Any ) -> "_models.ManagedClusterCodeVersionResult": - """Gets information about a Service Fabric managed cluster code version available in the specified location. + """Gets information about a Service Fabric managed cluster code version available in the specified + location. Gets information about an available Service Fabric managed cluster code version. @@ -57,7 +63,8 @@ async def get( :type cluster_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ManagedClusterCodeVersionResult, or the result of cls(response) - :rtype: ~service_fabric_managed_clusters_management_client.models.ManagedClusterCodeVersionResult + :rtype: + ~service_fabric_managed_clusters_management_client.models.ManagedClusterCodeVersionResult :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterCodeVersionResult"] @@ -65,33 +72,23 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-05-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 = build_get_request( + location=location, + subscription_id=self._config.subscription_id, + cluster_version=cluster_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) 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('ManagedClusterCodeVersionResult', pipeline_response) @@ -100,26 +97,35 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/managedClusterVersions/{clusterVersion}'} # type: ignore + + @distributed_trace_async async def get_by_environment( self, location: str, + environment: Union[str, "_models.ManagedClusterVersionEnvironment"], cluster_version: str, - **kwargs + **kwargs: Any ) -> "_models.ManagedClusterCodeVersionResult": - """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. :param location: The location for the cluster code versions. This is different from cluster location. :type location: str + :param environment: The operating system of the cluster. The default means all. + :type environment: str or + ~service_fabric_managed_clusters_management_client.models.ManagedClusterVersionEnvironment :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 :return: ManagedClusterCodeVersionResult, or the result of cls(response) - :rtype: ~service_fabric_managed_clusters_management_client.models.ManagedClusterCodeVersionResult + :rtype: + ~service_fabric_managed_clusters_management_client.models.ManagedClusterCodeVersionResult :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterCodeVersionResult"] @@ -127,35 +133,24 @@ async def get_by_environment( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - environment = "Windows" - api_version = "2021-05-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 = build_get_by_environment_request( + location=location, + environment=environment, + subscription_id=self._config.subscription_id, + cluster_version=cluster_version, + template_url=self.get_by_environment.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) 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('ManagedClusterCodeVersionResult', pipeline_response) @@ -164,12 +159,15 @@ 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}/managedClusterVersions/{clusterVersion}'} # type: ignore + + @distributed_trace_async async def list( self, location: str, - **kwargs + **kwargs: Any ) -> List["_models.ManagedClusterCodeVersionResult"]: """Gets the list of Service Fabric cluster code versions available for the specified location. @@ -180,7 +178,8 @@ async def list( :type location: str :keyword callable cls: A custom type or function that will be passed the direct response :return: list of ManagedClusterCodeVersionResult, or the result of cls(response) - :rtype: list[~service_fabric_managed_clusters_management_client.models.ManagedClusterCodeVersionResult] + :rtype: + list[~service_fabric_managed_clusters_management_client.models.ManagedClusterCodeVersionResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[List["_models.ManagedClusterCodeVersionResult"]] @@ -188,32 +187,22 @@ async def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-05-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 = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + 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) 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('[ManagedClusterCodeVersionResult]', pipeline_response) @@ -222,12 +211,16 @@ async def list( return cls(pipeline_response, deserialized, {}) return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/managedClusterVersions'} # type: ignore + + @distributed_trace_async async def list_by_environment( self, location: str, - **kwargs + environment: Union[str, "_models.ManagedClusterVersionEnvironment"], + **kwargs: Any ) -> List["_models.ManagedClusterCodeVersionResult"]: """Gets the list of Service Fabric cluster code versions available for the specified environment. @@ -236,9 +229,13 @@ async def list_by_environment( :param location: The location for the cluster code versions. This is different from cluster location. :type location: str + :param environment: The operating system of the cluster. The default means all. + :type environment: str or + ~service_fabric_managed_clusters_management_client.models.ManagedClusterVersionEnvironment :keyword callable cls: A custom type or function that will be passed the direct response :return: list of ManagedClusterCodeVersionResult, or the result of cls(response) - :rtype: list[~service_fabric_managed_clusters_management_client.models.ManagedClusterCodeVersionResult] + :rtype: + list[~service_fabric_managed_clusters_management_client.models.ManagedClusterCodeVersionResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[List["_models.ManagedClusterCodeVersionResult"]] @@ -246,34 +243,23 @@ async def list_by_environment( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - environment = "Windows" - api_version = "2021-05-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 = build_list_by_environment_request( + location=location, + environment=environment, + subscription_id=self._config.subscription_id, + template_url=self.list_by_environment.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) 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('[ManagedClusterCodeVersionResult]', pipeline_response) @@ -282,4 +268,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}/managedClusterVersions'} # type: ignore + diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_managed_clusters_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_managed_clusters_operations.py index 38a4dd61cb126..8eeaf736d249f 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_managed_clusters_operations.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_managed_clusters_operations.py @@ -5,19 +5,24 @@ # 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, Union import warnings 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._managed_clusters_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 T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,10 +48,11 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_resource_group( self, resource_group_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.ManagedClusterListResult"]: """Gets the list of Service Fabric cluster resources created in the specified resource group. @@ -56,8 +62,10 @@ def list_by_resource_group( :param resource_group_name: The name of the resource group. :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 ManagedClusterListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~service_fabric_managed_clusters_management_client.models.ManagedClusterListResult] + :return: An iterator like instance of either ManagedClusterListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~service_fabric_managed_clusters_management_client.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] @@ -65,35 +73,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-05-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_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') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.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_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + 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('ManagedClusterListResult', pipeline_response) + deserialized = self._deserialize("ManagedClusterListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -106,20 +110,22 @@ async def get_next(next_link=None): 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_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters'} # type: ignore + @distributed_trace def list_by_subscription( self, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.ManagedClusterListResult"]: """Gets the list of Service Fabric cluster resources created in the specified subscription. @@ -127,8 +133,10 @@ def list_by_subscription( subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~service_fabric_managed_clusters_management_client.models.ManagedClusterListResult] + :return: An iterator like instance of either ManagedClusterListResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~service_fabric_managed_clusters_management_client.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] @@ -136,34 +144,29 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-05-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_by_subscription.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') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=self.list_by_subscription.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_by_subscription_request( + subscription_id=self._config.subscription_id, + 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('ManagedClusterListResult', pipeline_response) + deserialized = self._deserialize("ManagedClusterListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -176,22 +179,24 @@ async def get_next(next_link=None): 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_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/managedClusters'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, cluster_name: str, - **kwargs + **kwargs: Any ) -> "_models.ManagedCluster": """Gets a Service Fabric managed cluster resource. @@ -212,33 +217,23 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-05-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') - - # 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, + 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) 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('ManagedCluster', pipeline_response) @@ -247,53 +242,44 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}'} # type: ignore + async def _create_or_update_initial( self, resource_group_name: str, cluster_name: str, parameters: "_models.ManagedCluster", - **kwargs + **kwargs: Any ) -> "_models.ManagedCluster": cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-05-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'ManagedCluster') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + 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) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ManagedCluster') - 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) 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('ManagedCluster', pipeline_response) @@ -305,14 +291,17 @@ 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/managedClusters/{clusterName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, cluster_name: str, parameters: "_models.ManagedCluster", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.ManagedCluster"]: """Creates or updates a Service Fabric managed cluster resource. @@ -326,15 +315,20 @@ async def begin_create_or_update( :type parameters: ~service_fabric_managed_clusters_management_client.models.ManagedCluster :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: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or 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 ManagedCluster or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~service_fabric_managed_clusters_management_client.models.ManagedCluster] - :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 ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~service_fabric_managed_clusters_management_client.models.ManagedCluster] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', @@ -346,27 +340,21 @@ async def begin_create_or_update( resource_group_name=resource_group_name, cluster_name=cluster_name, parameters=parameters, + 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('ManagedCluster', 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, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -378,14 +366,16 @@ def get_long_running_output(pipeline_response): ) 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/managedClusters/{clusterName}'} # type: ignore + @distributed_trace_async async def update( self, resource_group_name: str, cluster_name: str, parameters: "_models.ManagedClusterUpdateParameters", - **kwargs + **kwargs: Any ) -> "_models.ManagedCluster": """Updates the tags of of a Service Fabric managed cluster resource. @@ -396,7 +386,8 @@ async def update( :param cluster_name: The name of the cluster resource. :type cluster_name: str :param parameters: The managed cluster resource updated tags. - :type parameters: ~service_fabric_managed_clusters_management_client.models.ManagedClusterUpdateParameters + :type parameters: + ~service_fabric_managed_clusters_management_client.models.ManagedClusterUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: ManagedCluster, or the result of cls(response) :rtype: ~service_fabric_managed_clusters_management_client.models.ManagedCluster @@ -407,38 +398,28 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-05-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'ManagedClusterUpdateParameters') + + request = build_update_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ManagedClusterUpdateParameters') - 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) 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('ManagedCluster', pipeline_response) @@ -447,58 +428,51 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, cluster_name: str, - **kwargs + **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-05-01" - accept = "application/json" - - # Construct URL - url = self._delete_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['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + 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) 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) - 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/managedClusters/{clusterName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, cluster_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes a Service Fabric managed cluster resource. @@ -510,15 +484,17 @@ async def begin_delete( :type cluster_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: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or 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 """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -532,21 +508,14 @@ async def begin_delete( 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 = { - '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, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -558,4 +527,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}'} # type: ignore diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_managed_unsupported_vm_sizes_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_managed_unsupported_vm_sizes_operations.py new file mode 100644 index 0000000000000..a8d3f0b23f53d --- /dev/null +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_managed_unsupported_vm_sizes_operations.py @@ -0,0 +1,176 @@ +# 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 functools +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +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._managed_unsupported_vm_sizes_operations import build_get_request, build_list_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ManagedUnsupportedVMSizesOperations: + """ManagedUnsupportedVMSizesOperations 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: ~service_fabric_managed_clusters_management_client.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, + location: str, + **kwargs: Any + ) -> AsyncIterable["_models.ManagedVMSizesResult"]: + """Get the lists of unsupported vm sizes for Service Fabric Managed Clusters. + + Get the lists of unsupported vm sizes for Service Fabric Managed Clusters. + + :param location: The location for the cluster code versions. This is different from cluster + location. + :type location: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ManagedVMSizesResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~service_fabric_managed_clusters_management_client.models.ManagedVMSizesResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedVMSizesResult"] + 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( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + 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("ManagedVMSizesResult", 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(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, 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.ServiceFabric/locations/{location}/managedUnsupportedVMSizes'} # type: ignore + + @distributed_trace_async + async def get( + self, + location: str, + vm_size: str, + **kwargs: Any + ) -> "_models.ManagedVMSize": + """Get unsupported vm size for Service Fabric Managed Clusters. + + Get unsupported vm size for Service Fabric Managed Clusters. + + :param location: The location for the cluster code versions. This is different from cluster + location. + :type location: str + :param vm_size: VM Size name. + :type vm_size: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedVMSize, or the result of cls(response) + :rtype: ~service_fabric_managed_clusters_management_client.models.ManagedVMSize + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedVMSize"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + location=location, + subscription_id=self._config.subscription_id, + vm_size=vm_size, + 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) + 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, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ManagedVMSize', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/managedUnsupportedVMSizes/{vmSize}'} # type: ignore + diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_node_type_skus_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_node_type_skus_operations.py new file mode 100644 index 0000000000000..0401a56a3b749 --- /dev/null +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_node_type_skus_operations.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. +# -------------------------------------------------------------------------- +import functools +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +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._node_type_skus_operations import build_list_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class NodeTypeSkusOperations: + """NodeTypeSkusOperations 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: ~service_fabric_managed_clusters_management_client.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, + cluster_name: str, + node_type_name: str, + **kwargs: Any + ) -> AsyncIterable["_models.NodeTypeListSkuResult"]: + """Gets a Service Fabric node type SKUs. + + Get a Service Fabric node type supported SKUs. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. + :type cluster_name: str + :param node_type_name: The name of the node type. + :type node_type_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NodeTypeListSkuResult or the result of + cls(response) + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~service_fabric_managed_clusters_management_client.models.NodeTypeListSkuResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NodeTypeListSkuResult"] + 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, + cluster_name=cluster_name, + node_type_name=node_type_name, + 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, + cluster_name=cluster_name, + node_type_name=node_type_name, + 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("NodeTypeListSkuResult", 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(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, 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.ServiceFabric/managedClusters/{clusterName}/nodeTypes/{nodeTypeName}/skus'} # type: ignore diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_node_types_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_node_types_operations.py index b314254e8c179..974aedbcf1f42 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_node_types_operations.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_node_types_operations.py @@ -5,19 +5,24 @@ # 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, Union import warnings 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._node_types_operations import build_create_or_update_request_initial, build_delete_node_request_initial, build_delete_request_initial, build_get_request, build_list_by_managed_clusters_request, build_reimage_request_initial, build_restart_request_initial, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,11 +48,12 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list_by_managed_clusters( self, resource_group_name: str, cluster_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.NodeTypeListResult"]: """Gets the list of Node types of the specified managed cluster. @@ -59,7 +65,8 @@ def list_by_managed_clusters( :type cluster_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either NodeTypeListResult or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~service_fabric_managed_clusters_management_client.models.NodeTypeListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~service_fabric_managed_clusters_management_client.models.NodeTypeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.NodeTypeListResult"] @@ -67,36 +74,33 @@ def list_by_managed_clusters( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-05-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_by_managed_clusters.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'), - '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') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_managed_clusters_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + cluster_name=cluster_name, + template_url=self.list_by_managed_clusters.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_by_managed_clusters_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + cluster_name=cluster_name, + 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('NodeTypeListResult', pipeline_response) + deserialized = self._deserialize("NodeTypeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -109,12 +113,13 @@ async def get_next(next_link=None): 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 ) @@ -126,60 +131,51 @@ async def _restart_initial( cluster_name: str, node_type_name: str, parameters: "_models.NodeTypeActionParameters", - **kwargs + **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-05-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._restart_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'), - 'nodeTypeName': self._serialize.url("node_type_name", node_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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'NodeTypeActionParameters') + + request = build_restart_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + node_type_name=node_type_name, + content_type=content_type, + json=_json, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'NodeTypeActionParameters') - 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) 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 cls: return cls(pipeline_response, None, {}) _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/nodeTypes/{nodeTypeName}/restart'} # type: ignore + + @distributed_trace_async async def begin_restart( self, resource_group_name: str, cluster_name: str, node_type_name: str, parameters: "_models.NodeTypeActionParameters", - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Restarts one or more nodes on the node type. @@ -193,18 +189,22 @@ async def begin_restart( :param node_type_name: The name of the node type. :type node_type_name: str :param parameters: parameters for restart action. - :type parameters: ~service_fabric_managed_clusters_management_client.models.NodeTypeActionParameters + :type parameters: + ~service_fabric_managed_clusters_management_client.models.NodeTypeActionParameters :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: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or 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 """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -217,25 +217,18 @@ async def begin_restart( cluster_name=cluster_name, node_type_name=node_type_name, parameters=parameters, + 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): 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'), - 'nodeTypeName': self._serialize.url("node_type_name", node_type_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -247,6 +240,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_restart.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/nodeTypes/{nodeTypeName}/restart'} # type: ignore async def _reimage_initial( @@ -255,60 +249,51 @@ async def _reimage_initial( cluster_name: str, node_type_name: str, parameters: "_models.NodeTypeActionParameters", - **kwargs + **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-05-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._reimage_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'), - 'nodeTypeName': self._serialize.url("node_type_name", node_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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'NodeTypeActionParameters') - # 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') + request = build_reimage_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + node_type_name=node_type_name, + content_type=content_type, + json=_json, + template_url=self._reimage_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'NodeTypeActionParameters') - 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) 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 cls: return cls(pipeline_response, None, {}) _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/nodeTypes/{nodeTypeName}/reimage'} # type: ignore + + @distributed_trace_async async def begin_reimage( self, resource_group_name: str, cluster_name: str, node_type_name: str, parameters: "_models.NodeTypeActionParameters", - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Reimages one or more nodes on the node type. @@ -322,18 +307,22 @@ async def begin_reimage( :param node_type_name: The name of the node type. :type node_type_name: str :param parameters: parameters for reimage action. - :type parameters: ~service_fabric_managed_clusters_management_client.models.NodeTypeActionParameters + :type parameters: + ~service_fabric_managed_clusters_management_client.models.NodeTypeActionParameters :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: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or 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 """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -346,25 +335,18 @@ async def begin_reimage( cluster_name=cluster_name, node_type_name=node_type_name, parameters=parameters, + 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): 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'), - 'nodeTypeName': self._serialize.url("node_type_name", node_type_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -376,6 +358,7 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_reimage.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/nodeTypes/{nodeTypeName}/reimage'} # type: ignore async def _delete_node_initial( @@ -384,60 +367,51 @@ async def _delete_node_initial( cluster_name: str, node_type_name: str, parameters: "_models.NodeTypeActionParameters", - **kwargs + **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-05-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._delete_node_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'), - 'nodeTypeName': self._serialize.url("node_type_name", node_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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'NodeTypeActionParameters') + + request = build_delete_node_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + node_type_name=node_type_name, + content_type=content_type, + json=_json, + template_url=self._delete_node_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'NodeTypeActionParameters') - 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) 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 cls: return cls(pipeline_response, None, {}) _delete_node_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/nodeTypes/{nodeTypeName}/deleteNode'} # type: ignore + + @distributed_trace_async async def begin_delete_node( self, resource_group_name: str, cluster_name: str, node_type_name: str, parameters: "_models.NodeTypeActionParameters", - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes one or more nodes on the node type. @@ -451,18 +425,22 @@ async def begin_delete_node( :param node_type_name: The name of the node type. :type node_type_name: str :param parameters: parameters for delete action. - :type parameters: ~service_fabric_managed_clusters_management_client.models.NodeTypeActionParameters + :type parameters: + ~service_fabric_managed_clusters_management_client.models.NodeTypeActionParameters :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: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or 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 """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -475,25 +453,18 @@ async def begin_delete_node( cluster_name=cluster_name, node_type_name=node_type_name, parameters=parameters, + 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): 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'), - 'nodeTypeName': self._serialize.url("node_type_name", node_type_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -505,14 +476,16 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete_node.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/nodeTypes/{nodeTypeName}/deleteNode'} # type: ignore + @distributed_trace_async async def get( self, resource_group_name: str, cluster_name: str, node_type_name: str, - **kwargs + **kwargs: Any ) -> "_models.NodeType": """Gets a Service Fabric node type. @@ -534,34 +507,24 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-05-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'), - 'nodeTypeName': self._serialize.url("node_type_name", node_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['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, + node_type_name=node_type_name, + 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) 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('NodeType', pipeline_response) @@ -570,55 +533,46 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/nodeTypes/{nodeTypeName}'} # type: ignore + async def _create_or_update_initial( self, resource_group_name: str, cluster_name: str, node_type_name: str, parameters: "_models.NodeType", - **kwargs + **kwargs: Any ) -> "_models.NodeType": cls = kwargs.pop('cls', None) # type: ClsType["_models.NodeType"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-05-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'), - 'nodeTypeName': self._serialize.url("node_type_name", node_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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'NodeType') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + node_type_name=node_type_name, + 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) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'NodeType') - 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) 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('NodeType', pipeline_response) @@ -630,15 +584,18 @@ 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/managedClusters/{clusterName}/nodeTypes/{nodeTypeName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, cluster_name: str, node_type_name: str, parameters: "_models.NodeType", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.NodeType"]: """Creates or updates a Service Fabric node type. @@ -654,15 +611,20 @@ async def begin_create_or_update( :type parameters: ~service_fabric_managed_clusters_management_client.models.NodeType :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: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or 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 NodeType or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~service_fabric_managed_clusters_management_client.models.NodeType] - :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 NodeType or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~service_fabric_managed_clusters_management_client.models.NodeType] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.NodeType"] lro_delay = kwargs.pop( 'polling_interval', @@ -675,28 +637,21 @@ async def begin_create_or_update( cluster_name=cluster_name, node_type_name=node_type_name, parameters=parameters, + 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('NodeType', 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'), - 'nodeTypeName': self._serialize.url("node_type_name", node_type_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -708,15 +663,17 @@ def get_long_running_output(pipeline_response): ) 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/managedClusters/{clusterName}/nodeTypes/{nodeTypeName}'} # type: ignore + @distributed_trace_async async def update( self, resource_group_name: str, cluster_name: str, node_type_name: str, parameters: "_models.NodeTypeUpdateParameters", - **kwargs + **kwargs: Any ) -> "_models.NodeType": """Update the tags of a node type resource of a given managed cluster. @@ -729,7 +686,8 @@ async def update( :param node_type_name: The name of the node type. :type node_type_name: str :param parameters: The parameters to update the node type configuration. - :type parameters: ~service_fabric_managed_clusters_management_client.models.NodeTypeUpdateParameters + :type parameters: + ~service_fabric_managed_clusters_management_client.models.NodeTypeUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: NodeType, or the result of cls(response) :rtype: ~service_fabric_managed_clusters_management_client.models.NodeType @@ -740,39 +698,29 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-05-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.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'), - 'nodeTypeName': self._serialize.url("node_type_name", node_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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'NodeTypeUpdateParameters') + + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + node_type_name=node_type_name, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'NodeTypeUpdateParameters') - 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) 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('NodeType', pipeline_response) @@ -781,61 +729,54 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/nodeTypes/{nodeTypeName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, cluster_name: str, node_type_name: str, - **kwargs + **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-05-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'), - 'nodeTypeName': self._serialize.url("node_type_name", node_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['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, + node_type_name=node_type_name, + 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) 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) - 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/managedClusters/{clusterName}/nodeTypes/{nodeTypeName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, cluster_name: str, node_type_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes a Service Fabric node type. @@ -849,15 +790,17 @@ async def begin_delete( :type node_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: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or 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 """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -872,22 +815,14 @@ async def begin_delete( 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'), - 'nodeTypeName': self._serialize.url("node_type_name", node_type_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -899,4 +834,5 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/nodeTypes/{nodeTypeName}'} # type: ignore diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_operation_results_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_operation_results_operations.py new file mode 100644 index 0000000000000..3f2f0b003f50d --- /dev/null +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_operation_results_operations.py @@ -0,0 +1,96 @@ +# 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 functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar +import warnings + +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._operation_results_operations import build_get_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class OperationResultsOperations: + """OperationResultsOperations 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: ~service_fabric_managed_clusters_management_client.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( + self, + location: str, + operation_id: str, + **kwargs: Any + ) -> None: + """Get long running operation result. + + Get long running operation result. + + :param location: The location for the cluster code versions. This is different from cluster + location. + :type location: str + :param operation_id: operation identifier. + :type operation_id: 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', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + location=location, + operation_id=operation_id, + 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) + 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) + 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, {}) + + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/managedClusterOperationResults/{operationId}'} # type: ignore + diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_operation_status_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_operation_status_operations.py new file mode 100644 index 0000000000000..8b001ba704bf4 --- /dev/null +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_operation_status_operations.py @@ -0,0 +1,100 @@ +# 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 functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar +import warnings + +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._operation_status_operations import build_get_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class OperationStatusOperations: + """OperationStatusOperations 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: ~service_fabric_managed_clusters_management_client.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( + self, + location: str, + operation_id: str, + **kwargs: Any + ) -> "_models.LongRunningOperationResult": + """Get long running operation status. + + Get long running operation status. + + :param location: The location for the cluster code versions. This is different from cluster + location. + :type location: str + :param operation_id: operation identifier. + :type operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: LongRunningOperationResult, or the result of cls(response) + :rtype: ~service_fabric_managed_clusters_management_client.models.LongRunningOperationResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.LongRunningOperationResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + location=location, + operation_id=operation_id, + 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) + 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, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('LongRunningOperationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/managedClusterOperations/{operationId}'} # type: ignore + diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_operations.py index 32c4eaa62e23c..9222daa3c1220 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_operations.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_operations.py @@ -5,17 +5,22 @@ # 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 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._operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -41,9 +46,10 @@ def __init__(self, client, config, serializer, deserializer) -> None: self._deserialize = deserializer self._config = config + @distributed_trace def list( self, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.OperationListResult"]: """Lists all of the available Service Fabric resource provider API operations. @@ -51,7 +57,8 @@ 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[~service_fabric_managed_clusters_management_client.models.OperationListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~service_fabric_managed_clusters_management_client.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] @@ -59,30 +66,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-05-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( + 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( + 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) @@ -95,12 +99,13 @@ async def get_next(next_link=None): 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 ) diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_services_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_services_operations.py index 0d06f224a8ccc..6c10e8b1d5923 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_services_operations.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_services_operations.py @@ -5,19 +5,24 @@ # 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, Union import warnings 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._services_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_by_applications_request, build_update_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] @@ -43,13 +48,14 @@ 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, cluster_name: str, application_name: str, service_name: str, - **kwargs + **kwargs: Any ) -> "_models.ServiceResource": """Gets a Service Fabric managed service resource. @@ -75,35 +81,25 @@ async def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-05-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') + + 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, + 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) 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) @@ -112,8 +108,10 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applications/{applicationName}/services/{serviceName}'} # type: ignore + async def _create_or_update_initial( self, resource_group_name: str, @@ -121,48 +119,37 @@ async def _create_or_update_initial( application_name: str, service_name: str, parameters: "_models.ServiceResource", - **kwargs + **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-05-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _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, + 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) - 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) 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('ServiceResource', pipeline_response) @@ -174,8 +161,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/managedclusters/{clusterName}/applications/{applicationName}/services/{serviceName}'} # type: ignore + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, @@ -183,7 +173,7 @@ async def begin_create_or_update( application_name: str, service_name: str, parameters: "_models.ServiceResource", - **kwargs + **kwargs: Any ) -> AsyncLROPoller["_models.ServiceResource"]: """Creates or updates a Service Fabric managed service resource. @@ -202,15 +192,20 @@ async def begin_create_or_update( :type parameters: ~service_fabric_managed_clusters_management_client.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: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or 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) - :rtype: ~azure.core.polling.AsyncLROPoller[~service_fabric_managed_clusters_management_client.models.ServiceResource] - :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 ServiceResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~service_fabric_managed_clusters_management_client.models.ServiceResource] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -224,29 +219,21 @@ async def begin_create_or_update( application_name=application_name, service_name=service_name, parameters=parameters, + 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, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -258,8 +245,10 @@ def get_long_running_output(pipeline_response): ) 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/managedclusters/{clusterName}/applications/{applicationName}/services/{serviceName}'} # type: ignore + @distributed_trace_async async def update( self, resource_group_name: str, @@ -267,7 +256,7 @@ async def update( application_name: str, service_name: str, parameters: "_models.ServiceUpdateParameters", - **kwargs + **kwargs: Any ) -> "_models.ServiceResource": """Updates the tags of a service resource of a given managed cluster. @@ -283,7 +272,8 @@ async def update( {applicationName}~{serviceName}. :type service_name: str :param parameters: The service resource updated tags. - :type parameters: ~service_fabric_managed_clusters_management_client.models.ServiceUpdateParameters + :type parameters: + ~service_fabric_managed_clusters_management_client.models.ServiceUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: ServiceResource, or the result of cls(response) :rtype: ~service_fabric_managed_clusters_management_client.models.ServiceResource @@ -294,40 +284,30 @@ async def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-05-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.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'), - '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ServiceUpdateParameters') - # 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') + request = build_update_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, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ServiceUpdateParameters') - 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) 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) @@ -336,64 +316,57 @@ async def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applications/{applicationName}/services/{serviceName}'} # type: ignore + async def _delete_initial( self, resource_group_name: str, cluster_name: str, application_name: str, service_name: str, - **kwargs + **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-05-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') + + 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, + 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) 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) - 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/managedclusters/{clusterName}/applications/{applicationName}/services/{serviceName}'} # type: ignore + + @distributed_trace_async async def begin_delete( self, resource_group_name: str, cluster_name: str, application_name: str, service_name: str, - **kwargs + **kwargs: Any ) -> AsyncLROPoller[None]: """Deletes a Service Fabric managed service resource. @@ -410,15 +383,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: Pass in True if you'd like the AsyncARMPolling polling method, - False for no polling, or 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 """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.AsyncPollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -434,23 +409,14 @@ async def begin_delete( 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, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = AsyncNoPolling() else: polling_method = polling if cont_token: @@ -462,16 +428,19 @@ def get_long_running_output(pipeline_response): ) else: return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applications/{applicationName}/services/{serviceName}'} # type: ignore + @distributed_trace def list_by_applications( self, resource_group_name: str, cluster_name: str, application_name: str, - **kwargs + **kwargs: Any ) -> AsyncIterable["_models.ServiceResourceList"]: - """Gets the list of service resources created in the specified Service Fabric managed application resource. + """Gets the list of service resources created in the specified Service Fabric managed application + resource. Gets all service resources created or in the process of being created in the Service Fabric managed application resource. @@ -484,7 +453,8 @@ def list_by_applications( :type application_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ServiceResourceList or the result of cls(response) - :rtype: ~azure.core.async_paging.AsyncItemPaged[~service_fabric_managed_clusters_management_client.models.ServiceResourceList] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~service_fabric_managed_clusters_management_client.models.ServiceResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResourceList"] @@ -492,37 +462,35 @@ def list_by_applications( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-05-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_by_applications.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') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_applications_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_name=application_name, + template_url=self.list_by_applications.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_by_applications_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_name=application_name, + 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('ServiceResourceList', pipeline_response) + deserialized = self._deserialize("ServiceResourceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -535,12 +503,13 @@ async def get_next(next_link=None): 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 ) diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/models/__init__.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/models/__init__.py index b6a0d19226238..bcb1a73b3cedd 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/models/__init__.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/models/__init__.py @@ -6,154 +6,96 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import AddRemoveIncrementalNamedPartitionScalingMechanism - from ._models_py3 import ApplicationHealthPolicy - from ._models_py3 import ApplicationResource - from ._models_py3 import ApplicationResourceList - from ._models_py3 import ApplicationTypeResource - from ._models_py3 import ApplicationTypeResourceList - from ._models_py3 import ApplicationTypeUpdateParameters - from ._models_py3 import ApplicationTypeVersionResource - from ._models_py3 import ApplicationTypeVersionResourceList - from ._models_py3 import ApplicationTypeVersionUpdateParameters - from ._models_py3 import ApplicationTypeVersionsCleanupPolicy - from ._models_py3 import ApplicationUpdateParameters - from ._models_py3 import ApplicationUpgradePolicy - from ._models_py3 import ApplicationUserAssignedIdentity - from ._models_py3 import AvailableOperationDisplay - from ._models_py3 import AveragePartitionLoadScalingTrigger - from ._models_py3 import AverageServiceLoadScalingTrigger - from ._models_py3 import AzureActiveDirectory - from ._models_py3 import ClientCertificate - from ._models_py3 import EndpointRangeDescription - from ._models_py3 import ErrorModel - from ._models_py3 import ErrorModelError - from ._models_py3 import LoadBalancingRule - from ._models_py3 import ManagedCluster - from ._models_py3 import ManagedClusterCodeVersionResult - from ._models_py3 import ManagedClusterListResult - from ._models_py3 import ManagedClusterUpdateParameters - from ._models_py3 import ManagedIdentity - from ._models_py3 import ManagedProxyResource - from ._models_py3 import NamedPartitionScheme - from ._models_py3 import NetworkSecurityRule - from ._models_py3 import NodeType - from ._models_py3 import NodeTypeActionParameters - from ._models_py3 import NodeTypeListResult - from ._models_py3 import NodeTypeUpdateParameters - from ._models_py3 import OperationListResult - from ._models_py3 import OperationResult - from ._models_py3 import Partition - from ._models_py3 import PartitionInstanceCountScaleMechanism - from ._models_py3 import ProxyResource - from ._models_py3 import Resource - from ._models_py3 import RollingUpgradeMonitoringPolicy - from ._models_py3 import ScalingMechanism - from ._models_py3 import ScalingPolicy - from ._models_py3 import ScalingTrigger - from ._models_py3 import ServiceCorrelation - from ._models_py3 import ServiceLoadMetric - from ._models_py3 import ServicePlacementInvalidDomainPolicy - from ._models_py3 import ServicePlacementNonPartiallyPlaceServicePolicy - from ._models_py3 import ServicePlacementPolicy - from ._models_py3 import ServicePlacementPreferPrimaryDomainPolicy - from ._models_py3 import ServicePlacementRequireDomainDistributionPolicy - from ._models_py3 import ServicePlacementRequiredDomainPolicy - from ._models_py3 import ServiceResource - from ._models_py3 import ServiceResourceList - from ._models_py3 import ServiceResourceProperties - from ._models_py3 import ServiceResourcePropertiesBase - from ._models_py3 import ServiceTypeHealthPolicy - from ._models_py3 import ServiceUpdateParameters - from ._models_py3 import SettingsParameterDescription - from ._models_py3 import SettingsSectionDescription - from ._models_py3 import SingletonPartitionScheme - from ._models_py3 import Sku - from ._models_py3 import StatefulServiceProperties - from ._models_py3 import StatelessServiceProperties - from ._models_py3 import SubResource - from ._models_py3 import SystemData - from ._models_py3 import UniformInt64RangePartitionScheme - from ._models_py3 import UserAssignedIdentity - from ._models_py3 import VMSSExtension - from ._models_py3 import VaultCertificate - from ._models_py3 import VaultSecretGroup - from ._models_py3 import VmManagedIdentity -except (SyntaxError, ImportError): - from ._models import AddRemoveIncrementalNamedPartitionScalingMechanism # type: ignore - from ._models import ApplicationHealthPolicy # type: ignore - from ._models import ApplicationResource # type: ignore - from ._models import ApplicationResourceList # type: ignore - from ._models import ApplicationTypeResource # type: ignore - from ._models import ApplicationTypeResourceList # type: ignore - from ._models import ApplicationTypeUpdateParameters # type: ignore - from ._models import ApplicationTypeVersionResource # type: ignore - from ._models import ApplicationTypeVersionResourceList # type: ignore - from ._models import ApplicationTypeVersionUpdateParameters # type: ignore - from ._models import ApplicationTypeVersionsCleanupPolicy # type: ignore - from ._models import ApplicationUpdateParameters # type: ignore - from ._models import ApplicationUpgradePolicy # type: ignore - from ._models import ApplicationUserAssignedIdentity # type: ignore - from ._models import AvailableOperationDisplay # type: ignore - from ._models import AveragePartitionLoadScalingTrigger # type: ignore - from ._models import AverageServiceLoadScalingTrigger # type: ignore - from ._models import AzureActiveDirectory # type: ignore - from ._models import ClientCertificate # type: ignore - from ._models import EndpointRangeDescription # type: ignore - from ._models import ErrorModel # type: ignore - from ._models import ErrorModelError # type: ignore - from ._models import LoadBalancingRule # type: ignore - from ._models import ManagedCluster # type: ignore - from ._models import ManagedClusterCodeVersionResult # type: ignore - from ._models import ManagedClusterListResult # type: ignore - from ._models import ManagedClusterUpdateParameters # type: ignore - from ._models import ManagedIdentity # type: ignore - from ._models import ManagedProxyResource # type: ignore - from ._models import NamedPartitionScheme # type: ignore - from ._models import NetworkSecurityRule # type: ignore - from ._models import NodeType # type: ignore - from ._models import NodeTypeActionParameters # type: ignore - from ._models import NodeTypeListResult # type: ignore - from ._models import NodeTypeUpdateParameters # type: ignore - from ._models import OperationListResult # type: ignore - from ._models import OperationResult # type: ignore - from ._models import Partition # type: ignore - from ._models import PartitionInstanceCountScaleMechanism # type: ignore - from ._models import ProxyResource # type: ignore - from ._models import Resource # type: ignore - from ._models import RollingUpgradeMonitoringPolicy # type: ignore - from ._models import ScalingMechanism # type: ignore - from ._models import ScalingPolicy # type: ignore - from ._models import ScalingTrigger # type: ignore - from ._models import ServiceCorrelation # type: ignore - from ._models import ServiceLoadMetric # type: ignore - from ._models import ServicePlacementInvalidDomainPolicy # type: ignore - from ._models import ServicePlacementNonPartiallyPlaceServicePolicy # type: ignore - from ._models import ServicePlacementPolicy # type: ignore - from ._models import ServicePlacementPreferPrimaryDomainPolicy # type: ignore - from ._models import ServicePlacementRequireDomainDistributionPolicy # type: ignore - from ._models import ServicePlacementRequiredDomainPolicy # 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 ServiceTypeHealthPolicy # type: ignore - from ._models import ServiceUpdateParameters # type: ignore - from ._models import SettingsParameterDescription # type: ignore - from ._models import SettingsSectionDescription # type: ignore - from ._models import SingletonPartitionScheme # type: ignore - from ._models import Sku # type: ignore - from ._models import StatefulServiceProperties # type: ignore - from ._models import StatelessServiceProperties # type: ignore - from ._models import SubResource # type: ignore - from ._models import SystemData # type: ignore - from ._models import UniformInt64RangePartitionScheme # type: ignore - from ._models import UserAssignedIdentity # type: ignore - from ._models import VMSSExtension # type: ignore - from ._models import VaultCertificate # type: ignore - from ._models import VaultSecretGroup # type: ignore - from ._models import VmManagedIdentity # type: ignore +from ._models_py3 import AddRemoveIncrementalNamedPartitionScalingMechanism +from ._models_py3 import ApplicationHealthPolicy +from ._models_py3 import ApplicationResource +from ._models_py3 import ApplicationResourceList +from ._models_py3 import ApplicationTypeResource +from ._models_py3 import ApplicationTypeResourceList +from ._models_py3 import ApplicationTypeUpdateParameters +from ._models_py3 import ApplicationTypeVersionResource +from ._models_py3 import ApplicationTypeVersionResourceList +from ._models_py3 import ApplicationTypeVersionUpdateParameters +from ._models_py3 import ApplicationTypeVersionsCleanupPolicy +from ._models_py3 import ApplicationUpdateParameters +from ._models_py3 import ApplicationUpgradePolicy +from ._models_py3 import ApplicationUserAssignedIdentity +from ._models_py3 import AvailableOperationDisplay +from ._models_py3 import AveragePartitionLoadScalingTrigger +from ._models_py3 import AverageServiceLoadScalingTrigger +from ._models_py3 import AzureActiveDirectory +from ._models_py3 import ClientCertificate +from ._models_py3 import EndpointRangeDescription +from ._models_py3 import ErrorModel +from ._models_py3 import ErrorModelError +from ._models_py3 import FrontendConfiguration +from ._models_py3 import IPTag +from ._models_py3 import LoadBalancingRule +from ._models_py3 import LongRunningOperationResult +from ._models_py3 import ManagedAzResiliencyStatus +from ._models_py3 import ManagedCluster +from ._models_py3 import ManagedClusterCodeVersionResult +from ._models_py3 import ManagedClusterListResult +from ._models_py3 import ManagedClusterUpdateParameters +from ._models_py3 import ManagedIdentity +from ._models_py3 import ManagedProxyResource +from ._models_py3 import ManagedVMSize +from ._models_py3 import ManagedVMSizesResult +from ._models_py3 import NamedPartitionScheme +from ._models_py3 import NetworkSecurityRule +from ._models_py3 import NodeType +from ._models_py3 import NodeTypeActionParameters +from ._models_py3 import NodeTypeAvailableSku +from ._models_py3 import NodeTypeListResult +from ._models_py3 import NodeTypeListSkuResult +from ._models_py3 import NodeTypeSku +from ._models_py3 import NodeTypeSkuCapacity +from ._models_py3 import NodeTypeSupportedSku +from ._models_py3 import NodeTypeUpdateParameters +from ._models_py3 import OperationListResult +from ._models_py3 import OperationResult +from ._models_py3 import Partition +from ._models_py3 import PartitionInstanceCountScaleMechanism +from ._models_py3 import ProxyResource +from ._models_py3 import Resource +from ._models_py3 import ResourceAzStatus +from ._models_py3 import RollingUpgradeMonitoringPolicy +from ._models_py3 import ScalingMechanism +from ._models_py3 import ScalingPolicy +from ._models_py3 import ScalingTrigger +from ._models_py3 import ServiceCorrelation +from ._models_py3 import ServiceEndpoint +from ._models_py3 import ServiceLoadMetric +from ._models_py3 import ServicePlacementInvalidDomainPolicy +from ._models_py3 import ServicePlacementNonPartiallyPlaceServicePolicy +from ._models_py3 import ServicePlacementPolicy +from ._models_py3 import ServicePlacementPreferPrimaryDomainPolicy +from ._models_py3 import ServicePlacementRequireDomainDistributionPolicy +from ._models_py3 import ServicePlacementRequiredDomainPolicy +from ._models_py3 import ServiceResource +from ._models_py3 import ServiceResourceList +from ._models_py3 import ServiceResourceProperties +from ._models_py3 import ServiceResourcePropertiesBase +from ._models_py3 import ServiceTypeHealthPolicy +from ._models_py3 import ServiceUpdateParameters +from ._models_py3 import SettingsParameterDescription +from ._models_py3 import SettingsSectionDescription +from ._models_py3 import SingletonPartitionScheme +from ._models_py3 import Sku +from ._models_py3 import StatefulServiceProperties +from ._models_py3 import StatelessServiceProperties +from ._models_py3 import SubResource +from ._models_py3 import Subnet +from ._models_py3 import SystemData +from ._models_py3 import UniformInt64RangePartitionScheme +from ._models_py3 import UserAssignedIdentity +from ._models_py3 import VMSSExtension +from ._models_py3 import VMSize +from ._models_py3 import VaultCertificate +from ._models_py3 import VaultSecretGroup +from ._models_py3 import VmManagedIdentity +from ._models_py3 import VmssDataDisk + from ._service_fabric_managed_clusters_management_client_enums import ( Access, @@ -163,12 +105,18 @@ Direction, DiskType, FailureAction, + IPAddressType, ManagedClusterAddOnFeature, + ManagedClusterVersionEnvironment, ManagedIdentityType, ManagedResourceProvisioningState, MoveCost, + NodeTypeSkuScaleType, NsgProtocol, + OsType, PartitionScheme, + PrivateEndpointNetworkPolicies, + PrivateLinkServiceNetworkPolicies, ProbeProtocol, Protocol, RollingUpgradeMode, @@ -205,18 +153,29 @@ 'EndpointRangeDescription', 'ErrorModel', 'ErrorModelError', + 'FrontendConfiguration', + 'IPTag', 'LoadBalancingRule', + 'LongRunningOperationResult', + 'ManagedAzResiliencyStatus', 'ManagedCluster', 'ManagedClusterCodeVersionResult', 'ManagedClusterListResult', 'ManagedClusterUpdateParameters', 'ManagedIdentity', 'ManagedProxyResource', + 'ManagedVMSize', + 'ManagedVMSizesResult', 'NamedPartitionScheme', 'NetworkSecurityRule', 'NodeType', 'NodeTypeActionParameters', + 'NodeTypeAvailableSku', 'NodeTypeListResult', + 'NodeTypeListSkuResult', + 'NodeTypeSku', + 'NodeTypeSkuCapacity', + 'NodeTypeSupportedSku', 'NodeTypeUpdateParameters', 'OperationListResult', 'OperationResult', @@ -224,11 +183,13 @@ 'PartitionInstanceCountScaleMechanism', 'ProxyResource', 'Resource', + 'ResourceAzStatus', 'RollingUpgradeMonitoringPolicy', 'ScalingMechanism', 'ScalingPolicy', 'ScalingTrigger', 'ServiceCorrelation', + 'ServiceEndpoint', 'ServiceLoadMetric', 'ServicePlacementInvalidDomainPolicy', 'ServicePlacementNonPartiallyPlaceServicePolicy', @@ -249,13 +210,16 @@ 'StatefulServiceProperties', 'StatelessServiceProperties', 'SubResource', + 'Subnet', 'SystemData', 'UniformInt64RangePartitionScheme', 'UserAssignedIdentity', 'VMSSExtension', + 'VMSize', 'VaultCertificate', 'VaultSecretGroup', 'VmManagedIdentity', + 'VmssDataDisk', 'Access', 'ClusterState', 'ClusterUpgradeCadence', @@ -263,12 +227,18 @@ 'Direction', 'DiskType', 'FailureAction', + 'IPAddressType', 'ManagedClusterAddOnFeature', + 'ManagedClusterVersionEnvironment', 'ManagedIdentityType', 'ManagedResourceProvisioningState', 'MoveCost', + 'NodeTypeSkuScaleType', 'NsgProtocol', + 'OsType', 'PartitionScheme', + 'PrivateEndpointNetworkPolicies', + 'PrivateLinkServiceNetworkPolicies', 'ProbeProtocol', 'Protocol', 'RollingUpgradeMode', diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/models/_models_py3.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/models/_models_py3.py index 3e48d8352f3c1..b13c6dbb01748 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/models/_models_py3.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/models/_models_py3.py @@ -7,7 +7,7 @@ # -------------------------------------------------------------------------- import datetime -from typing import Dict, List, Optional, Union +from typing import Any, Dict, List, Optional, Union from azure.core.exceptions import HttpResponseError import msrest.serialization @@ -23,10 +23,10 @@ class ScalingMechanism(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param kind: Required. Specifies the mechanism associated with this scaling policy.Constant - filled by server. Possible values include: "ScalePartitionInstanceCount", + :ivar kind: Required. Specifies the mechanism associated with this scaling policy.Constant + filled by server. Possible values include: "ScalePartitionInstanceCount", "AddRemoveIncrementalNamedPartition". - :type kind: str or + :vartype kind: str or ~service_fabric_managed_clusters_management_client.models.ServiceScalingMechanismKind """ @@ -46,6 +46,8 @@ def __init__( self, **kwargs ): + """ + """ super(ScalingMechanism, self).__init__(**kwargs) self.kind = None # type: Optional[str] @@ -55,18 +57,18 @@ class AddRemoveIncrementalNamedPartitionScalingMechanism(ScalingMechanism): All required parameters must be populated in order to send to Azure. - :param kind: Required. Specifies the mechanism associated with this scaling policy.Constant - filled by server. Possible values include: "ScalePartitionInstanceCount", + :ivar kind: Required. Specifies the mechanism associated with this scaling policy.Constant + filled by server. Possible values include: "ScalePartitionInstanceCount", "AddRemoveIncrementalNamedPartition". - :type kind: str or + :vartype kind: str or ~service_fabric_managed_clusters_management_client.models.ServiceScalingMechanismKind - :param min_partition_count: Required. Minimum number of named partitions of the service. - :type min_partition_count: int - :param max_partition_count: Required. Maximum number of named partitions of the service. - :type max_partition_count: int - :param scale_increment: Required. The number of instances to add or remove during a scaling + :ivar min_partition_count: Required. Minimum number of named partitions of the service. + :vartype min_partition_count: int + :ivar max_partition_count: Required. Maximum number of named partitions of the service. + :vartype max_partition_count: int + :ivar scale_increment: Required. The number of instances to add or remove during a scaling operation. - :type scale_increment: int + :vartype scale_increment: int """ _validation = { @@ -91,6 +93,15 @@ def __init__( scale_increment: int, **kwargs ): + """ + :keyword min_partition_count: Required. Minimum number of named partitions of the service. + :paramtype min_partition_count: int + :keyword max_partition_count: Required. Maximum number of named partitions of the service. + :paramtype max_partition_count: int + :keyword scale_increment: Required. The number of instances to add or remove during a scaling + operation. + :paramtype scale_increment: int + """ super(AddRemoveIncrementalNamedPartitionScalingMechanism, self).__init__(**kwargs) self.kind = 'AddRemoveIncrementalNamedPartition' # type: str self.min_partition_count = min_partition_count @@ -103,10 +114,10 @@ class ApplicationHealthPolicy(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param consider_warning_as_error: Required. Indicates whether warnings are treated with the - same severity as errors. - :type consider_warning_as_error: bool - :param max_percent_unhealthy_deployed_applications: Required. The maximum allowed percentage of + :ivar consider_warning_as_error: Required. Indicates whether warnings are treated with the same + severity as errors. + :vartype consider_warning_as_error: bool + :ivar max_percent_unhealthy_deployed_applications: Required. 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. @@ -114,14 +125,14 @@ class ApplicationHealthPolicy(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: ~service_fabric_managed_clusters_management_client.models.ServiceTypeHealthPolicy - :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, ~service_fabric_managed_clusters_management_client.models.ServiceTypeHealthPolicy] """ @@ -146,6 +157,28 @@ def __init__( service_type_health_policy_map: Optional[Dict[str, "ServiceTypeHealthPolicy"]] = None, **kwargs ): + """ + :keyword consider_warning_as_error: Required. Indicates whether warnings are treated with the + same severity as errors. + :paramtype consider_warning_as_error: bool + :keyword max_percent_unhealthy_deployed_applications: Required. 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: + ~service_fabric_managed_clusters_management_client.models.ServiceTypeHealthPolicy + :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, + ~service_fabric_managed_clusters_management_client.models.ServiceTypeHealthPolicy] + """ super(ApplicationHealthPolicy, self).__init__(**kwargs) self.consider_warning_as_error = consider_warning_as_error self.max_percent_unhealthy_deployed_applications = max_percent_unhealthy_deployed_applications @@ -164,10 +197,10 @@ class ProxyResource(msrest.serialization.Model): :vartype name: str :ivar type: Azure resource type. :vartype type: str - :param location: 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 location: Resource location depends on the parent resource. + :vartype location: str + :ivar tags: A set of tags. Azure resource tags. + :vartype tags: dict[str, str] :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~service_fabric_managed_clusters_management_client.models.SystemData """ @@ -195,6 +228,12 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword location: 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 @@ -215,29 +254,29 @@ class ApplicationResource(ProxyResource): :vartype name: str :ivar type: Azure resource type. :vartype type: str - :param location: 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 location: Resource location depends on the parent resource. + :vartype location: str + :ivar tags: A set of tags. Azure resource tags. + :vartype tags: dict[str, str] :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~service_fabric_managed_clusters_management_client.models.SystemData - :param identity: Describes the managed identities for an Azure resource. - :type identity: ~service_fabric_managed_clusters_management_client.models.ManagedIdentity + :ivar identity: Describes the managed identities for an Azure resource. + :vartype identity: ~service_fabric_managed_clusters_management_client.models.ManagedIdentity :ivar provisioning_state: The current deployment or provisioning state, which only appears in the response. :vartype provisioning_state: str - :param version: The version of the application type as defined in the application manifest. + :ivar version: The version of the application type as defined in the application manifest. This name must be the full Arm Resource ID for the referenced application type version. - :type version: str - :param parameters: List of application parameters with overridden values from their default + :vartype 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: + :vartype parameters: dict[str, str] + :ivar upgrade_policy: Describes the policy for a monitored application upgrade. + :vartype upgrade_policy: ~service_fabric_managed_clusters_management_client.models.ApplicationUpgradePolicy - :param managed_identities: List of user assigned identities for the application, each mapped to + :ivar managed_identities: List of user assigned identities for the application, each mapped to a friendly name. - :type managed_identities: + :vartype managed_identities: list[~service_fabric_managed_clusters_management_client.models.ApplicationUserAssignedIdentity] """ @@ -276,6 +315,27 @@ def __init__( managed_identities: Optional[List["ApplicationUserAssignedIdentity"]] = None, **kwargs ): + """ + :keyword location: 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: ~service_fabric_managed_clusters_management_client.models.ManagedIdentity + :keyword version: The version of the application type as defined in the application manifest. + This name must be the full Arm Resource ID for the referenced application type version. + :paramtype 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: + ~service_fabric_managed_clusters_management_client.models.ApplicationUpgradePolicy + :keyword managed_identities: List of user assigned identities for the application, each mapped + to a friendly name. + :paramtype managed_identities: + list[~service_fabric_managed_clusters_management_client.models.ApplicationUserAssignedIdentity] + """ super(ApplicationResource, self).__init__(location=location, tags=tags, **kwargs) self.identity = identity self.provisioning_state = None @@ -290,8 +350,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: + :ivar value: + :vartype value: list[~service_fabric_managed_clusters_management_client.models.ApplicationResource] :ivar next_link: URL to get the next set of application list results if there are any. :vartype next_link: str @@ -312,6 +372,11 @@ def __init__( value: Optional[List["ApplicationResource"]] = None, **kwargs ): + """ + :keyword value: + :paramtype value: + list[~service_fabric_managed_clusters_management_client.models.ApplicationResource] + """ super(ApplicationResourceList, self).__init__(**kwargs) self.value = value self.next_link = None @@ -328,10 +393,10 @@ class ApplicationTypeResource(ProxyResource): :vartype name: str :ivar type: Azure resource type. :vartype type: str - :param location: 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 location: Resource location depends on the parent resource. + :vartype location: str + :ivar tags: A set of tags. Azure resource tags. + :vartype tags: dict[str, str] :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~service_fabric_managed_clusters_management_client.models.SystemData :ivar provisioning_state: The current deployment or provisioning state, which only appears in @@ -364,6 +429,12 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword location: 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 @@ -373,8 +444,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: + :ivar value: + :vartype value: list[~service_fabric_managed_clusters_management_client.models.ApplicationTypeResource] :ivar next_link: URL to get the next set of application type list results if there are any. :vartype next_link: str @@ -395,6 +466,11 @@ def __init__( value: Optional[List["ApplicationTypeResource"]] = None, **kwargs ): + """ + :keyword value: + :paramtype value: + list[~service_fabric_managed_clusters_management_client.models.ApplicationTypeResource] + """ super(ApplicationTypeResourceList, self).__init__(**kwargs) self.value = value self.next_link = None @@ -403,8 +479,8 @@ def __init__( class ApplicationTypeUpdateParameters(msrest.serialization.Model): """Application type update request. - :param tags: A set of tags. Application type update parameters. - :type tags: dict[str, str] + :ivar tags: A set of tags. Application type update parameters. + :vartype tags: dict[str, str] """ _attribute_map = { @@ -417,6 +493,10 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Application type update parameters. + :paramtype tags: dict[str, str] + """ super(ApplicationTypeUpdateParameters, self).__init__(**kwargs) self.tags = tags @@ -432,17 +512,17 @@ class ApplicationTypeVersionResource(ProxyResource): :vartype name: str :ivar type: Azure resource type. :vartype type: str - :param location: 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 location: Resource location depends on the parent resource. + :vartype location: str + :ivar tags: A set of tags. Azure resource tags. + :vartype tags: dict[str, str] :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~service_fabric_managed_clusters_management_client.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 app_package_url: The URL to the application package. + :vartype app_package_url: str """ _validation = { @@ -472,6 +552,14 @@ def __init__( app_package_url: Optional[str] = None, **kwargs ): + """ + :keyword location: 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 @@ -482,8 +570,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: + :ivar value: + :vartype value: list[~service_fabric_managed_clusters_management_client.models.ApplicationTypeVersionResource] :ivar next_link: URL to get the next set of application type version list results if there are any. @@ -505,6 +593,11 @@ def __init__( value: Optional[List["ApplicationTypeVersionResource"]] = None, **kwargs ): + """ + :keyword value: + :paramtype value: + list[~service_fabric_managed_clusters_management_client.models.ApplicationTypeVersionResource] + """ super(ApplicationTypeVersionResourceList, self).__init__(**kwargs) self.value = value self.next_link = None @@ -515,9 +608,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: int + :vartype max_unused_versions_to_keep: int """ _validation = { @@ -534,6 +627,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: int + """ super(ApplicationTypeVersionsCleanupPolicy, self).__init__(**kwargs) self.max_unused_versions_to_keep = max_unused_versions_to_keep @@ -541,8 +639,8 @@ def __init__( class ApplicationTypeVersionUpdateParameters(msrest.serialization.Model): """Application type version update request. - :param tags: A set of tags. Application type version update parameters. - :type tags: dict[str, str] + :ivar tags: A set of tags. Application type version update parameters. + :vartype tags: dict[str, str] """ _attribute_map = { @@ -555,6 +653,10 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Application type version update parameters. + :paramtype tags: dict[str, str] + """ super(ApplicationTypeVersionUpdateParameters, self).__init__(**kwargs) self.tags = tags @@ -562,8 +664,8 @@ def __init__( class ApplicationUpdateParameters(msrest.serialization.Model): """Application update request. - :param tags: A set of tags. Application update parameters. - :type tags: dict[str, str] + :ivar tags: A set of tags. Application update parameters. + :vartype tags: dict[str, str] """ _attribute_map = { @@ -576,6 +678,10 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Application update parameters. + :paramtype tags: dict[str, str] + """ super(ApplicationUpdateParameters, self).__init__(**kwargs) self.tags = tags @@ -583,35 +689,35 @@ def __init__( class ApplicationUpgradePolicy(msrest.serialization.Model): """Describes the policy for a monitored application upgrade. - :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: + :vartype application_health_policy: ~service_fabric_managed_clusters_management_client.models.ApplicationHealthPolicy - :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 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: ~service_fabric_managed_clusters_management_client.models.RollingUpgradeMonitoringPolicy - :param instance_close_delay_duration: Duration in seconds, to wait before a stateless instance + :ivar instance_close_delay_duration: Duration in seconds, to wait before a stateless instance is closed, to allow the active requests to drain gracefully. This would be effective when the instance is closing during the application/cluster upgrade, only for those instances which have a non-zero delay duration configured in the service description. - :type instance_close_delay_duration: long - :param upgrade_mode: The mode used to monitor health during a rolling upgrade. The values are + :vartype instance_close_delay_duration: long + :ivar upgrade_mode: The mode used to monitor health during a rolling upgrade. The values are Monitored, and UnmonitoredAuto. Possible values include: "Monitored", "UnmonitoredAuto". - :type upgrade_mode: str or + :vartype upgrade_mode: str or ~service_fabric_managed_clusters_management_client.models.RollingUpgradeMode - :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: long - :param recreate_application: Determines whether the application should be recreated on update. + :vartype upgrade_replica_set_check_timeout: long + :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. - :type recreate_application: bool + :vartype recreate_application: bool """ _attribute_map = { @@ -636,6 +742,37 @@ def __init__( recreate_application: Optional[bool] = None, **kwargs ): + """ + :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: + ~service_fabric_managed_clusters_management_client.models.ApplicationHealthPolicy + :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: + ~service_fabric_managed_clusters_management_client.models.RollingUpgradeMonitoringPolicy + :keyword instance_close_delay_duration: Duration in seconds, to wait before a stateless + instance is closed, to allow the active requests to drain gracefully. This would be effective + when the instance is closing during the application/cluster upgrade, only for those instances + which have a non-zero delay duration configured in the service description. + :paramtype instance_close_delay_duration: long + :keyword upgrade_mode: The mode used to monitor health during a rolling upgrade. The values are + Monitored, and UnmonitoredAuto. Possible values include: "Monitored", "UnmonitoredAuto". + :paramtype upgrade_mode: str or + ~service_fabric_managed_clusters_management_client.models.RollingUpgradeMode + :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: long + :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. + :paramtype recreate_application: bool + """ super(ApplicationUpgradePolicy, self).__init__(**kwargs) self.application_health_policy = application_health_policy self.force_restart = force_restart @@ -651,10 +788,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 = { @@ -674,6 +811,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 @@ -682,14 +825,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 = { @@ -708,6 +851,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 @@ -723,9 +876,9 @@ class ScalingTrigger(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param kind: Required. Specifies the trigger associated with this scaling policy.Constant - filled by server. Possible values include: "AveragePartitionLoad", "AverageServiceLoad". - :type kind: str or + :ivar kind: Required. Specifies the trigger associated with this scaling policy.Constant filled + by server. Possible values include: "AveragePartitionLoadTrigger", "AverageServiceLoadTrigger". + :vartype kind: str or ~service_fabric_managed_clusters_management_client.models.ServiceScalingTriggerKind """ @@ -745,6 +898,8 @@ def __init__( self, **kwargs ): + """ + """ super(ScalingTrigger, self).__init__(**kwargs) self.kind = None # type: Optional[str] @@ -754,21 +909,21 @@ class AveragePartitionLoadScalingTrigger(ScalingTrigger): All required parameters must be populated in order to send to Azure. - :param kind: Required. Specifies the trigger associated with this scaling policy.Constant - filled by server. Possible values include: "AveragePartitionLoad", "AverageServiceLoad". - :type kind: str or + :ivar kind: Required. Specifies the trigger associated with this scaling policy.Constant filled + by server. Possible values include: "AveragePartitionLoadTrigger", "AverageServiceLoadTrigger". + :vartype kind: str or ~service_fabric_managed_clusters_management_client.models.ServiceScalingTriggerKind - :param metric_name: Required. The name of the metric for which usage should be tracked. - :type metric_name: str - :param lower_load_threshold: Required. The lower limit of the load below which a scale in + :ivar metric_name: Required. The name of the metric for which usage should be tracked. + :vartype metric_name: str + :ivar lower_load_threshold: Required. The lower limit of the load below which a scale in operation should be performed. - :type lower_load_threshold: float - :param upper_load_threshold: Required. The upper limit of the load beyond which a scale out + :vartype lower_load_threshold: float + :ivar upper_load_threshold: Required. The upper limit of the load beyond which a scale out operation should be performed. - :type upper_load_threshold: float - :param scale_interval: Required. The period in seconds on which a decision is made whether to + :vartype upper_load_threshold: float + :ivar scale_interval: Required. The period in seconds on which a decision is made whether to scale or not. This property should come in ISO 8601 format "hh:mm:ss". - :type scale_interval: str + :vartype scale_interval: str """ _validation = { @@ -796,6 +951,19 @@ def __init__( scale_interval: str, **kwargs ): + """ + :keyword metric_name: Required. The name of the metric for which usage should be tracked. + :paramtype metric_name: str + :keyword lower_load_threshold: Required. The lower limit of the load below which a scale in + operation should be performed. + :paramtype lower_load_threshold: float + :keyword upper_load_threshold: Required. The upper limit of the load beyond which a scale out + operation should be performed. + :paramtype upper_load_threshold: float + :keyword scale_interval: Required. The period in seconds on which a decision is made whether to + scale or not. This property should come in ISO 8601 format "hh:mm:ss". + :paramtype scale_interval: str + """ super(AveragePartitionLoadScalingTrigger, self).__init__(**kwargs) self.kind = 'AveragePartitionLoadTrigger' # type: str self.metric_name = metric_name @@ -809,26 +977,26 @@ class AverageServiceLoadScalingTrigger(ScalingTrigger): All required parameters must be populated in order to send to Azure. - :param kind: Required. Specifies the trigger associated with this scaling policy.Constant - filled by server. Possible values include: "AveragePartitionLoad", "AverageServiceLoad". - :type kind: str or + :ivar kind: Required. Specifies the trigger associated with this scaling policy.Constant filled + by server. Possible values include: "AveragePartitionLoadTrigger", "AverageServiceLoadTrigger". + :vartype kind: str or ~service_fabric_managed_clusters_management_client.models.ServiceScalingTriggerKind - :param metric_name: Required. The name of the metric for which usage should be tracked. - :type metric_name: str - :param lower_load_threshold: Required. The lower limit of the load below which a scale in + :ivar metric_name: Required. The name of the metric for which usage should be tracked. + :vartype metric_name: str + :ivar lower_load_threshold: Required. The lower limit of the load below which a scale in operation should be performed. - :type lower_load_threshold: float - :param upper_load_threshold: Required. The upper limit of the load beyond which a scale out + :vartype lower_load_threshold: float + :ivar upper_load_threshold: Required. The upper limit of the load beyond which a scale out operation should be performed. - :type upper_load_threshold: float - :param scale_interval: Required. The period in seconds on which a decision is made whether to + :vartype upper_load_threshold: float + :ivar scale_interval: Required. The period in seconds on which a decision is made whether to scale or not. This property should come in ISO 8601 format "hh:mm:ss". - :type scale_interval: str - :param use_only_primary_load: Required. Flag determines whether only the load of primary - replica should be considered for scaling. If set to true, then trigger will only consider the - load of primary replicas of stateful service. If set to false, trigger will consider load of - all replicas. This parameter cannot be set to true for stateless service. - :type use_only_primary_load: bool + :vartype scale_interval: str + :ivar use_only_primary_load: Required. Flag determines whether only the load of primary replica + should be considered for scaling. If set to true, then trigger will only consider the load of + primary replicas of stateful service. If set to false, trigger will consider load of all + replicas. This parameter cannot be set to true for stateless service. + :vartype use_only_primary_load: bool """ _validation = { @@ -859,6 +1027,24 @@ def __init__( use_only_primary_load: bool, **kwargs ): + """ + :keyword metric_name: Required. The name of the metric for which usage should be tracked. + :paramtype metric_name: str + :keyword lower_load_threshold: Required. The lower limit of the load below which a scale in + operation should be performed. + :paramtype lower_load_threshold: float + :keyword upper_load_threshold: Required. The upper limit of the load beyond which a scale out + operation should be performed. + :paramtype upper_load_threshold: float + :keyword scale_interval: Required. The period in seconds on which a decision is made whether to + scale or not. This property should come in ISO 8601 format "hh:mm:ss". + :paramtype scale_interval: str + :keyword use_only_primary_load: Required. Flag determines whether only the load of primary + replica should be considered for scaling. If set to true, then trigger will only consider the + load of primary replicas of stateful service. If set to false, trigger will consider load of + all replicas. This parameter cannot be set to true for stateless service. + :paramtype use_only_primary_load: bool + """ super(AverageServiceLoadScalingTrigger, self).__init__(**kwargs) self.kind = 'AverageServiceLoadTrigger' # type: str self.metric_name = metric_name @@ -871,12 +1057,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 = { @@ -893,6 +1079,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 @@ -904,16 +1098,16 @@ class ClientCertificate(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 thumbprint: Certificate thumbprint. - :type thumbprint: str - :param common_name: Certificate common name. - :type common_name: str - :param issuer_thumbprint: Issuer thumbprint for the certificate. Only used together with + :vartype is_admin: bool + :ivar thumbprint: Certificate thumbprint. + :vartype thumbprint: str + :ivar common_name: Certificate common name. + :vartype common_name: str + :ivar issuer_thumbprint: Issuer thumbprint for the certificate. Only used together with CommonName. - :type issuer_thumbprint: str + :vartype issuer_thumbprint: str """ _validation = { @@ -936,6 +1130,18 @@ def __init__( issuer_thumbprint: Optional[str] = None, **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 thumbprint: Certificate thumbprint. + :paramtype thumbprint: str + :keyword common_name: Certificate common name. + :paramtype common_name: str + :keyword issuer_thumbprint: Issuer thumbprint for the certificate. Only used together with + CommonName. + :paramtype issuer_thumbprint: str + """ super(ClientCertificate, self).__init__(**kwargs) self.is_admin = is_admin self.thumbprint = thumbprint @@ -948,10 +1154,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 = { @@ -971,6 +1177,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 @@ -979,8 +1191,8 @@ def __init__( class ErrorModel(msrest.serialization.Model): """The structure of the error. - :param error: The error details. - :type error: ~service_fabric_managed_clusters_management_client.models.ErrorModelError + :ivar error: The error details. + :vartype error: ~service_fabric_managed_clusters_management_client.models.ErrorModelError """ _attribute_map = { @@ -993,6 +1205,10 @@ def __init__( error: Optional["ErrorModelError"] = None, **kwargs ): + """ + :keyword error: The error details. + :paramtype error: ~service_fabric_managed_clusters_management_client.models.ErrorModelError + """ super(ErrorModel, self).__init__(**kwargs) self.error = error @@ -1000,10 +1216,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 = { @@ -1018,34 +1234,135 @@ 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 +class FrontendConfiguration(msrest.serialization.Model): + """Describes the frontend configurations for the node type. + + :ivar ip_address_type: The IP address type of this frontend configuration. If omitted the + default value is IPv4. Possible values include: "IPv4", "IPv6". Default value: "IPv4". + :vartype ip_address_type: str or + ~service_fabric_managed_clusters_management_client.models.IPAddressType + :ivar load_balancer_backend_address_pool_id: The resource Id of the Load Balancer backend + address pool that the VM instances of the node type are associated with. The format of the + resource Id is + '/subscriptions/:code:``/resourceGroups/:code:``/providers/Microsoft.Network/loadBalancers/:code:``/backendAddressPools/:code:``'. + :vartype load_balancer_backend_address_pool_id: str + :ivar load_balancer_inbound_nat_pool_id: The resource Id of the Load Balancer inbound NAT pool + that the VM instances of the node type are associated with. The format of the resource Id is + '/subscriptions/:code:``/resourceGroups/:code:``/providers/Microsoft.Network/loadBalancers/:code:``/inboundNatPools/:code:``'. + :vartype load_balancer_inbound_nat_pool_id: str + """ + + _attribute_map = { + 'ip_address_type': {'key': 'ipAddressType', 'type': 'str'}, + 'load_balancer_backend_address_pool_id': {'key': 'loadBalancerBackendAddressPoolId', 'type': 'str'}, + 'load_balancer_inbound_nat_pool_id': {'key': 'loadBalancerInboundNatPoolId', 'type': 'str'}, + } + + def __init__( + self, + *, + ip_address_type: Optional[Union[str, "IPAddressType"]] = "IPv4", + load_balancer_backend_address_pool_id: Optional[str] = None, + load_balancer_inbound_nat_pool_id: Optional[str] = None, + **kwargs + ): + """ + :keyword ip_address_type: The IP address type of this frontend configuration. If omitted the + default value is IPv4. Possible values include: "IPv4", "IPv6". Default value: "IPv4". + :paramtype ip_address_type: str or + ~service_fabric_managed_clusters_management_client.models.IPAddressType + :keyword load_balancer_backend_address_pool_id: The resource Id of the Load Balancer backend + address pool that the VM instances of the node type are associated with. The format of the + resource Id is + '/subscriptions/:code:``/resourceGroups/:code:``/providers/Microsoft.Network/loadBalancers/:code:``/backendAddressPools/:code:``'. + :paramtype load_balancer_backend_address_pool_id: str + :keyword load_balancer_inbound_nat_pool_id: The resource Id of the Load Balancer inbound NAT + pool that the VM instances of the node type are associated with. The format of the resource Id + is + '/subscriptions/:code:``/resourceGroups/:code:``/providers/Microsoft.Network/loadBalancers/:code:``/inboundNatPools/:code:``'. + :paramtype load_balancer_inbound_nat_pool_id: str + """ + super(FrontendConfiguration, self).__init__(**kwargs) + self.ip_address_type = ip_address_type + self.load_balancer_backend_address_pool_id = load_balancer_backend_address_pool_id + self.load_balancer_inbound_nat_pool_id = load_balancer_inbound_nat_pool_id + + +class IPTag(msrest.serialization.Model): + """IPTag associated with the object. + + All required parameters must be populated in order to send to Azure. + + :ivar ip_tag_type: Required. The IP tag type. + :vartype ip_tag_type: str + :ivar tag: Required. The value of the IP tag. + :vartype tag: str + """ + + _validation = { + 'ip_tag_type': {'required': True}, + 'tag': {'required': True}, + } + + _attribute_map = { + 'ip_tag_type': {'key': 'ipTagType', 'type': 'str'}, + 'tag': {'key': 'tag', 'type': 'str'}, + } + + def __init__( + self, + *, + ip_tag_type: str, + tag: str, + **kwargs + ): + """ + :keyword ip_tag_type: Required. The IP tag type. + :paramtype ip_tag_type: str + :keyword tag: Required. The value of the IP tag. + :paramtype tag: str + """ + super(IPTag, self).__init__(**kwargs) + self.ip_tag_type = ip_tag_type + self.tag = tag + + class LoadBalancingRule(msrest.serialization.Model): """Describes a load balancing rule. All required parameters must be populated in order to send to Azure. - :param frontend_port: Required. The port for the external endpoint. Port numbers for each rule + :ivar frontend_port: Required. The port for the external endpoint. Port numbers for each rule must be unique within the Load Balancer. Acceptable values are between 1 and 65534. - :type frontend_port: int - :param backend_port: Required. The port used for internal connections on the endpoint. + :vartype frontend_port: int + :ivar backend_port: Required. The port used for internal connections on the endpoint. Acceptable values are between 1 and 65535. - :type backend_port: int - :param protocol: Required. The reference to the transport protocol used by the load balancing + :vartype backend_port: int + :ivar protocol: Required. The reference to the transport protocol used by the load balancing rule. Possible values include: "tcp", "udp". - :type protocol: str or ~service_fabric_managed_clusters_management_client.models.Protocol - :param probe_port: The prob port used by the load balancing rule. Acceptable values are between + :vartype protocol: str or ~service_fabric_managed_clusters_management_client.models.Protocol + :ivar probe_port: The prob port used by the load balancing rule. Acceptable values are between 1 and 65535. - :type probe_port: int - :param probe_protocol: Required. the reference to the load balancer probe used by the load + :vartype probe_port: int + :ivar probe_protocol: Required. the reference to the load balancer probe used by the load balancing rule. Possible values include: "tcp", "http", "https". - :type probe_protocol: str or + :vartype probe_protocol: str or ~service_fabric_managed_clusters_management_client.models.ProbeProtocol - :param probe_request_path: The probe request path. Only supported for HTTP/HTTPS probes. - :type probe_request_path: str + :ivar probe_request_path: The probe request path. Only supported for HTTP/HTTPS probes. + :vartype probe_request_path: str + :ivar load_distribution: The load distribution policy for this rule. + :vartype load_distribution: str """ _validation = { @@ -1063,6 +1380,7 @@ class LoadBalancingRule(msrest.serialization.Model): 'probe_port': {'key': 'probePort', 'type': 'int'}, 'probe_protocol': {'key': 'probeProtocol', 'type': 'str'}, 'probe_request_path': {'key': 'probeRequestPath', 'type': 'str'}, + 'load_distribution': {'key': 'loadDistribution', 'type': 'str'}, } def __init__( @@ -1074,8 +1392,31 @@ def __init__( probe_protocol: Union[str, "ProbeProtocol"], probe_port: Optional[int] = None, probe_request_path: Optional[str] = None, + load_distribution: Optional[str] = None, **kwargs ): + """ + :keyword frontend_port: Required. The port for the external endpoint. Port numbers for each + rule must be unique within the Load Balancer. Acceptable values are between 1 and 65534. + :paramtype frontend_port: int + :keyword backend_port: Required. The port used for internal connections on the endpoint. + Acceptable values are between 1 and 65535. + :paramtype backend_port: int + :keyword protocol: Required. The reference to the transport protocol used by the load balancing + rule. Possible values include: "tcp", "udp". + :paramtype protocol: str or ~service_fabric_managed_clusters_management_client.models.Protocol + :keyword probe_port: The prob port used by the load balancing rule. Acceptable values are + between 1 and 65535. + :paramtype probe_port: int + :keyword probe_protocol: Required. the reference to the load balancer probe used by the load + balancing rule. Possible values include: "tcp", "http", "https". + :paramtype probe_protocol: str or + ~service_fabric_managed_clusters_management_client.models.ProbeProtocol + :keyword probe_request_path: The probe request path. Only supported for HTTP/HTTPS probes. + :paramtype probe_request_path: str + :keyword load_distribution: The load distribution policy for this rule. + :paramtype load_distribution: str + """ super(LoadBalancingRule, self).__init__(**kwargs) self.frontend_port = frontend_port self.backend_port = backend_port @@ -1083,6 +1424,104 @@ def __init__( self.probe_port = probe_port self.probe_protocol = probe_protocol self.probe_request_path = probe_request_path + self.load_distribution = load_distribution + + +class LongRunningOperationResult(msrest.serialization.Model): + """Long running operation result. + + :ivar name: The name of the operation. + :vartype name: str + :ivar start_time: The start time of the operation. + :vartype start_time: ~datetime.datetime + :ivar end_time: The end time of the operation. + :vartype end_time: ~datetime.datetime + :ivar percent_complete: The completion percentage of the operation. + :vartype percent_complete: float + :ivar status: The status of the operation. + :vartype status: str + :ivar error: The operation error. + :vartype error: ~service_fabric_managed_clusters_management_client.models.ErrorModelError + """ + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'start_time': {'key': 'startTime', 'type': 'iso-8601'}, + 'end_time': {'key': 'endTime', 'type': 'iso-8601'}, + 'percent_complete': {'key': 'percentComplete', 'type': 'float'}, + 'status': {'key': 'status', 'type': 'str'}, + 'error': {'key': 'error', 'type': 'ErrorModelError'}, + } + + def __init__( + self, + *, + name: Optional[str] = None, + start_time: Optional[datetime.datetime] = None, + end_time: Optional[datetime.datetime] = None, + percent_complete: Optional[float] = None, + status: Optional[str] = None, + error: Optional["ErrorModelError"] = None, + **kwargs + ): + """ + :keyword name: The name of the operation. + :paramtype name: str + :keyword start_time: The start time of the operation. + :paramtype start_time: ~datetime.datetime + :keyword end_time: The end time of the operation. + :paramtype end_time: ~datetime.datetime + :keyword percent_complete: The completion percentage of the operation. + :paramtype percent_complete: float + :keyword status: The status of the operation. + :paramtype status: str + :keyword error: The operation error. + :paramtype error: ~service_fabric_managed_clusters_management_client.models.ErrorModelError + """ + super(LongRunningOperationResult, self).__init__(**kwargs) + self.name = name + self.start_time = start_time + self.end_time = end_time + self.percent_complete = percent_complete + self.status = status + self.error = error + + +class ManagedAzResiliencyStatus(msrest.serialization.Model): + """Describes the result of the request to list Managed VM Sizes for Service Fabric Managed Clusters. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar base_resource_status: List of Managed VM Sizes for Service Fabric Managed Clusters. + :vartype base_resource_status: + list[~service_fabric_managed_clusters_management_client.models.ResourceAzStatus] + :ivar is_cluster_zone_resilient: URL to get the next set of Managed VM Sizes if there are any. + :vartype is_cluster_zone_resilient: bool + """ + + _validation = { + 'is_cluster_zone_resilient': {'readonly': True}, + } + + _attribute_map = { + 'base_resource_status': {'key': 'baseResourceStatus', 'type': '[ResourceAzStatus]'}, + 'is_cluster_zone_resilient': {'key': 'isClusterZoneResilient', 'type': 'bool'}, + } + + def __init__( + self, + *, + base_resource_status: Optional[List["ResourceAzStatus"]] = None, + **kwargs + ): + """ + :keyword base_resource_status: List of Managed VM Sizes for Service Fabric Managed Clusters. + :paramtype base_resource_status: + list[~service_fabric_managed_clusters_management_client.models.ResourceAzStatus] + """ + super(ManagedAzResiliencyStatus, self).__init__(**kwargs) + self.base_resource_status = base_resource_status + self.is_cluster_zone_resilient = None class Resource(msrest.serialization.Model): @@ -1098,10 +1537,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. @@ -1134,6 +1573,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 @@ -1157,18 +1602,18 @@ class ManagedCluster(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: ~service_fabric_managed_clusters_management_client.models.SystemData - :param sku: The sku of the managed cluster. - :type sku: ~service_fabric_managed_clusters_management_client.models.Sku - :param dns_name: The cluster dns name. - :type dns_name: str + :ivar sku: The sku of the managed cluster. + :vartype sku: ~service_fabric_managed_clusters_management_client.models.Sku + :ivar dns_name: The cluster dns name. + :vartype dns_name: str :ivar fqdn: The fully qualified domain name associated with the public load balancer of the cluster. :vartype fqdn: str @@ -1182,67 +1627,90 @@ class ManagedCluster(Resource): ~service_fabric_managed_clusters_management_client.models.ClusterState :ivar cluster_certificate_thumbprints: List of thumbprints of the cluster certificates. :vartype cluster_certificate_thumbprints: list[str] - :param client_connection_port: The port used for client connections to the cluster. - :type client_connection_port: int - :param http_gateway_connection_port: The port used for HTTP connections to the cluster. - :type http_gateway_connection_port: int - :param admin_user_name: VM admin user name. - :type admin_user_name: str - :param admin_password: VM admin user password. - :type admin_password: str - :param load_balancing_rules: Load balancing rules that are applied to the public load balancer + :ivar client_connection_port: The port used for client connections to the cluster. + :vartype client_connection_port: int + :ivar http_gateway_connection_port: The port used for HTTP connections to the cluster. + :vartype http_gateway_connection_port: int + :ivar admin_user_name: VM admin user name. + :vartype admin_user_name: str + :ivar admin_password: VM admin user password. + :vartype admin_password: str + :ivar load_balancing_rules: Load balancing rules that are applied to the public load balancer of the cluster. - :type load_balancing_rules: + :vartype load_balancing_rules: list[~service_fabric_managed_clusters_management_client.models.LoadBalancingRule] - :param allow_rdp_access: Setting this to true enables RDP access to the VM. The default NSG - rule opens RDP port to internet which can be overridden with custom Network Security Rules. The + :ivar allow_rdp_access: Setting this to true enables RDP access to the VM. The default NSG rule + opens RDP port to Internet which can be overridden with custom Network Security Rules. The default value for this setting is false. - :type allow_rdp_access: bool - :param network_security_rules: Custom Network Security Rules that are applied to the virtual - network of the cluster. - :type network_security_rules: + :vartype allow_rdp_access: bool + :ivar network_security_rules: Custom Network Security Rules that are applied to the Virtual + Network of the cluster. + :vartype network_security_rules: list[~service_fabric_managed_clusters_management_client.models.NetworkSecurityRule] - :param clients: Client certificates that are allowed to manage the cluster. - :type clients: + :ivar clients: Client certificates that are allowed to manage the cluster. + :vartype clients: list[~service_fabric_managed_clusters_management_client.models.ClientCertificate] - :param azure_active_directory: The AAD authentication settings of the cluster. - :type azure_active_directory: + :ivar azure_active_directory: The AAD authentication settings of the cluster. + :vartype azure_active_directory: ~service_fabric_managed_clusters_management_client.models.AzureActiveDirectory - :param fabric_settings: The list of custom fabric settings to configure the cluster. - :type fabric_settings: + :ivar fabric_settings: The list of custom fabric settings to configure the cluster. + :vartype fabric_settings: list[~service_fabric_managed_clusters_management_client.models.SettingsSectionDescription] :ivar provisioning_state: The provisioning state of the managed cluster resource. Possible values include: "None", "Creating", "Created", "Updating", "Succeeded", "Failed", "Canceled", "Deleting", "Deleted", "Other". :vartype provisioning_state: str or ~service_fabric_managed_clusters_management_client.models.ManagedResourceProvisioningState - :param cluster_code_version: The Service Fabric runtime version of the cluster. This property - is required when **clusterUpgradeMode** is set to 'Manual'. To get list of available Service + :ivar cluster_code_version: The Service Fabric runtime version of the cluster. This property is + required when **clusterUpgradeMode** 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 cluster_upgrade_mode: The upgrade mode of the cluster when new Service Fabric runtime + :vartype cluster_code_version: str + :ivar cluster_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 cluster_upgrade_mode: str or + :vartype cluster_upgrade_mode: str or ~service_fabric_managed_clusters_management_client.models.ClusterUpgradeMode - :param cluster_upgrade_cadence: Indicates when new cluster runtime version upgrades will be + :ivar cluster_upgrade_cadence: Indicates when new cluster runtime version upgrades will be applied after they are released. By default is Wave0. Only applies when **clusterUpgradeMode** is set to 'Automatic'. Possible values include: "Wave0", "Wave1", "Wave2". - :type cluster_upgrade_cadence: str or + :vartype cluster_upgrade_cadence: str or ~service_fabric_managed_clusters_management_client.models.ClusterUpgradeCadence - :param addon_features: List of add-on features to enable on the cluster. - :type addon_features: list[str or + :ivar addon_features: List of add-on features to enable on the cluster. + :vartype addon_features: list[str or ~service_fabric_managed_clusters_management_client.models.ManagedClusterAddOnFeature] - :param enable_auto_os_upgrade: Setting this to true enables automatic OS upgrade for the node + :ivar enable_auto_os_upgrade: Setting this to true enables automatic OS upgrade for the node types that are created using any platform OS image with version 'latest'. The default value for this setting is false. - :type enable_auto_os_upgrade: bool - :param zonal_resiliency: Indicates if the cluster has zone resiliency. - :type zonal_resiliency: bool - :param application_type_versions_cleanup_policy: The policy used to clean up unused versions. - :type application_type_versions_cleanup_policy: + :vartype enable_auto_os_upgrade: bool + :ivar zonal_resiliency: Indicates if the cluster has zone resiliency. + :vartype zonal_resiliency: bool + :ivar application_type_versions_cleanup_policy: The policy used to clean up unused versions. + :vartype application_type_versions_cleanup_policy: ~service_fabric_managed_clusters_management_client.models.ApplicationTypeVersionsCleanupPolicy + :ivar enable_ipv6: Setting this to true creates IPv6 address space for the default VNet used by + the cluster. This setting cannot be changed once the cluster is created. The default value for + this setting is false. + :vartype enable_ipv6: bool + :ivar subnet_id: If specified, the node types for the cluster are created in this subnet + instead of the default VNet. The **networkSecurityRules** specified for the cluster are also + applied to this subnet. This setting cannot be changed once the cluster is created. + :vartype subnet_id: str + :ivar ip_tags: The list of IP tags associated with the default public IP address of the + cluster. + :vartype ip_tags: list[~service_fabric_managed_clusters_management_client.models.IPTag] + :ivar ipv6_address: IPv6 address for the cluster if IPv6 is enabled. + :vartype ipv6_address: str + :ivar enable_service_public_ip: Setting this to true will link the IPv4 address as the + ServicePublicIP of the IPv6 address. It can only be set to True if IPv6 is enabled on the + cluster. + :vartype enable_service_public_ip: bool + :ivar auxiliary_subnets: Auxiliary subnets for the cluster. + :vartype auxiliary_subnets: + list[~service_fabric_managed_clusters_management_client.models.Subnet] + :ivar service_endpoints: Service endpoints for subnets in the cluster. + :vartype service_endpoints: + list[~service_fabric_managed_clusters_management_client.models.ServiceEndpoint] """ _validation = { @@ -1258,6 +1726,7 @@ class ManagedCluster(Resource): 'cluster_state': {'readonly': True}, 'cluster_certificate_thumbprints': {'readonly': True}, 'provisioning_state': {'readonly': True}, + 'ipv6_address': {'readonly': True}, } _attribute_map = { @@ -1293,6 +1762,13 @@ class ManagedCluster(Resource): 'enable_auto_os_upgrade': {'key': 'properties.enableAutoOSUpgrade', 'type': 'bool'}, 'zonal_resiliency': {'key': 'properties.zonalResiliency', 'type': 'bool'}, 'application_type_versions_cleanup_policy': {'key': 'properties.applicationTypeVersionsCleanupPolicy', 'type': 'ApplicationTypeVersionsCleanupPolicy'}, + 'enable_ipv6': {'key': 'properties.enableIpv6', 'type': 'bool'}, + 'subnet_id': {'key': 'properties.subnetId', 'type': 'str'}, + 'ip_tags': {'key': 'properties.ipTags', 'type': '[IPTag]'}, + 'ipv6_address': {'key': 'properties.ipv6Address', 'type': 'str'}, + 'enable_service_public_ip': {'key': 'properties.enableServicePublicIP', 'type': 'bool'}, + 'auxiliary_subnets': {'key': 'properties.auxiliarySubnets', 'type': '[Subnet]'}, + 'service_endpoints': {'key': 'properties.serviceEndpoints', 'type': '[ServiceEndpoint]'}, } def __init__( @@ -1319,8 +1795,101 @@ def __init__( enable_auto_os_upgrade: Optional[bool] = None, zonal_resiliency: Optional[bool] = False, application_type_versions_cleanup_policy: Optional["ApplicationTypeVersionsCleanupPolicy"] = None, + enable_ipv6: Optional[bool] = None, + subnet_id: Optional[str] = None, + ip_tags: Optional[List["IPTag"]] = None, + enable_service_public_ip: Optional[bool] = None, + auxiliary_subnets: Optional[List["Subnet"]] = None, + service_endpoints: Optional[List["ServiceEndpoint"]] = 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 sku: The sku of the managed cluster. + :paramtype sku: ~service_fabric_managed_clusters_management_client.models.Sku + :keyword dns_name: The cluster dns name. + :paramtype dns_name: str + :keyword client_connection_port: The port used for client connections to the cluster. + :paramtype client_connection_port: int + :keyword http_gateway_connection_port: The port used for HTTP connections to the cluster. + :paramtype http_gateway_connection_port: int + :keyword admin_user_name: VM admin user name. + :paramtype admin_user_name: str + :keyword admin_password: VM admin user password. + :paramtype admin_password: str + :keyword load_balancing_rules: Load balancing rules that are applied to the public load + balancer of the cluster. + :paramtype load_balancing_rules: + list[~service_fabric_managed_clusters_management_client.models.LoadBalancingRule] + :keyword allow_rdp_access: Setting this to true enables RDP access to the VM. The default NSG + rule opens RDP port to Internet which can be overridden with custom Network Security Rules. The + default value for this setting is false. + :paramtype allow_rdp_access: bool + :keyword network_security_rules: Custom Network Security Rules that are applied to the Virtual + Network of the cluster. + :paramtype network_security_rules: + list[~service_fabric_managed_clusters_management_client.models.NetworkSecurityRule] + :keyword clients: Client certificates that are allowed to manage the cluster. + :paramtype clients: + list[~service_fabric_managed_clusters_management_client.models.ClientCertificate] + :keyword azure_active_directory: The AAD authentication settings of the cluster. + :paramtype azure_active_directory: + ~service_fabric_managed_clusters_management_client.models.AzureActiveDirectory + :keyword fabric_settings: The list of custom fabric settings to configure the cluster. + :paramtype fabric_settings: + list[~service_fabric_managed_clusters_management_client.models.SettingsSectionDescription] + :keyword cluster_code_version: The Service Fabric runtime version of the cluster. This property + is required when **clusterUpgradeMode** 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 cluster_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 cluster_upgrade_mode: str or + ~service_fabric_managed_clusters_management_client.models.ClusterUpgradeMode + :keyword cluster_upgrade_cadence: Indicates when new cluster runtime version upgrades will be + applied after they are released. By default is Wave0. Only applies when **clusterUpgradeMode** + is set to 'Automatic'. Possible values include: "Wave0", "Wave1", "Wave2". + :paramtype cluster_upgrade_cadence: str or + ~service_fabric_managed_clusters_management_client.models.ClusterUpgradeCadence + :keyword addon_features: List of add-on features to enable on the cluster. + :paramtype addon_features: list[str or + ~service_fabric_managed_clusters_management_client.models.ManagedClusterAddOnFeature] + :keyword enable_auto_os_upgrade: Setting this to true enables automatic OS upgrade for the node + types that are created using any platform OS image with version 'latest'. The default value for + this setting is false. + :paramtype enable_auto_os_upgrade: bool + :keyword zonal_resiliency: Indicates if the cluster has zone resiliency. + :paramtype zonal_resiliency: bool + :keyword application_type_versions_cleanup_policy: The policy used to clean up unused versions. + :paramtype application_type_versions_cleanup_policy: + ~service_fabric_managed_clusters_management_client.models.ApplicationTypeVersionsCleanupPolicy + :keyword enable_ipv6: Setting this to true creates IPv6 address space for the default VNet used + by the cluster. This setting cannot be changed once the cluster is created. The default value + for this setting is false. + :paramtype enable_ipv6: bool + :keyword subnet_id: If specified, the node types for the cluster are created in this subnet + instead of the default VNet. The **networkSecurityRules** specified for the cluster are also + applied to this subnet. This setting cannot be changed once the cluster is created. + :paramtype subnet_id: str + :keyword ip_tags: The list of IP tags associated with the default public IP address of the + cluster. + :paramtype ip_tags: list[~service_fabric_managed_clusters_management_client.models.IPTag] + :keyword enable_service_public_ip: Setting this to true will link the IPv4 address as the + ServicePublicIP of the IPv6 address. It can only be set to True if IPv6 is enabled on the + cluster. + :paramtype enable_service_public_ip: bool + :keyword auxiliary_subnets: Auxiliary subnets for the cluster. + :paramtype auxiliary_subnets: + list[~service_fabric_managed_clusters_management_client.models.Subnet] + :keyword service_endpoints: Service endpoints for subnets in the cluster. + :paramtype service_endpoints: + list[~service_fabric_managed_clusters_management_client.models.ServiceEndpoint] + """ super(ManagedCluster, self).__init__(location=location, tags=tags, **kwargs) self.sku = sku self.dns_name = dns_name @@ -1347,31 +1916,33 @@ def __init__( self.enable_auto_os_upgrade = enable_auto_os_upgrade self.zonal_resiliency = zonal_resiliency self.application_type_versions_cleanup_policy = application_type_versions_cleanup_policy + self.enable_ipv6 = enable_ipv6 + self.subnet_id = subnet_id + self.ip_tags = ip_tags + self.ipv6_address = None + self.enable_service_public_ip = enable_service_public_ip + self.auxiliary_subnets = auxiliary_subnets + self.service_endpoints = service_endpoints class ManagedClusterCodeVersionResult(msrest.serialization.Model): """The result of the Service Fabric runtime versions. - Variables are only populated by the server, and will be ignored when sending a request. - - :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 cluster_code_version: The Service Fabric runtime version of the cluster. - :type cluster_code_version: str - :param support_expiry_utc: The date of expiry of support of the version. - :type support_expiry_utc: str - :ivar os_type: Cluster operating system, the default will be Windows. Default value: "Windows". - :vartype os_type: str + :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 cluster_code_version: The Service Fabric runtime version of the cluster. + :vartype cluster_code_version: str + :ivar support_expiry_utc: The date of expiry of support of the version. + :vartype support_expiry_utc: str + :ivar os_type: Cluster operating system, the default will be Windows. Possible values include: + "Windows". + :vartype os_type: str or ~service_fabric_managed_clusters_management_client.models.OsType """ - _validation = { - 'os_type': {'constant': True}, - } - _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, 'name': {'key': 'name', 'type': 'str'}, @@ -1381,8 +1952,6 @@ class ManagedClusterCodeVersionResult(msrest.serialization.Model): 'os_type': {'key': 'properties.osType', 'type': 'str'}, } - os_type = "Windows" - def __init__( self, *, @@ -1391,23 +1960,40 @@ def __init__( type: Optional[str] = None, cluster_code_version: Optional[str] = None, support_expiry_utc: Optional[str] = None, + os_type: Optional[Union[str, "OsType"]] = 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 cluster_code_version: The Service Fabric runtime version of the cluster. + :paramtype cluster_code_version: str + :keyword support_expiry_utc: The date of expiry of support of the version. + :paramtype support_expiry_utc: str + :keyword os_type: Cluster operating system, the default will be Windows. Possible values + include: "Windows". + :paramtype os_type: str or ~service_fabric_managed_clusters_management_client.models.OsType + """ super(ManagedClusterCodeVersionResult, self).__init__(**kwargs) self.id = id self.name = name self.type = type self.cluster_code_version = cluster_code_version self.support_expiry_utc = support_expiry_utc + self.os_type = os_type class ManagedClusterListResult(msrest.serialization.Model): """Managed Cluster list results. - :param value: - :type value: list[~service_fabric_managed_clusters_management_client.models.ManagedCluster] - :param next_link: The URL to use for getting the next set of results. - :type next_link: str + :ivar value: + :vartype value: list[~service_fabric_managed_clusters_management_client.models.ManagedCluster] + :ivar next_link: The URL to use for getting the next set of results. + :vartype next_link: str """ _attribute_map = { @@ -1422,6 +2008,13 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: + :paramtype value: + list[~service_fabric_managed_clusters_management_client.models.ManagedCluster] + :keyword next_link: The URL to use for getting the next set of results. + :paramtype next_link: str + """ super(ManagedClusterListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1430,8 +2023,8 @@ def __init__( class ManagedClusterUpdateParameters(msrest.serialization.Model): """Managed cluster update request. - :param tags: A set of tags. Managed cluster update parameters. - :type tags: dict[str, str] + :ivar tags: A set of tags. Managed cluster update parameters. + :vartype tags: dict[str, str] """ _attribute_map = { @@ -1444,6 +2037,10 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Managed cluster update parameters. + :paramtype tags: dict[str, str] + """ super(ManagedClusterUpdateParameters, self).__init__(**kwargs) self.tags = tags @@ -1459,14 +2056,14 @@ 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: "None", + :ivar type: The type of managed identity for the resource. Possible values include: "None", "SystemAssigned", "UserAssigned", "SystemAssigned, UserAssigned". - :type type: str or + :vartype type: str or ~service_fabric_managed_clusters_management_client.models.ManagedIdentityType - :param user_assigned_identities: The list of user identities associated with the resource. The + :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, ~service_fabric_managed_clusters_management_client.models.UserAssignedIdentity] """ @@ -1489,6 +2086,17 @@ def __init__( user_assigned_identities: Optional[Dict[str, "UserAssignedIdentity"]] = None, **kwargs ): + """ + :keyword type: The type of managed identity for the resource. Possible values include: "None", + "SystemAssigned", "UserAssigned", "SystemAssigned, UserAssigned". + :paramtype type: str or + ~service_fabric_managed_clusters_management_client.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, + ~service_fabric_managed_clusters_management_client.models.UserAssignedIdentity] + """ super(ManagedIdentity, self).__init__(**kwargs) self.principal_id = None self.tenant_id = None @@ -1507,8 +2115,8 @@ class ManagedProxyResource(msrest.serialization.Model): :vartype name: str :ivar type: Azure resource type. :vartype type: str - :param tags: A set of tags. Azure resource tags. - :type tags: dict[str, str] + :ivar tags: A set of tags. Azure resource tags. + :vartype tags: dict[str, str] :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~service_fabric_managed_clusters_management_client.models.SystemData """ @@ -1534,6 +2142,10 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Azure resource tags. + :paramtype tags: dict[str, str] + """ super(ManagedProxyResource, self).__init__(**kwargs) self.id = None self.name = None @@ -1542,6 +2154,83 @@ def __init__( self.system_data = None +class ManagedVMSize(msrest.serialization.Model): + """Describes a VM Sizes. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar properties: VM Size properties. + :vartype properties: ~service_fabric_managed_clusters_management_client.models.VMSize + :ivar id: VM Size id. + :vartype id: str + :ivar name: VM Size name. + :vartype name: str + :ivar type: VM Size type. + :vartype type: str + """ + + _validation = { + 'properties': {'readonly': True}, + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + } + + _attribute_map = { + 'properties': {'key': 'properties', 'type': 'VMSize'}, + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ManagedVMSize, self).__init__(**kwargs) + self.properties = None + self.id = None + self.name = None + self.type = None + + +class ManagedVMSizesResult(msrest.serialization.Model): + """Describes the result of the request to list Managed VM Sizes for Service Fabric Managed Clusters. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar value: List of Managed VM Sizes for Service Fabric Managed Clusters. + :vartype value: list[~service_fabric_managed_clusters_management_client.models.ManagedVMSize] + :ivar next_link: URL to get the next set of Managed VM Sizes if there are any. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ManagedVMSize]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["ManagedVMSize"]] = None, + **kwargs + ): + """ + :keyword value: List of Managed VM Sizes for Service Fabric Managed Clusters. + :paramtype value: list[~service_fabric_managed_clusters_management_client.models.ManagedVMSize] + """ + super(ManagedVMSizesResult, self).__init__(**kwargs) + self.value = value + self.next_link = None + + class Partition(msrest.serialization.Model): """Describes how the service is partitioned. @@ -1550,9 +2239,9 @@ class Partition(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: "Singleton", "UniformInt64Range", "Named". - :type partition_scheme: str or + :ivar partition_scheme: Required. Specifies how the service is partitioned.Constant filled by + server. Possible values include: "Singleton", "UniformInt64Range", "Named". + :vartype partition_scheme: str or ~service_fabric_managed_clusters_management_client.models.PartitionScheme """ @@ -1572,6 +2261,8 @@ def __init__( self, **kwargs ): + """ + """ super(Partition, self).__init__(**kwargs) self.partition_scheme = None # type: Optional[str] @@ -1581,12 +2272,12 @@ class NamedPartitionScheme(Partition): 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: "Singleton", "UniformInt64Range", "Named". - :type partition_scheme: str or + :ivar partition_scheme: Required. Specifies how the service is partitioned.Constant filled by + server. Possible values include: "Singleton", "UniformInt64Range", "Named". + :vartype partition_scheme: str or ~service_fabric_managed_clusters_management_client.models.PartitionScheme - :param names: Required. Array for the names of the partitions. - :type names: list[str] + :ivar names: Required. Array for the names of the partitions. + :vartype names: list[str] """ _validation = { @@ -1605,6 +2296,10 @@ def __init__( names: List[str], **kwargs ): + """ + :keyword names: Required. Array for the names of the partitions. + :paramtype names: list[str] + """ super(NamedPartitionScheme, self).__init__(**kwargs) self.partition_scheme = 'Named' # type: str self.names = names @@ -1615,33 +2310,47 @@ class NetworkSecurityRule(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. Network security rule name. - :type name: str - :param description: Network security rule description. - :type description: str - :param protocol: Required. Network protocol this rule applies to. Possible values include: + :ivar name: Required. Network security rule name. + :vartype name: str + :ivar description: Network security rule description. + :vartype description: str + :ivar protocol: Required. Network protocol this rule applies to. Possible values include: "http", "https", "tcp", "udp", "icmp", "ah", "esp". - :type protocol: str or ~service_fabric_managed_clusters_management_client.models.NsgProtocol - :param source_address_prefixes: The CIDR or source IP ranges. - :type source_address_prefixes: list[str] - :param destination_address_prefixes: The destination address prefixes. CIDR or destination IP + :vartype protocol: str or ~service_fabric_managed_clusters_management_client.models.NsgProtocol + :ivar source_address_prefixes: The CIDR or source IP ranges. + :vartype source_address_prefixes: list[str] + :ivar destination_address_prefixes: The destination address prefixes. CIDR or destination IP ranges. - :type destination_address_prefixes: list[str] - :param source_port_ranges: The source port ranges. - :type source_port_ranges: list[str] - :param destination_port_ranges: The destination port ranges. - :type destination_port_ranges: list[str] - :param access: Required. The network traffic is allowed or denied. Possible values include: + :vartype destination_address_prefixes: list[str] + :ivar source_port_ranges: The source port ranges. + :vartype source_port_ranges: list[str] + :ivar destination_port_ranges: The destination port ranges. + :vartype destination_port_ranges: list[str] + :ivar source_address_prefix: The CIDR or source IP range. Asterisk '*' can also be used to + match all source IPs. Default tags such as 'VirtualNetwork', 'AzureLoadBalancer' and 'Internet' + can also be used. If this is an ingress rule, specifies where network traffic originates from. + :vartype source_address_prefix: str + :ivar destination_address_prefix: The destination address prefix. CIDR or destination IP range. + Asterisk '*' can also be used to match all source IPs. Default tags such as 'VirtualNetwork', + 'AzureLoadBalancer' and 'Internet' can also be used. + :vartype destination_address_prefix: str + :ivar source_port_range: The source port or range. Integer or range between 0 and 65535. + Asterisk '*' can also be used to match all ports. + :vartype source_port_range: str + :ivar destination_port_range: he destination port or range. Integer or range between 0 and + 65535. Asterisk '*' can also be used to match all ports. + :vartype destination_port_range: str + :ivar access: Required. The network traffic is allowed or denied. Possible values include: "allow", "deny". - :type access: str or ~service_fabric_managed_clusters_management_client.models.Access - :param priority: Required. The priority of the rule. The value can be in the range 1000 to - 3000. Values outside this range are reserved for Service Fabric ManagerCluster Resource - Provider. The priority number must be unique for each rule in the collection. The lower the - priority number, the higher the priority of the rule. - :type priority: int - :param direction: Required. Network security rule direction. Possible values include: - "inbound", "outbound". - :type direction: str or ~service_fabric_managed_clusters_management_client.models.Direction + :vartype access: str or ~service_fabric_managed_clusters_management_client.models.Access + :ivar priority: Required. The priority of the rule. The value can be in the range 1000 to 3000. + Values outside this range are reserved for Service Fabric ManagerCluster Resource Provider. The + priority number must be unique for each rule in the collection. The lower the priority number, + the higher the priority of the rule. + :vartype priority: int + :ivar direction: Required. Network security rule direction. Possible values include: "inbound", + "outbound". + :vartype direction: str or ~service_fabric_managed_clusters_management_client.models.Direction """ _validation = { @@ -1660,6 +2369,10 @@ class NetworkSecurityRule(msrest.serialization.Model): 'destination_address_prefixes': {'key': 'destinationAddressPrefixes', 'type': '[str]'}, 'source_port_ranges': {'key': 'sourcePortRanges', 'type': '[str]'}, 'destination_port_ranges': {'key': 'destinationPortRanges', 'type': '[str]'}, + 'source_address_prefix': {'key': 'sourceAddressPrefix', 'type': 'str'}, + 'destination_address_prefix': {'key': 'destinationAddressPrefix', 'type': 'str'}, + 'source_port_range': {'key': 'sourcePortRange', 'type': 'str'}, + 'destination_port_range': {'key': 'destinationPortRange', 'type': 'str'}, 'access': {'key': 'access', 'type': 'str'}, 'priority': {'key': 'priority', 'type': 'int'}, 'direction': {'key': 'direction', 'type': 'str'}, @@ -1678,8 +2391,57 @@ def __init__( destination_address_prefixes: Optional[List[str]] = None, source_port_ranges: Optional[List[str]] = None, destination_port_ranges: Optional[List[str]] = None, + source_address_prefix: Optional[str] = None, + destination_address_prefix: Optional[str] = None, + source_port_range: Optional[str] = None, + destination_port_range: Optional[str] = None, **kwargs ): + """ + :keyword name: Required. Network security rule name. + :paramtype name: str + :keyword description: Network security rule description. + :paramtype description: str + :keyword protocol: Required. Network protocol this rule applies to. Possible values include: + "http", "https", "tcp", "udp", "icmp", "ah", "esp". + :paramtype protocol: str or + ~service_fabric_managed_clusters_management_client.models.NsgProtocol + :keyword source_address_prefixes: The CIDR or source IP ranges. + :paramtype source_address_prefixes: list[str] + :keyword destination_address_prefixes: The destination address prefixes. CIDR or destination IP + ranges. + :paramtype destination_address_prefixes: list[str] + :keyword source_port_ranges: The source port ranges. + :paramtype source_port_ranges: list[str] + :keyword destination_port_ranges: The destination port ranges. + :paramtype destination_port_ranges: list[str] + :keyword source_address_prefix: The CIDR or source IP range. Asterisk '*' can also be used to + match all source IPs. Default tags such as 'VirtualNetwork', 'AzureLoadBalancer' and 'Internet' + can also be used. If this is an ingress rule, specifies where network traffic originates from. + :paramtype source_address_prefix: str + :keyword destination_address_prefix: The destination address prefix. CIDR or destination IP + range. Asterisk '*' can also be used to match all source IPs. Default tags such as + 'VirtualNetwork', 'AzureLoadBalancer' and 'Internet' can also be used. + :paramtype destination_address_prefix: str + :keyword source_port_range: The source port or range. Integer or range between 0 and 65535. + Asterisk '*' can also be used to match all ports. + :paramtype source_port_range: str + :keyword destination_port_range: he destination port or range. Integer or range between 0 and + 65535. Asterisk '*' can also be used to match all ports. + :paramtype destination_port_range: str + :keyword access: Required. The network traffic is allowed or denied. Possible values include: + "allow", "deny". + :paramtype access: str or ~service_fabric_managed_clusters_management_client.models.Access + :keyword priority: Required. The priority of the rule. The value can be in the range 1000 to + 3000. Values outside this range are reserved for Service Fabric ManagerCluster Resource + Provider. The priority number must be unique for each rule in the collection. The lower the + priority number, the higher the priority of the rule. + :paramtype priority: int + :keyword direction: Required. Network security rule direction. Possible values include: + "inbound", "outbound". + :paramtype direction: str or + ~service_fabric_managed_clusters_management_client.models.Direction + """ super(NetworkSecurityRule, self).__init__(**kwargs) self.name = name self.description = description @@ -1688,6 +2450,10 @@ def __init__( self.destination_address_prefixes = destination_address_prefixes self.source_port_ranges = source_port_ranges self.destination_port_ranges = destination_port_ranges + self.source_address_prefix = source_address_prefix + self.destination_address_prefix = destination_address_prefix + self.source_port_range = source_port_range + self.destination_port_range = destination_port_range self.access = access self.priority = priority self.direction = direction @@ -1704,71 +2470,121 @@ class NodeType(ManagedProxyResource): :vartype name: str :ivar type: Azure resource type. :vartype type: str - :param tags: A set of tags. Azure resource tags. - :type tags: dict[str, str] + :ivar tags: A set of tags. Azure resource tags. + :vartype tags: dict[str, str] :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~service_fabric_managed_clusters_management_client.models.SystemData - :param is_primary: 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: The number of nodes in the node type. - :type vm_instance_count: int - :param data_disk_size_gb: Disk size for each vm in the node type in GBs. - :type data_disk_size_gb: int - :param data_disk_type: Managed data disk type. IOPS and throughput are given by the disk size, - to see more information go to - https://docs.microsoft.com/en-us/azure/virtual-machines/disks-types. Possible values include: - "Standard_LRS", "StandardSSD_LRS", "Premium_LRS". Default value: "StandardSSD_LRS". - :type data_disk_type: str or ~service_fabric_managed_clusters_management_client.models.DiskType - :param placement_properties: The placement tags applied to nodes in the node type, which can be + :ivar sku: The node type sku. + :vartype sku: ~service_fabric_managed_clusters_management_client.models.NodeTypeSku + :ivar is_primary: Indicates the Service Fabric system services for the cluster will run on this + node type. This setting cannot be changed once the node type is created. + :vartype is_primary: bool + :ivar vm_instance_count: The number of nodes in the node type. :code:`
`:code:`
`\ + **Values:** :code:`
`-1 - Use when auto scale rules are configured or sku.capacity is + defined :code:`
` 0 - Not supported :code:`
` >0 - Use for manual scale. + :vartype vm_instance_count: int + :ivar data_disk_size_gb: Disk size for the managed disk attached to the vms on the node type in + GBs. + :vartype data_disk_size_gb: int + :ivar data_disk_type: Managed data disk type. Specifies the storage account type for the + managed disk. Possible values include: "Standard_LRS", "StandardSSD_LRS", "Premium_LRS". + Default value: "StandardSSD_LRS". + :vartype data_disk_type: str or + ~service_fabric_managed_clusters_management_client.models.DiskType + :ivar data_disk_letter: Managed data disk letter. It can not use the reserved letter C or D and + it can not change after created. + :vartype data_disk_letter: 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 application_ports: The range of ports from which cluster assigned port to Service Fabric + :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 application_ports: The range of ports from which cluster assigned port to Service Fabric applications. - :type application_ports: + :vartype application_ports: ~service_fabric_managed_clusters_management_client.models.EndpointRangeDescription - :param ephemeral_ports: The range of ephemeral ports that nodes in this node type should be + :ivar ephemeral_ports: The range of ephemeral ports that nodes in this node type should be configured with. - :type ephemeral_ports: + :vartype ephemeral_ports: ~service_fabric_managed_clusters_management_client.models.EndpointRangeDescription - :param vm_size: The size of virtual machines in the pool. All virtual machines in a pool are - the same size. For example, Standard_D3. - :type vm_size: str - :param vm_image_publisher: The publisher of the Azure Virtual Machines Marketplace image. For + :ivar vm_size: The size of virtual machines in the pool. All virtual machines in a pool are the + same size. For example, Standard_D3. + :vartype vm_size: str + :ivar vm_image_publisher: The publisher of the Azure Virtual Machines Marketplace image. For example, Canonical or MicrosoftWindowsServer. - :type vm_image_publisher: str - :param vm_image_offer: The offer type of the Azure Virtual Machines Marketplace image. For + :vartype vm_image_publisher: str + :ivar vm_image_offer: The offer type of the Azure Virtual Machines Marketplace image. For example, UbuntuServer or WindowsServer. - :type vm_image_offer: str - :param vm_image_sku: The SKU of the Azure Virtual Machines Marketplace image. For example, + :vartype vm_image_offer: str + :ivar vm_image_sku: The SKU of the Azure Virtual Machines Marketplace image. For example, 14.04.0-LTS or 2012-R2-Datacenter. - :type vm_image_sku: str - :param vm_image_version: The version of the Azure Virtual Machines Marketplace image. A value - of 'latest' can be specified to select the latest version of an image. If omitted, the default - is 'latest'. - :type vm_image_version: str - :param vm_secrets: The secrets to install in the virtual machines. - :type vm_secrets: + :vartype vm_image_sku: str + :ivar vm_image_version: The version of the Azure Virtual Machines Marketplace image. A value of + 'latest' can be specified to select the latest version of an image. If omitted, the default is + 'latest'. + :vartype vm_image_version: str + :ivar vm_secrets: The secrets to install in the virtual machines. + :vartype vm_secrets: list[~service_fabric_managed_clusters_management_client.models.VaultSecretGroup] - :param vm_extensions: Set of extensions that should be installed onto the virtual machines. - :type vm_extensions: + :ivar vm_extensions: Set of extensions that should be installed onto the virtual machines. + :vartype vm_extensions: list[~service_fabric_managed_clusters_management_client.models.VMSSExtension] - :param vm_managed_identity: Identities for the virtual machine scale set under the node type. - :type vm_managed_identity: + :ivar vm_managed_identity: Identities to assign to the virtual machine scale set under the node + type. + :vartype vm_managed_identity: ~service_fabric_managed_clusters_management_client.models.VmManagedIdentity - :param is_stateless: Indicates if the node type can only host Stateless workloads. - :type is_stateless: bool - :param multiple_placement_groups: Indicates if scale set associated with the node type can be + :ivar is_stateless: Indicates if the node type can only host Stateless workloads. + :vartype is_stateless: bool + :ivar multiple_placement_groups: Indicates if scale set associated with the node type can be composed of multiple placement groups. - :type multiple_placement_groups: bool - :ivar provisioning_state: The provisioning state of the managed cluster resource. Possible - values include: "None", "Creating", "Created", "Updating", "Succeeded", "Failed", "Canceled", + :vartype multiple_placement_groups: bool + :ivar frontend_configurations: Indicates the node type uses its own frontend configurations + instead of the default one for the cluster. This setting can only be specified for non-primary + node types and can not be added or removed after the node type is created. + :vartype frontend_configurations: + list[~service_fabric_managed_clusters_management_client.models.FrontendConfiguration] + :ivar network_security_rules: The Network Security Rules for this node type. This setting can + only be specified for node types that are configured with frontend configurations. + :vartype network_security_rules: + list[~service_fabric_managed_clusters_management_client.models.NetworkSecurityRule] + :ivar additional_data_disks: Additional managed data disks. + :vartype additional_data_disks: + list[~service_fabric_managed_clusters_management_client.models.VmssDataDisk] + :ivar enable_encryption_at_host: Enable or disable the Host Encryption for the virtual machines + on the node type. This will enable the encryption for all the disks including Resource/Temp + disk at host itself. Default: The Encryption at host will be disabled unless this property is + set to true for the resource. + :vartype enable_encryption_at_host: bool + :ivar provisioning_state: The provisioning state of the node type resource. Possible values + include: "None", "Creating", "Created", "Updating", "Succeeded", "Failed", "Canceled", "Deleting", "Deleted", "Other". :vartype provisioning_state: str or ~service_fabric_managed_clusters_management_client.models.ManagedResourceProvisioningState + :ivar enable_accelerated_networking: Specifies whether the network interface is accelerated + networking-enabled. + :vartype enable_accelerated_networking: bool + :ivar use_default_public_load_balancer: Specifies whether the use public load balancer. If not + specified and the node type doesn't have its own frontend configuration, it will be attached to + the default load balancer. If the node type uses its own Load balancer and + useDefaultPublicLoadBalancer is true, then the frontend has to be an Internal Load Balancer. If + the node type uses its own Load balancer and useDefaultPublicLoadBalancer is false or not set, + then the custom load balancer must include a public load balancer to provide outbound + connectivity. + :vartype use_default_public_load_balancer: bool + :ivar use_temp_data_disk: Specifies whether to use the temporary disk for the service fabric + data root, in which case no managed data disk will be attached and the temporary disk will be + used. It is only allowed for stateless node types. + :vartype use_temp_data_disk: bool + :ivar enable_over_provisioning: Specifies whether the node type should be overprovisioned. It + is only allowed for stateless node types. + :vartype enable_over_provisioning: bool + :ivar zones: Specifies the availability zones where the node type would span across. If the + cluster is not spanning across availability zones, initiates az migration for the cluster. + :vartype zones: list[str] + :ivar is_spot_priority: Indicates whether the node type will be Spot Virtual Machines. Azure + will allocate the VMs if there is capacity available and the VMs can be evicted at any time. + :vartype is_spot_priority: bool """ _validation = { @@ -1776,7 +2592,8 @@ class NodeType(ManagedProxyResource): 'name': {'readonly': True}, 'type': {'readonly': True}, 'system_data': {'readonly': True}, - 'vm_instance_count': {'maximum': 2147483647, 'minimum': 1}, + 'vm_instance_count': {'maximum': 2147483647, 'minimum': -1}, + 'data_disk_letter': {'pattern': r'^[a-zA-Z]{1}$'}, 'provisioning_state': {'readonly': True}, } @@ -1786,10 +2603,12 @@ class NodeType(ManagedProxyResource): 'type': {'key': 'type', 'type': 'str'}, 'tags': {'key': 'tags', 'type': '{str}'}, 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'sku': {'key': 'sku', 'type': 'NodeTypeSku'}, 'is_primary': {'key': 'properties.isPrimary', 'type': 'bool'}, 'vm_instance_count': {'key': 'properties.vmInstanceCount', 'type': 'int'}, 'data_disk_size_gb': {'key': 'properties.dataDiskSizeGB', 'type': 'int'}, 'data_disk_type': {'key': 'properties.dataDiskType', 'type': 'str'}, + 'data_disk_letter': {'key': 'properties.dataDiskLetter', 'type': 'str'}, 'placement_properties': {'key': 'properties.placementProperties', 'type': '{str}'}, 'capacities': {'key': 'properties.capacities', 'type': '{str}'}, 'application_ports': {'key': 'properties.applicationPorts', 'type': 'EndpointRangeDescription'}, @@ -1804,17 +2623,29 @@ class NodeType(ManagedProxyResource): 'vm_managed_identity': {'key': 'properties.vmManagedIdentity', 'type': 'VmManagedIdentity'}, 'is_stateless': {'key': 'properties.isStateless', 'type': 'bool'}, 'multiple_placement_groups': {'key': 'properties.multiplePlacementGroups', 'type': 'bool'}, + 'frontend_configurations': {'key': 'properties.frontendConfigurations', 'type': '[FrontendConfiguration]'}, + 'network_security_rules': {'key': 'properties.networkSecurityRules', 'type': '[NetworkSecurityRule]'}, + 'additional_data_disks': {'key': 'properties.additionalDataDisks', 'type': '[VmssDataDisk]'}, + 'enable_encryption_at_host': {'key': 'properties.enableEncryptionAtHost', 'type': 'bool'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'enable_accelerated_networking': {'key': 'properties.enableAcceleratedNetworking', 'type': 'bool'}, + 'use_default_public_load_balancer': {'key': 'properties.useDefaultPublicLoadBalancer', 'type': 'bool'}, + 'use_temp_data_disk': {'key': 'properties.useTempDataDisk', 'type': 'bool'}, + 'enable_over_provisioning': {'key': 'properties.enableOverProvisioning', 'type': 'bool'}, + 'zones': {'key': 'properties.zones', 'type': '[str]'}, + 'is_spot_priority': {'key': 'properties.isSpotPriority', 'type': 'bool'}, } def __init__( self, *, tags: Optional[Dict[str, str]] = None, + sku: Optional["NodeTypeSku"] = None, is_primary: Optional[bool] = None, vm_instance_count: Optional[int] = None, data_disk_size_gb: Optional[int] = None, data_disk_type: Optional[Union[str, "DiskType"]] = "StandardSSD_LRS", + data_disk_letter: Optional[str] = None, placement_properties: Optional[Dict[str, str]] = None, capacities: Optional[Dict[str, str]] = None, application_ports: Optional["EndpointRangeDescription"] = None, @@ -1829,13 +2660,135 @@ def __init__( vm_managed_identity: Optional["VmManagedIdentity"] = None, is_stateless: Optional[bool] = False, multiple_placement_groups: Optional[bool] = False, + frontend_configurations: Optional[List["FrontendConfiguration"]] = None, + network_security_rules: Optional[List["NetworkSecurityRule"]] = None, + additional_data_disks: Optional[List["VmssDataDisk"]] = None, + enable_encryption_at_host: Optional[bool] = False, + enable_accelerated_networking: Optional[bool] = None, + use_default_public_load_balancer: Optional[bool] = None, + use_temp_data_disk: Optional[bool] = None, + enable_over_provisioning: Optional[bool] = None, + zones: Optional[List[str]] = None, + is_spot_priority: Optional[bool] = None, **kwargs ): + """ + :keyword tags: A set of tags. Azure resource tags. + :paramtype tags: dict[str, str] + :keyword sku: The node type sku. + :paramtype sku: ~service_fabric_managed_clusters_management_client.models.NodeTypeSku + :keyword is_primary: Indicates the Service Fabric system services for the cluster will run on + this node type. This setting cannot be changed once the node type is created. + :paramtype is_primary: bool + :keyword vm_instance_count: The number of nodes in the node type. :code:`
`:code:`
`\ + **Values:** :code:`
`-1 - Use when auto scale rules are configured or sku.capacity is + defined :code:`
` 0 - Not supported :code:`
` >0 - Use for manual scale. + :paramtype vm_instance_count: int + :keyword data_disk_size_gb: Disk size for the managed disk attached to the vms on the node type + in GBs. + :paramtype data_disk_size_gb: int + :keyword data_disk_type: Managed data disk type. Specifies the storage account type for the + managed disk. Possible values include: "Standard_LRS", "StandardSSD_LRS", "Premium_LRS". + Default value: "StandardSSD_LRS". + :paramtype data_disk_type: str or + ~service_fabric_managed_clusters_management_client.models.DiskType + :keyword data_disk_letter: Managed data disk letter. It can not use the reserved letter C or D + and it can not change after created. + :paramtype data_disk_letter: 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 application_ports: The range of ports from which cluster assigned port to Service + Fabric applications. + :paramtype application_ports: + ~service_fabric_managed_clusters_management_client.models.EndpointRangeDescription + :keyword ephemeral_ports: The range of ephemeral ports that nodes in this node type should be + configured with. + :paramtype ephemeral_ports: + ~service_fabric_managed_clusters_management_client.models.EndpointRangeDescription + :keyword vm_size: The size of virtual machines in the pool. All virtual machines in a pool are + the same size. For example, Standard_D3. + :paramtype vm_size: str + :keyword vm_image_publisher: The publisher of the Azure Virtual Machines Marketplace image. For + example, Canonical or MicrosoftWindowsServer. + :paramtype vm_image_publisher: str + :keyword vm_image_offer: The offer type of the Azure Virtual Machines Marketplace image. For + example, UbuntuServer or WindowsServer. + :paramtype vm_image_offer: str + :keyword vm_image_sku: The SKU of the Azure Virtual Machines Marketplace image. For example, + 14.04.0-LTS or 2012-R2-Datacenter. + :paramtype vm_image_sku: str + :keyword vm_image_version: The version of the Azure Virtual Machines Marketplace image. A value + of 'latest' can be specified to select the latest version of an image. If omitted, the default + is 'latest'. + :paramtype vm_image_version: str + :keyword vm_secrets: The secrets to install in the virtual machines. + :paramtype vm_secrets: + list[~service_fabric_managed_clusters_management_client.models.VaultSecretGroup] + :keyword vm_extensions: Set of extensions that should be installed onto the virtual machines. + :paramtype vm_extensions: + list[~service_fabric_managed_clusters_management_client.models.VMSSExtension] + :keyword vm_managed_identity: Identities to assign to the virtual machine scale set under the + node type. + :paramtype vm_managed_identity: + ~service_fabric_managed_clusters_management_client.models.VmManagedIdentity + :keyword is_stateless: Indicates if the node type can only host Stateless workloads. + :paramtype is_stateless: bool + :keyword multiple_placement_groups: Indicates if scale set associated with the node type can be + composed of multiple placement groups. + :paramtype multiple_placement_groups: bool + :keyword frontend_configurations: Indicates the node type uses its own frontend configurations + instead of the default one for the cluster. This setting can only be specified for non-primary + node types and can not be added or removed after the node type is created. + :paramtype frontend_configurations: + list[~service_fabric_managed_clusters_management_client.models.FrontendConfiguration] + :keyword network_security_rules: The Network Security Rules for this node type. This setting + can only be specified for node types that are configured with frontend configurations. + :paramtype network_security_rules: + list[~service_fabric_managed_clusters_management_client.models.NetworkSecurityRule] + :keyword additional_data_disks: Additional managed data disks. + :paramtype additional_data_disks: + list[~service_fabric_managed_clusters_management_client.models.VmssDataDisk] + :keyword enable_encryption_at_host: Enable or disable the Host Encryption for the virtual + machines on the node type. This will enable the encryption for all the disks including + Resource/Temp disk at host itself. Default: The Encryption at host will be disabled unless this + property is set to true for the resource. + :paramtype enable_encryption_at_host: bool + :keyword enable_accelerated_networking: Specifies whether the network interface is accelerated + networking-enabled. + :paramtype enable_accelerated_networking: bool + :keyword use_default_public_load_balancer: Specifies whether the use public load balancer. If + not specified and the node type doesn't have its own frontend configuration, it will be + attached to the default load balancer. If the node type uses its own Load balancer and + useDefaultPublicLoadBalancer is true, then the frontend has to be an Internal Load Balancer. If + the node type uses its own Load balancer and useDefaultPublicLoadBalancer is false or not set, + then the custom load balancer must include a public load balancer to provide outbound + connectivity. + :paramtype use_default_public_load_balancer: bool + :keyword use_temp_data_disk: Specifies whether to use the temporary disk for the service fabric + data root, in which case no managed data disk will be attached and the temporary disk will be + used. It is only allowed for stateless node types. + :paramtype use_temp_data_disk: bool + :keyword enable_over_provisioning: Specifies whether the node type should be overprovisioned. + It is only allowed for stateless node types. + :paramtype enable_over_provisioning: bool + :keyword zones: Specifies the availability zones where the node type would span across. If the + cluster is not spanning across availability zones, initiates az migration for the cluster. + :paramtype zones: list[str] + :keyword is_spot_priority: Indicates whether the node type will be Spot Virtual Machines. Azure + will allocate the VMs if there is capacity available and the VMs can be evicted at any time. + :paramtype is_spot_priority: bool + """ super(NodeType, self).__init__(tags=tags, **kwargs) + self.sku = sku self.is_primary = is_primary self.vm_instance_count = vm_instance_count self.data_disk_size_gb = data_disk_size_gb self.data_disk_type = data_disk_type + self.data_disk_letter = data_disk_letter self.placement_properties = placement_properties self.capacities = capacities self.application_ports = application_ports @@ -1850,7 +2803,17 @@ def __init__( self.vm_managed_identity = vm_managed_identity self.is_stateless = is_stateless self.multiple_placement_groups = multiple_placement_groups + self.frontend_configurations = frontend_configurations + self.network_security_rules = network_security_rules + self.additional_data_disks = additional_data_disks + self.enable_encryption_at_host = enable_encryption_at_host self.provisioning_state = None + self.enable_accelerated_networking = enable_accelerated_networking + self.use_default_public_load_balancer = use_default_public_load_balancer + self.use_temp_data_disk = use_temp_data_disk + self.enable_over_provisioning = enable_over_provisioning + self.zones = zones + self.is_spot_priority = is_spot_priority class NodeTypeActionParameters(msrest.serialization.Model): @@ -1858,10 +2821,10 @@ class NodeTypeActionParameters(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param nodes: Required. List of node names from the node type. - :type nodes: list[str] - :param force: Force the action to go through. - :type force: bool + :ivar nodes: Required. List of node names from the node type. + :vartype nodes: list[str] + :ivar force: Force the action to go through. + :vartype force: bool """ _validation = { @@ -1880,18 +2843,63 @@ def __init__( force: Optional[bool] = None, **kwargs ): + """ + :keyword nodes: Required. List of node names from the node type. + :paramtype nodes: list[str] + :keyword force: Force the action to go through. + :paramtype force: bool + """ super(NodeTypeActionParameters, self).__init__(**kwargs) self.nodes = nodes self.force = force +class NodeTypeAvailableSku(msrest.serialization.Model): + """Defines the type of sku available for a node type. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar resource_type: The type of resource the sku applies to. :code:`
`:code:`
`Value: Microsoft.ServiceFabric/managedClusters/nodeTypes. + :vartype resource_type: str + :ivar sku: The supported SKU for a for node type. + :vartype sku: ~service_fabric_managed_clusters_management_client.models.NodeTypeSupportedSku + :ivar capacity: Provides information about how the node count can be scaled. + :vartype capacity: + ~service_fabric_managed_clusters_management_client.models.NodeTypeSkuCapacity + """ + + _validation = { + 'resource_type': {'readonly': True}, + 'sku': {'readonly': True}, + 'capacity': {'readonly': True}, + } + + _attribute_map = { + 'resource_type': {'key': 'resourceType', 'type': 'str'}, + 'sku': {'key': 'sku', 'type': 'NodeTypeSupportedSku'}, + 'capacity': {'key': 'capacity', 'type': 'NodeTypeSkuCapacity'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(NodeTypeAvailableSku, self).__init__(**kwargs) + self.resource_type = None + self.sku = None + self.capacity = None + + class NodeTypeListResult(msrest.serialization.Model): """Node type list results. - :param value: The list of node types. - :type value: list[~service_fabric_managed_clusters_management_client.models.NodeType] - :param next_link: The URL to use for getting the next set of results. - :type next_link: str + :ivar value: The list of node types. + :vartype value: list[~service_fabric_managed_clusters_management_client.models.NodeType] + :ivar next_link: The URL to use for getting the next set of results. + :vartype next_link: str """ _attribute_map = { @@ -1906,30 +2914,211 @@ def __init__( next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: The list of node types. + :paramtype value: list[~service_fabric_managed_clusters_management_client.models.NodeType] + :keyword next_link: The URL to use for getting the next set of results. + :paramtype next_link: str + """ super(NodeTypeListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link +class NodeTypeListSkuResult(msrest.serialization.Model): + """Node type available sku list results. + + :ivar value: The list of available node type SKUs. + :vartype value: + list[~service_fabric_managed_clusters_management_client.models.NodeTypeAvailableSku] + :ivar next_link: The URL to use for getting the next set of results. + :vartype next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[NodeTypeAvailableSku]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["NodeTypeAvailableSku"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + """ + :keyword value: The list of available node type SKUs. + :paramtype value: + list[~service_fabric_managed_clusters_management_client.models.NodeTypeAvailableSku] + :keyword next_link: The URL to use for getting the next set of results. + :paramtype next_link: str + """ + super(NodeTypeListSkuResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class NodeTypeSku(msrest.serialization.Model): + """Describes a node type sku. + + All required parameters must be populated in order to send to Azure. + + :ivar name: The sku name. :code:`
`:code:`
`Name is internally generated and is used + in auto-scale scenarios.:code:`
` Property does not allow to be changed to other values + than generated.:code:`
` To avoid deployment errors please omit the property. + :vartype name: str + :ivar tier: Specifies the tier of the node type. :code:`
`:code:`
` Possible + Values::code:`
` **Standard**. + :vartype tier: str + :ivar capacity: Required. The number of nodes in the node type.:code:`
`:code:`
`If + present in request it will override properties.vmInstanceCount. + :vartype capacity: int + """ + + _validation = { + 'capacity': {'required': True, 'maximum': 2147483647, 'minimum': 1}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, + 'capacity': {'key': 'capacity', 'type': 'int'}, + } + + def __init__( + self, + *, + capacity: int, + name: Optional[str] = None, + tier: Optional[str] = None, + **kwargs + ): + """ + :keyword name: The sku name. :code:`
`:code:`
`Name is internally generated and is + used in auto-scale scenarios.:code:`
` Property does not allow to be changed to other + values than generated.:code:`
` To avoid deployment errors please omit the property. + :paramtype name: str + :keyword tier: Specifies the tier of the node type. :code:`
`:code:`
` Possible + Values::code:`
` **Standard**. + :paramtype tier: str + :keyword capacity: Required. The number of nodes in the node type.:code:`
`:code:`
`If present in request it will override properties.vmInstanceCount. + :paramtype capacity: int + """ + super(NodeTypeSku, self).__init__(**kwargs) + self.name = name + self.tier = tier + self.capacity = capacity + + +class NodeTypeSkuCapacity(msrest.serialization.Model): + """Provides information about how node type can be scaled. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar minimum: Lowest permitted node count in a node type. + :vartype minimum: int + :ivar maximum: Highest permitted node count in a node type. + :vartype maximum: int + :ivar default: Default node count in a node type. + :vartype default: int + :ivar scale_type: Node type capacity scale type. Possible values include: "None", "Manual", + "Automatic". Default value: "None". + :vartype scale_type: str or + ~service_fabric_managed_clusters_management_client.models.NodeTypeSkuScaleType + """ + + _validation = { + 'minimum': {'readonly': True}, + 'maximum': {'readonly': True}, + 'default': {'readonly': True}, + 'scale_type': {'readonly': True}, + } + + _attribute_map = { + 'minimum': {'key': 'minimum', 'type': 'int'}, + 'maximum': {'key': 'maximum', 'type': 'int'}, + 'default': {'key': 'default', 'type': 'int'}, + 'scale_type': {'key': 'scaleType', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(NodeTypeSkuCapacity, self).__init__(**kwargs) + self.minimum = None + self.maximum = None + self.default = None + self.scale_type = None + + +class NodeTypeSupportedSku(msrest.serialization.Model): + """Describes a node type supported sku. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar name: The sku name. + :vartype name: str + :ivar tier: Specifies the tier of the node type. :code:`
`:code:`
` Possible + Values::code:`
` **Standard**. + :vartype tier: str + """ + + _validation = { + 'name': {'readonly': True}, + 'tier': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'tier': {'key': 'tier', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(NodeTypeSupportedSku, self).__init__(**kwargs) + self.name = None + self.tier = None + + class NodeTypeUpdateParameters(msrest.serialization.Model): """Node type update request. - :param tags: A set of tags. Node type update parameters. - :type tags: dict[str, str] + :ivar tags: A set of tags. Node type update parameters. + :vartype tags: dict[str, str] + :ivar sku: The node type sku. + :vartype sku: ~service_fabric_managed_clusters_management_client.models.NodeTypeSku """ _attribute_map = { 'tags': {'key': 'tags', 'type': '{str}'}, + 'sku': {'key': 'sku', 'type': 'NodeTypeSku'}, } def __init__( self, *, tags: Optional[Dict[str, str]] = None, + sku: Optional["NodeTypeSku"] = None, **kwargs ): + """ + :keyword tags: A set of tags. Node type update parameters. + :paramtype tags: dict[str, str] + :keyword sku: The node type sku. + :paramtype sku: ~service_fabric_managed_clusters_management_client.models.NodeTypeSku + """ super(NodeTypeUpdateParameters, self).__init__(**kwargs) self.tags = tags + self.sku = sku class OperationListResult(msrest.serialization.Model): @@ -1937,8 +3126,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[~service_fabric_managed_clusters_management_client.models.OperationResult] + :ivar value: List of operations supported by the Service Fabric resource provider. + :vartype value: list[~service_fabric_managed_clusters_management_client.models.OperationResult] :ivar next_link: URL to get the next set of operation list results if there are any. :vartype next_link: str """ @@ -1958,6 +3147,11 @@ def __init__( value: Optional[List["OperationResult"]] = None, **kwargs ): + """ + :keyword value: List of operations supported by the Service Fabric resource provider. + :paramtype value: + list[~service_fabric_managed_clusters_management_client.models.OperationResult] + """ super(OperationListResult, self).__init__(**kwargs) self.value = value self.next_link = None @@ -1966,17 +3160,17 @@ 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: + :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: ~service_fabric_managed_clusters_management_client.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 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 = { @@ -1997,6 +3191,19 @@ 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: + ~service_fabric_managed_clusters_management_client.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 @@ -2010,18 +3217,18 @@ class PartitionInstanceCountScaleMechanism(ScalingMechanism): All required parameters must be populated in order to send to Azure. - :param kind: Required. Specifies the mechanism associated with this scaling policy.Constant - filled by server. Possible values include: "ScalePartitionInstanceCount", + :ivar kind: Required. Specifies the mechanism associated with this scaling policy.Constant + filled by server. Possible values include: "ScalePartitionInstanceCount", "AddRemoveIncrementalNamedPartition". - :type kind: str or + :vartype kind: str or ~service_fabric_managed_clusters_management_client.models.ServiceScalingMechanismKind - :param min_instance_count: Required. Minimum number of instances of the partition. - :type min_instance_count: int - :param max_instance_count: Required. Maximum number of instances of the partition. - :type max_instance_count: int - :param scale_increment: Required. The number of instances to add or remove during a scaling + :ivar min_instance_count: Required. Minimum number of instances of the partition. + :vartype min_instance_count: int + :ivar max_instance_count: Required. Maximum number of instances of the partition. + :vartype max_instance_count: int + :ivar scale_increment: Required. The number of instances to add or remove during a scaling operation. - :type scale_increment: int + :vartype scale_increment: int """ _validation = { @@ -2046,6 +3253,15 @@ def __init__( scale_increment: int, **kwargs ): + """ + :keyword min_instance_count: Required. Minimum number of instances of the partition. + :paramtype min_instance_count: int + :keyword max_instance_count: Required. Maximum number of instances of the partition. + :paramtype max_instance_count: int + :keyword scale_increment: Required. The number of instances to add or remove during a scaling + operation. + :paramtype scale_increment: int + """ super(PartitionInstanceCountScaleMechanism, self).__init__(**kwargs) self.kind = 'ScalePartitionInstanceCount' # type: str self.min_instance_count = min_instance_count @@ -2053,38 +3269,75 @@ def __init__( self.scale_increment = scale_increment +class ResourceAzStatus(msrest.serialization.Model): + """Describes Az Resiliency status of Base resources. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar resource_name: VM Size properties. + :vartype resource_name: str + :ivar resource_type: VM Size id. + :vartype resource_type: str + :ivar is_zone_resilient: VM Size name. + :vartype is_zone_resilient: bool + """ + + _validation = { + 'resource_name': {'readonly': True}, + 'resource_type': {'readonly': True}, + 'is_zone_resilient': {'readonly': True}, + } + + _attribute_map = { + 'resource_name': {'key': 'resourceName', 'type': 'str'}, + 'resource_type': {'key': 'resourceType', 'type': 'str'}, + 'is_zone_resilient': {'key': 'isZoneResilient', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(ResourceAzStatus, self).__init__(**kwargs) + self.resource_name = None + self.resource_type = None + self.is_zone_resilient = None + + class RollingUpgradeMonitoringPolicy(msrest.serialization.Model): """The policy used for monitoring the application upgrade. All required parameters must be populated in order to send to Azure. - :param failure_action: Required. The compensating action to perform when a Monitored upgrade + :ivar failure_action: Required. The compensating action to perform when a Monitored upgrade encounters monitoring policy or health policy violations. Invalid indicates the failure action is invalid. Rollback specifies that the upgrade will start rolling back automatically. Manual indicates that the upgrade will switch to UnmonitoredManual upgrade mode. Possible values include: "Rollback", "Manual". - :type failure_action: str or + :vartype failure_action: str or ~service_fabric_managed_clusters_management_client.models.FailureAction - :param health_check_wait_duration: Required. The amount of time to wait after completing an + :ivar health_check_wait_duration: Required. The amount of time to wait after completing an upgrade domain before applying health policies. It is interpreted as a string representing an ISO 8601 duration with following format "hh:mm:ss.fff". - :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. It is interpreted as a string representing an ISO 8601 duration with following format "hh:mm:ss.fff". - :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 FailureAction is executed. It is interpreted as a string representing an ISO 8601 duration with following format "hh:mm:ss.fff". - :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 FailureAction is executed. Cannot be larger than 12 hours. It is interpreted as a string representing an ISO 8601 duration with following format "hh:mm:ss.fff". - :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 FailureAction is executed. Cannot be larger than 12 hours. It is interpreted as a string representing an ISO 8601 duration with following format "hh:mm:ss.fff". - :type upgrade_domain_timeout: str + :vartype upgrade_domain_timeout: str """ _validation = { @@ -2116,6 +3369,35 @@ def __init__( upgrade_domain_timeout: str, **kwargs ): + """ + :keyword failure_action: Required. The compensating action to perform when a Monitored upgrade + encounters monitoring policy or health policy violations. Invalid indicates the failure action + is invalid. Rollback specifies that the upgrade will start rolling back automatically. Manual + indicates that the upgrade will switch to UnmonitoredManual upgrade mode. Possible values + include: "Rollback", "Manual". + :paramtype failure_action: str or + ~service_fabric_managed_clusters_management_client.models.FailureAction + :keyword health_check_wait_duration: Required. The amount of time to wait after completing an + upgrade domain before applying health policies. It is interpreted as a string representing an + ISO 8601 duration with following format "hh:mm:ss.fff". + :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. It is + interpreted as a string representing an ISO 8601 duration with following format "hh:mm:ss.fff". + :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 FailureAction is executed. It is + interpreted as a string representing an ISO 8601 duration with following format "hh:mm:ss.fff". + :paramtype health_check_retry_timeout: str + :keyword upgrade_timeout: Required. The amount of time the overall upgrade has to complete + before FailureAction is executed. Cannot be larger than 12 hours. It is interpreted as a string + representing an ISO 8601 duration with following format "hh:mm:ss.fff". + :paramtype upgrade_timeout: str + :keyword upgrade_domain_timeout: Required. The amount of time each upgrade domain has to + complete before FailureAction is executed. Cannot be larger than 12 hours. It is interpreted as + a string representing an ISO 8601 duration with following format "hh:mm:ss.fff". + :paramtype upgrade_domain_timeout: str + """ super(RollingUpgradeMonitoringPolicy, self).__init__(**kwargs) self.failure_action = failure_action self.health_check_wait_duration = health_check_wait_duration @@ -2130,12 +3412,12 @@ class ScalingPolicy(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param scaling_mechanism: Required. Specifies the mechanism associated with this scaling - policy. - :type scaling_mechanism: + :ivar scaling_mechanism: Required. Specifies the mechanism associated with this scaling policy. + :vartype scaling_mechanism: ~service_fabric_managed_clusters_management_client.models.ScalingMechanism - :param scaling_trigger: Required. Specifies the trigger associated with this scaling policy. - :type scaling_trigger: ~service_fabric_managed_clusters_management_client.models.ScalingTrigger + :ivar scaling_trigger: Required. Specifies the trigger associated with this scaling policy. + :vartype scaling_trigger: + ~service_fabric_managed_clusters_management_client.models.ScalingTrigger """ _validation = { @@ -2155,6 +3437,15 @@ def __init__( scaling_trigger: "ScalingTrigger", **kwargs ): + """ + :keyword scaling_mechanism: Required. Specifies the mechanism associated with this scaling + policy. + :paramtype scaling_mechanism: + ~service_fabric_managed_clusters_management_client.models.ScalingMechanism + :keyword scaling_trigger: Required. Specifies the trigger associated with this scaling policy. + :paramtype scaling_trigger: + ~service_fabric_managed_clusters_management_client.models.ScalingTrigger + """ super(ScalingPolicy, self).__init__(**kwargs) self.scaling_mechanism = scaling_mechanism self.scaling_trigger = scaling_trigger @@ -2165,14 +3456,14 @@ class ServiceCorrelation(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: "AlignedAffinity", "NonAlignedAffinity". - :type scheme: str or + :vartype scheme: str or ~service_fabric_managed_clusters_management_client.models.ServiceCorrelationScheme - :param service_name: Required. The Arm Resource ID of the service that the correlation + :ivar service_name: Required. The Arm Resource ID of the service that the correlation relationship is established with. - :type service_name: str + :vartype service_name: str """ _validation = { @@ -2192,33 +3483,81 @@ 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: + "AlignedAffinity", "NonAlignedAffinity". + :paramtype scheme: str or + ~service_fabric_managed_clusters_management_client.models.ServiceCorrelationScheme + :keyword service_name: Required. The Arm Resource ID of the service that the correlation + relationship is established with. + :paramtype service_name: str + """ super(ServiceCorrelation, self).__init__(**kwargs) self.scheme = scheme self.service_name = service_name +class ServiceEndpoint(msrest.serialization.Model): + """The service endpoint properties. + + All required parameters must be populated in order to send to Azure. + + :ivar service: Required. The type of the endpoint service. + :vartype service: str + :ivar locations: A list of locations. + :vartype locations: list[str] + """ + + _validation = { + 'service': {'required': True}, + } + + _attribute_map = { + 'service': {'key': 'service', 'type': 'str'}, + 'locations': {'key': 'locations', 'type': '[str]'}, + } + + def __init__( + self, + *, + service: str, + locations: Optional[List[str]] = None, + **kwargs + ): + """ + :keyword service: Required. The type of the endpoint service. + :paramtype service: str + :keyword locations: A list of locations. + :paramtype locations: list[str] + """ + super(ServiceEndpoint, self).__init__(**kwargs) + self.service = service + self.locations = locations + + class ServiceLoadMetric(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 + :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 + :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 ~service_fabric_managed_clusters_management_client.models.ServiceLoadMetricWeight - :param primary_default_load: Used only for Stateful services. The default amount of load, as a + :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 = { @@ -2243,6 +3582,25 @@ 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 + ~service_fabric_managed_clusters_management_client.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(ServiceLoadMetric, self).__init__(**kwargs) self.name = name self.weight = weight @@ -2259,11 +3617,11 @@ class ServicePlacementPolicy(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: "InvalidDomain", + :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: "InvalidDomain", "RequiredDomain", "PreferredPrimaryDomain", "RequiredDomainDistribution", "NonPartiallyPlaceService". - :type type: str or + :vartype type: str or ~service_fabric_managed_clusters_management_client.models.ServicePlacementPolicyType """ @@ -2283,6 +3641,8 @@ def __init__( self, **kwargs ): + """ + """ super(ServicePlacementPolicy, self).__init__(**kwargs) self.type = None # type: Optional[str] @@ -2292,14 +3652,14 @@ class ServicePlacementInvalidDomainPolicy(ServicePlacementPolicy): 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: "InvalidDomain", + :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: "InvalidDomain", "RequiredDomain", "PreferredPrimaryDomain", "RequiredDomainDistribution", "NonPartiallyPlaceService". - :type type: str or + :vartype type: str or ~service_fabric_managed_clusters_management_client.models.ServicePlacementPolicyType - :param domain_name: Required. The name of the domain that should not be used for placement. - :type domain_name: str + :ivar domain_name: Required. The name of the domain that should not be used for placement. + :vartype domain_name: str """ _validation = { @@ -2318,6 +3678,10 @@ def __init__( domain_name: str, **kwargs ): + """ + :keyword domain_name: Required. The name of the domain that should not be used for placement. + :paramtype domain_name: str + """ super(ServicePlacementInvalidDomainPolicy, self).__init__(**kwargs) self.type = 'InvalidDomain' # type: str self.domain_name = domain_name @@ -2328,11 +3692,11 @@ class ServicePlacementNonPartiallyPlaceServicePolicy(ServicePlacementPolicy): 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: "InvalidDomain", + :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: "InvalidDomain", "RequiredDomain", "PreferredPrimaryDomain", "RequiredDomainDistribution", "NonPartiallyPlaceService". - :type type: str or + :vartype type: str or ~service_fabric_managed_clusters_management_client.models.ServicePlacementPolicyType """ @@ -2348,6 +3712,8 @@ def __init__( self, **kwargs ): + """ + """ super(ServicePlacementNonPartiallyPlaceServicePolicy, self).__init__(**kwargs) self.type = 'NonPartiallyPlaceService' # type: str @@ -2364,15 +3730,15 @@ class ServicePlacementPreferPrimaryDomainPolicy(ServicePlacementPolicy): 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: "InvalidDomain", + :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: "InvalidDomain", "RequiredDomain", "PreferredPrimaryDomain", "RequiredDomainDistribution", "NonPartiallyPlaceService". - :type type: str or + :vartype type: str or ~service_fabric_managed_clusters_management_client.models.ServicePlacementPolicyType - :param domain_name: Required. The name of the domain that should used for placement as per this + :ivar domain_name: Required. The name of the domain that should used for placement as per this policy. - :type domain_name: str + :vartype domain_name: str """ _validation = { @@ -2391,6 +3757,11 @@ def __init__( domain_name: str, **kwargs ): + """ + :keyword domain_name: Required. The name of the domain that should used for placement as per + this policy. + :paramtype domain_name: str + """ super(ServicePlacementPreferPrimaryDomainPolicy, self).__init__(**kwargs) self.type = 'PreferredPrimaryDomain' # type: str self.domain_name = domain_name @@ -2401,15 +3772,15 @@ class ServicePlacementRequiredDomainPolicy(ServicePlacementPolicy): 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: "InvalidDomain", + :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: "InvalidDomain", "RequiredDomain", "PreferredPrimaryDomain", "RequiredDomainDistribution", "NonPartiallyPlaceService". - :type type: str or + :vartype type: str or ~service_fabric_managed_clusters_management_client.models.ServicePlacementPolicyType - :param domain_name: Required. The name of the domain that should used for placement as per this + :ivar domain_name: Required. The name of the domain that should used for placement as per this policy. - :type domain_name: str + :vartype domain_name: str """ _validation = { @@ -2428,6 +3799,11 @@ def __init__( domain_name: str, **kwargs ): + """ + :keyword domain_name: Required. The name of the domain that should used for placement as per + this policy. + :paramtype domain_name: str + """ super(ServicePlacementRequiredDomainPolicy, self).__init__(**kwargs) self.type = 'RequiredDomain' # type: str self.domain_name = domain_name @@ -2446,15 +3822,15 @@ class ServicePlacementRequireDomainDistributionPolicy(ServicePlacementPolicy): 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: "InvalidDomain", + :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: "InvalidDomain", "RequiredDomain", "PreferredPrimaryDomain", "RequiredDomainDistribution", "NonPartiallyPlaceService". - :type type: str or + :vartype type: str or ~service_fabric_managed_clusters_management_client.models.ServicePlacementPolicyType - :param domain_name: Required. The name of the domain that should used for placement as per this + :ivar domain_name: Required. The name of the domain that should used for placement as per this policy. - :type domain_name: str + :vartype domain_name: str """ _validation = { @@ -2473,6 +3849,11 @@ def __init__( domain_name: str, **kwargs ): + """ + :keyword domain_name: Required. The name of the domain that should used for placement as per + this policy. + :paramtype domain_name: str + """ super(ServicePlacementRequireDomainDistributionPolicy, self).__init__(**kwargs) self.type = 'RequiredDomainDistribution' # type: str self.domain_name = domain_name @@ -2489,14 +3870,14 @@ class ServiceResource(ProxyResource): :vartype name: str :ivar type: Azure resource type. :vartype type: str - :param location: 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 location: Resource location depends on the parent resource. + :vartype location: str + :ivar tags: A set of tags. Azure resource tags. + :vartype tags: dict[str, str] :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~service_fabric_managed_clusters_management_client.models.SystemData - :param properties: The service resource properties. - :type properties: + :ivar properties: The service resource properties. + :vartype properties: ~service_fabric_managed_clusters_management_client.models.ServiceResourceProperties """ @@ -2525,6 +3906,15 @@ def __init__( properties: Optional["ServiceResourceProperties"] = None, **kwargs ): + """ + :keyword location: 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 properties: The service resource properties. + :paramtype properties: + ~service_fabric_managed_clusters_management_client.models.ServiceResourceProperties + """ super(ServiceResource, self).__init__(location=location, tags=tags, **kwargs) self.properties = properties @@ -2534,8 +3924,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[~service_fabric_managed_clusters_management_client.models.ServiceResource] + :ivar value: + :vartype value: list[~service_fabric_managed_clusters_management_client.models.ServiceResource] :ivar next_link: URL to get the next set of service list results if there are any. :vartype next_link: str """ @@ -2555,6 +3945,11 @@ def __init__( value: Optional[List["ServiceResource"]] = None, **kwargs ): + """ + :keyword value: + :paramtype value: + list[~service_fabric_managed_clusters_management_client.models.ServiceResource] + """ super(ServiceResourceList, self).__init__(**kwargs) self.value = value self.next_link = None @@ -2563,29 +3958,29 @@ 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: + :vartype correlation_scheme: list[~service_fabric_managed_clusters_management_client.models.ServiceCorrelation] - :param service_load_metrics: The service load metrics is given as an array of ServiceLoadMetric + :ivar service_load_metrics: The service load metrics is given as an array of ServiceLoadMetric objects. - :type service_load_metrics: + :vartype service_load_metrics: list[~service_fabric_managed_clusters_management_client.models.ServiceLoadMetric] - :param service_placement_policies: A list that describes the correlation of the service with + :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[~service_fabric_managed_clusters_management_client.models.ServicePlacementPolicy] - :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 + :vartype default_move_cost: str or ~service_fabric_managed_clusters_management_client.models.MoveCost - :param scaling_policies: Scaling policies for this service. - :type scaling_policies: + :ivar scaling_policies: Scaling policies for this service. + :vartype scaling_policies: list[~service_fabric_managed_clusters_management_client.models.ScalingPolicy] """ @@ -2609,6 +4004,32 @@ def __init__( scaling_policies: Optional[List["ScalingPolicy"]] = 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[~service_fabric_managed_clusters_management_client.models.ServiceCorrelation] + :keyword service_load_metrics: The service load metrics is given as an array of + ServiceLoadMetric objects. + :paramtype service_load_metrics: + list[~service_fabric_managed_clusters_management_client.models.ServiceLoadMetric] + :keyword service_placement_policies: A list that describes the correlation of the service with + other services. + :paramtype service_placement_policies: + list[~service_fabric_managed_clusters_management_client.models.ServicePlacementPolicy] + :keyword default_move_cost: Specifies the move cost for the service. Possible values include: + "Zero", "Low", "Medium", "High". + :paramtype default_move_cost: str or + ~service_fabric_managed_clusters_management_client.models.MoveCost + :keyword scaling_policies: Scaling policies for this service. + :paramtype scaling_policies: + list[~service_fabric_managed_clusters_management_client.models.ScalingPolicy] + """ super(ServiceResourcePropertiesBase, self).__init__(**kwargs) self.placement_constraints = placement_constraints self.correlation_scheme = correlation_scheme @@ -2628,45 +4049,45 @@ 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: + :vartype correlation_scheme: list[~service_fabric_managed_clusters_management_client.models.ServiceCorrelation] - :param service_load_metrics: The service load metrics is given as an array of ServiceLoadMetric + :ivar service_load_metrics: The service load metrics is given as an array of ServiceLoadMetric objects. - :type service_load_metrics: + :vartype service_load_metrics: list[~service_fabric_managed_clusters_management_client.models.ServiceLoadMetric] - :param service_placement_policies: A list that describes the correlation of the service with + :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[~service_fabric_managed_clusters_management_client.models.ServicePlacementPolicy] - :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 + :vartype default_move_cost: str or ~service_fabric_managed_clusters_management_client.models.MoveCost - :param scaling_policies: Scaling policies for this service. - :type scaling_policies: + :ivar scaling_policies: Scaling policies for this service. + :vartype scaling_policies: list[~service_fabric_managed_clusters_management_client.models.ScalingPolicy] :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: "Stateless", "Stateful". - :type service_kind: str or + :ivar service_kind: Required. The kind of service (Stateless or Stateful).Constant filled by + server. Possible values include: "Stateless", "Stateful". + :vartype service_kind: str or ~service_fabric_managed_clusters_management_client.models.ServiceKind - :param service_type_name: Required. The name of the service type. - :type service_type_name: str - :param partition_description: Required. Describes how the service is partitioned. - :type partition_description: + :ivar service_type_name: Required. The name of the service type. + :vartype service_type_name: str + :ivar partition_description: Required. Describes how the service is partitioned. + :vartype partition_description: ~service_fabric_managed_clusters_management_client.models.Partition - :param service_package_activation_mode: The activation Mode of the service package. Possible + :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 ~service_fabric_managed_clusters_management_client.models.ServicePackageActivationMode """ @@ -2709,6 +4130,41 @@ def __init__( service_package_activation_mode: Optional[Union[str, "ServicePackageActivationMode"]] = 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[~service_fabric_managed_clusters_management_client.models.ServiceCorrelation] + :keyword service_load_metrics: The service load metrics is given as an array of + ServiceLoadMetric objects. + :paramtype service_load_metrics: + list[~service_fabric_managed_clusters_management_client.models.ServiceLoadMetric] + :keyword service_placement_policies: A list that describes the correlation of the service with + other services. + :paramtype service_placement_policies: + list[~service_fabric_managed_clusters_management_client.models.ServicePlacementPolicy] + :keyword default_move_cost: Specifies the move cost for the service. Possible values include: + "Zero", "Low", "Medium", "High". + :paramtype default_move_cost: str or + ~service_fabric_managed_clusters_management_client.models.MoveCost + :keyword scaling_policies: Scaling policies for this service. + :paramtype scaling_policies: + list[~service_fabric_managed_clusters_management_client.models.ScalingPolicy] + :keyword service_type_name: Required. The name of the service type. + :paramtype service_type_name: str + :keyword partition_description: Required. Describes how the service is partitioned. + :paramtype partition_description: + ~service_fabric_managed_clusters_management_client.models.Partition + :keyword service_package_activation_mode: The activation Mode of the service package. Possible + values include: "SharedProcess", "ExclusiveProcess". + :paramtype service_package_activation_mode: str or + ~service_fabric_managed_clusters_management_client.models.ServicePackageActivationMode + """ 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, scaling_policies=scaling_policies, **kwargs) self.provisioning_state = None self.service_kind = 'ServiceResourceProperties' # type: str @@ -2722,7 +4178,7 @@ class ServiceTypeHealthPolicy(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param max_percent_unhealthy_services: Required. The maximum allowed percentage of unhealthy + :ivar max_percent_unhealthy_services: Required. The maximum allowed percentage of unhealthy services. The percentage represents the maximum tolerated percentage of services that can be unhealthy @@ -2732,9 +4188,9 @@ class ServiceTypeHealthPolicy(msrest.serialization.Model): This is calculated by dividing the number of unhealthy services of the specific service type over the total number of services of the specific service type. The computation rounds up to tolerate one failure on small numbers of services. - :type max_percent_unhealthy_services: int - :param max_percent_unhealthy_partitions_per_service: Required. The maximum allowed percentage - of unhealthy partitions per service. + :vartype max_percent_unhealthy_services: int + :ivar max_percent_unhealthy_partitions_per_service: Required. The maximum allowed percentage of + unhealthy partitions per service. The percentage represents the maximum tolerated percentage of partitions that can be unhealthy before the service is considered in error. @@ -2743,9 +4199,9 @@ class ServiceTypeHealthPolicy(msrest.serialization.Model): The percentage is calculated by dividing the number of unhealthy partitions over the total number of partitions in the service. The computation rounds up to tolerate one failure on small numbers of partitions. - :type max_percent_unhealthy_partitions_per_service: int - :param max_percent_unhealthy_replicas_per_partition: Required. The maximum allowed percentage - of unhealthy replicas per partition. + :vartype max_percent_unhealthy_partitions_per_service: int + :ivar max_percent_unhealthy_replicas_per_partition: Required. The maximum allowed percentage of + unhealthy replicas per partition. The percentage represents the maximum tolerated percentage of replicas that can be unhealthy before the partition is considered in error. @@ -2754,7 +4210,7 @@ class ServiceTypeHealthPolicy(msrest.serialization.Model): The percentage is calculated by dividing the number of unhealthy replicas over the total number of replicas in the partition. The computation rounds up to tolerate one failure on small numbers of replicas. - :type max_percent_unhealthy_replicas_per_partition: int + :vartype max_percent_unhealthy_replicas_per_partition: int """ _validation = { @@ -2777,6 +4233,41 @@ def __init__( max_percent_unhealthy_replicas_per_partition: int, **kwargs ): + """ + :keyword max_percent_unhealthy_services: Required. The maximum allowed percentage of unhealthy + services. + + The percentage represents the maximum tolerated percentage of services that can be unhealthy + before the application is considered in error. + If the percentage is respected but there is at least one unhealthy service, the health is + evaluated as Warning. + This is calculated by dividing the number of unhealthy services of the specific service type + over the total number of services of the specific service type. + The computation rounds up to tolerate one failure on small numbers of services. + :paramtype max_percent_unhealthy_services: int + :keyword max_percent_unhealthy_partitions_per_service: Required. The maximum allowed percentage + of unhealthy partitions per service. + + The percentage represents the maximum tolerated percentage of partitions that can be unhealthy + before the service is considered in error. + If the percentage is respected but there is at least one unhealthy partition, the health is + evaluated as Warning. + The percentage is calculated by dividing the number of unhealthy partitions over the total + number of partitions in the service. + The computation rounds up to tolerate one failure on small numbers of partitions. + :paramtype max_percent_unhealthy_partitions_per_service: int + :keyword max_percent_unhealthy_replicas_per_partition: Required. The maximum allowed percentage + of unhealthy replicas per partition. + + The percentage represents the maximum tolerated percentage of replicas that can be unhealthy + before the partition is considered in error. + If the percentage is respected but there is at least one unhealthy replica, the health is + evaluated as Warning. + The percentage is calculated by dividing the number of unhealthy replicas over the total + number of replicas in the partition. + The computation rounds up to tolerate one failure on small numbers of replicas. + :paramtype max_percent_unhealthy_replicas_per_partition: int + """ super(ServiceTypeHealthPolicy, 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 @@ -2786,8 +4277,8 @@ def __init__( class ServiceUpdateParameters(msrest.serialization.Model): """Service update request. - :param tags: A set of tags. Service update parameters. - :type tags: dict[str, str] + :ivar tags: A set of tags. Service update parameters. + :vartype tags: dict[str, str] """ _attribute_map = { @@ -2800,6 +4291,10 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Service update parameters. + :paramtype tags: dict[str, str] + """ super(ServiceUpdateParameters, self).__init__(**kwargs) self.tags = tags @@ -2809,10 +4304,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 = { @@ -2832,6 +4327,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 @@ -2842,10 +4343,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: + :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[~service_fabric_managed_clusters_management_client.models.SettingsParameterDescription] """ @@ -2866,6 +4367,13 @@ 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[~service_fabric_managed_clusters_management_client.models.SettingsParameterDescription] + """ super(SettingsSectionDescription, self).__init__(**kwargs) self.name = name self.parameters = parameters @@ -2876,9 +4384,9 @@ class SingletonPartitionScheme(Partition): 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: "Singleton", "UniformInt64Range", "Named". - :type partition_scheme: str or + :ivar partition_scheme: Required. Specifies how the service is partitioned.Constant filled by + server. Possible values include: "Singleton", "UniformInt64Range", "Named". + :vartype partition_scheme: str or ~service_fabric_managed_clusters_management_client.models.PartitionScheme """ @@ -2894,6 +4402,8 @@ def __init__( self, **kwargs ): + """ + """ super(SingletonPartitionScheme, self).__init__(**kwargs) self.partition_scheme = 'Singleton' # type: str @@ -2903,8 +4413,8 @@ class Sku(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. Sku Name. Possible values include: "Basic", "Standard". - :type name: str or ~service_fabric_managed_clusters_management_client.models.SkuName + :ivar name: Required. Sku Name. Possible values include: "Basic", "Standard". + :vartype name: str or ~service_fabric_managed_clusters_management_client.models.SkuName """ _validation = { @@ -2921,6 +4431,10 @@ def __init__( name: Union[str, "SkuName"], **kwargs ): + """ + :keyword name: Required. Sku Name. Possible values include: "Basic", "Standard". + :paramtype name: str or ~service_fabric_managed_clusters_management_client.models.SkuName + """ super(Sku, self).__init__(**kwargs) self.name = name @@ -2932,65 +4446,65 @@ 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: + :vartype correlation_scheme: list[~service_fabric_managed_clusters_management_client.models.ServiceCorrelation] - :param service_load_metrics: The service load metrics is given as an array of ServiceLoadMetric + :ivar service_load_metrics: The service load metrics is given as an array of ServiceLoadMetric objects. - :type service_load_metrics: + :vartype service_load_metrics: list[~service_fabric_managed_clusters_management_client.models.ServiceLoadMetric] - :param service_placement_policies: A list that describes the correlation of the service with + :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[~service_fabric_managed_clusters_management_client.models.ServicePlacementPolicy] - :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 + :vartype default_move_cost: str or ~service_fabric_managed_clusters_management_client.models.MoveCost - :param scaling_policies: Scaling policies for this service. - :type scaling_policies: + :ivar scaling_policies: Scaling policies for this service. + :vartype scaling_policies: list[~service_fabric_managed_clusters_management_client.models.ScalingPolicy] :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: "Stateless", "Stateful". - :type service_kind: str or + :ivar service_kind: Required. The kind of service (Stateless or Stateful).Constant filled by + server. Possible values include: "Stateless", "Stateful". + :vartype service_kind: str or ~service_fabric_managed_clusters_management_client.models.ServiceKind - :param service_type_name: Required. The name of the service type. - :type service_type_name: str - :param partition_description: Required. Describes how the service is partitioned. - :type partition_description: + :ivar service_type_name: Required. The name of the service type. + :vartype service_type_name: str + :ivar partition_description: Required. Describes how the service is partitioned. + :vartype partition_description: ~service_fabric_managed_clusters_management_client.models.Partition - :param service_package_activation_mode: The activation Mode of the service package. Possible + :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 ~service_fabric_managed_clusters_management_client.models.ServicePackageActivationMode - :param has_persisted_state: A flag indicating whether this is a persistent service which stores + :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". - :type replica_restart_wait_duration: str - :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". - :type quorum_loss_wait_duration: str - :param stand_by_replica_keep_duration: The definition on how long StandBy replicas should be + :vartype replica_restart_wait_duration: str + :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". + :vartype quorum_loss_wait_duration: str + :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". - :type stand_by_replica_keep_duration: str - :param service_placement_time_limit: The duration for which replicas can stay InBuild before + :vartype stand_by_replica_keep_duration: str + :ivar service_placement_time_limit: The duration for which replicas can stay InBuild before reporting that build is stuck, represented in ISO 8601 format "hh:mm:ss". - :type service_placement_time_limit: str + :vartype service_placement_time_limit: str """ _validation = { @@ -3044,6 +4558,61 @@ def __init__( service_placement_time_limit: 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[~service_fabric_managed_clusters_management_client.models.ServiceCorrelation] + :keyword service_load_metrics: The service load metrics is given as an array of + ServiceLoadMetric objects. + :paramtype service_load_metrics: + list[~service_fabric_managed_clusters_management_client.models.ServiceLoadMetric] + :keyword service_placement_policies: A list that describes the correlation of the service with + other services. + :paramtype service_placement_policies: + list[~service_fabric_managed_clusters_management_client.models.ServicePlacementPolicy] + :keyword default_move_cost: Specifies the move cost for the service. Possible values include: + "Zero", "Low", "Medium", "High". + :paramtype default_move_cost: str or + ~service_fabric_managed_clusters_management_client.models.MoveCost + :keyword scaling_policies: Scaling policies for this service. + :paramtype scaling_policies: + list[~service_fabric_managed_clusters_management_client.models.ScalingPolicy] + :keyword service_type_name: Required. The name of the service type. + :paramtype service_type_name: str + :keyword partition_description: Required. Describes how the service is partitioned. + :paramtype partition_description: + ~service_fabric_managed_clusters_management_client.models.Partition + :keyword service_package_activation_mode: The activation Mode of the service package. Possible + values include: "SharedProcess", "ExclusiveProcess". + :paramtype service_package_activation_mode: str or + ~service_fabric_managed_clusters_management_client.models.ServicePackageActivationMode + :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". + :paramtype replica_restart_wait_duration: str + :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". + :paramtype quorum_loss_wait_duration: str + :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". + :paramtype stand_by_replica_keep_duration: str + :keyword service_placement_time_limit: The duration for which replicas can stay InBuild before + reporting that build is stuck, represented in ISO 8601 format "hh:mm:ss". + :paramtype service_placement_time_limit: str + """ 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, scaling_policies=scaling_policies, service_type_name=service_type_name, partition_description=partition_description, service_package_activation_mode=service_package_activation_mode, **kwargs) self.service_kind = 'Stateful' # type: str self.has_persisted_state = has_persisted_state @@ -3062,62 +4631,62 @@ 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: + :vartype correlation_scheme: list[~service_fabric_managed_clusters_management_client.models.ServiceCorrelation] - :param service_load_metrics: The service load metrics is given as an array of ServiceLoadMetric + :ivar service_load_metrics: The service load metrics is given as an array of ServiceLoadMetric objects. - :type service_load_metrics: + :vartype service_load_metrics: list[~service_fabric_managed_clusters_management_client.models.ServiceLoadMetric] - :param service_placement_policies: A list that describes the correlation of the service with + :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[~service_fabric_managed_clusters_management_client.models.ServicePlacementPolicy] - :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 + :vartype default_move_cost: str or ~service_fabric_managed_clusters_management_client.models.MoveCost - :param scaling_policies: Scaling policies for this service. - :type scaling_policies: + :ivar scaling_policies: Scaling policies for this service. + :vartype scaling_policies: list[~service_fabric_managed_clusters_management_client.models.ScalingPolicy] :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: "Stateless", "Stateful". - :type service_kind: str or + :ivar service_kind: Required. The kind of service (Stateless or Stateful).Constant filled by + server. Possible values include: "Stateless", "Stateful". + :vartype service_kind: str or ~service_fabric_managed_clusters_management_client.models.ServiceKind - :param service_type_name: Required. The name of the service type. - :type service_type_name: str - :param partition_description: Required. Describes how the service is partitioned. - :type partition_description: + :ivar service_type_name: Required. The name of the service type. + :vartype service_type_name: str + :ivar partition_description: Required. Describes how the service is partitioned. + :vartype partition_description: ~service_fabric_managed_clusters_management_client.models.Partition - :param service_package_activation_mode: The activation Mode of the service package. Possible + :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 ~service_fabric_managed_clusters_management_client.models.ServicePackageActivationMode - :param instance_count: Required. The instance count. - :type instance_count: int - :param min_instance_count: MinInstanceCount is the minimum number of instances that must be up + :ivar instance_count: Required. The instance count. + :vartype instance_count: int + :ivar min_instance_count: MinInstanceCount is the minimum number of instances that must be up to meet the EnsureAvailability safety check during operations like upgrade or deactivate node. The actual number that is used is max( MinInstanceCount, ceil( MinInstancePercentage/100.0 * InstanceCount) ). Note, if InstanceCount is set to -1, during MinInstanceCount computation -1 is first converted into the number of nodes on which the instances are allowed to be placed according to the placement constraints on the service. - :type min_instance_count: int - :param min_instance_percentage: MinInstancePercentage is the minimum percentage of - InstanceCount that must be up to meet the EnsureAvailability safety check during operations - like upgrade or deactivate node. The actual number that is used is max( MinInstanceCount, ceil( + :vartype min_instance_count: int + :ivar min_instance_percentage: MinInstancePercentage is the minimum percentage of InstanceCount + that must be up to meet the EnsureAvailability safety check during operations like upgrade or + deactivate node. The actual number that is used is max( MinInstanceCount, ceil( MinInstancePercentage/100.0 * InstanceCount) ). Note, if InstanceCount is set to -1, during MinInstancePercentage computation, -1 is first converted into the number of nodes on which the instances are allowed to be placed according to the placement constraints on the service. - :type min_instance_percentage: int + :vartype min_instance_percentage: int """ _validation = { @@ -3162,6 +4731,57 @@ def __init__( min_instance_percentage: Optional[int] = 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[~service_fabric_managed_clusters_management_client.models.ServiceCorrelation] + :keyword service_load_metrics: The service load metrics is given as an array of + ServiceLoadMetric objects. + :paramtype service_load_metrics: + list[~service_fabric_managed_clusters_management_client.models.ServiceLoadMetric] + :keyword service_placement_policies: A list that describes the correlation of the service with + other services. + :paramtype service_placement_policies: + list[~service_fabric_managed_clusters_management_client.models.ServicePlacementPolicy] + :keyword default_move_cost: Specifies the move cost for the service. Possible values include: + "Zero", "Low", "Medium", "High". + :paramtype default_move_cost: str or + ~service_fabric_managed_clusters_management_client.models.MoveCost + :keyword scaling_policies: Scaling policies for this service. + :paramtype scaling_policies: + list[~service_fabric_managed_clusters_management_client.models.ScalingPolicy] + :keyword service_type_name: Required. The name of the service type. + :paramtype service_type_name: str + :keyword partition_description: Required. Describes how the service is partitioned. + :paramtype partition_description: + ~service_fabric_managed_clusters_management_client.models.Partition + :keyword service_package_activation_mode: The activation Mode of the service package. Possible + values include: "SharedProcess", "ExclusiveProcess". + :paramtype service_package_activation_mode: str or + ~service_fabric_managed_clusters_management_client.models.ServicePackageActivationMode + :keyword instance_count: Required. The instance count. + :paramtype instance_count: int + :keyword min_instance_count: MinInstanceCount is the minimum number of instances that must be + up to meet the EnsureAvailability safety check during operations like upgrade or deactivate + node. The actual number that is used is max( MinInstanceCount, ceil( + MinInstancePercentage/100.0 * InstanceCount) ). Note, if InstanceCount is set to -1, during + MinInstanceCount computation -1 is first converted into the number of nodes on which the + instances are allowed to be placed according to the placement constraints on the service. + :paramtype min_instance_count: int + :keyword min_instance_percentage: MinInstancePercentage is the minimum percentage of + InstanceCount that must be up to meet the EnsureAvailability safety check during operations + like upgrade or deactivate node. The actual number that is used is max( MinInstanceCount, ceil( + MinInstancePercentage/100.0 * InstanceCount) ). Note, if InstanceCount is set to -1, during + MinInstancePercentage computation, -1 is first converted into the number of nodes on which the + instances are allowed to be placed according to the placement constraints on the service. + :paramtype min_instance_percentage: int + """ 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, scaling_policies=scaling_policies, service_type_name=service_type_name, partition_description=partition_description, service_package_activation_mode=service_package_activation_mode, **kwargs) self.service_kind = 'Stateless' # type: str self.instance_count = instance_count @@ -3169,11 +4789,80 @@ def __init__( self.min_instance_percentage = min_instance_percentage +class Subnet(msrest.serialization.Model): + """Describes a Subnet. + + All required parameters must be populated in order to send to Azure. + + :ivar name: Required. Subnet name. + :vartype name: str + :ivar enable_ipv6: Indicates wether to enable Ipv6 or not. If not provided, it will take the + same configuration as the cluster. + :vartype enable_ipv6: bool + :ivar private_endpoint_network_policies: Enable or Disable apply network policies on private + end point in the subnet. Possible values include: "enabled", "disabled". + :vartype private_endpoint_network_policies: str or + ~service_fabric_managed_clusters_management_client.models.PrivateEndpointNetworkPolicies + :ivar private_link_service_network_policies: Enable or Disable apply network policies on + private link service in the subnet. Possible values include: "enabled", "disabled". + :vartype private_link_service_network_policies: str or + ~service_fabric_managed_clusters_management_client.models.PrivateLinkServiceNetworkPolicies + :ivar network_security_group_id: Full resource id for the network security group. + :vartype network_security_group_id: str + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'enable_ipv6': {'key': 'enableIpv6', 'type': 'bool'}, + 'private_endpoint_network_policies': {'key': 'privateEndpointNetworkPolicies', 'type': 'str'}, + 'private_link_service_network_policies': {'key': 'privateLinkServiceNetworkPolicies', 'type': 'str'}, + 'network_security_group_id': {'key': 'networkSecurityGroupId', 'type': 'str'}, + } + + def __init__( + self, + *, + name: str, + enable_ipv6: Optional[bool] = None, + private_endpoint_network_policies: Optional[Union[str, "PrivateEndpointNetworkPolicies"]] = None, + private_link_service_network_policies: Optional[Union[str, "PrivateLinkServiceNetworkPolicies"]] = None, + network_security_group_id: Optional[str] = None, + **kwargs + ): + """ + :keyword name: Required. Subnet name. + :paramtype name: str + :keyword enable_ipv6: Indicates wether to enable Ipv6 or not. If not provided, it will take the + same configuration as the cluster. + :paramtype enable_ipv6: bool + :keyword private_endpoint_network_policies: Enable or Disable apply network policies on private + end point in the subnet. Possible values include: "enabled", "disabled". + :paramtype private_endpoint_network_policies: str or + ~service_fabric_managed_clusters_management_client.models.PrivateEndpointNetworkPolicies + :keyword private_link_service_network_policies: Enable or Disable apply network policies on + private link service in the subnet. Possible values include: "enabled", "disabled". + :paramtype private_link_service_network_policies: str or + ~service_fabric_managed_clusters_management_client.models.PrivateLinkServiceNetworkPolicies + :keyword network_security_group_id: Full resource id for the network security group. + :paramtype network_security_group_id: str + """ + super(Subnet, self).__init__(**kwargs) + self.name = name + self.enable_ipv6 = enable_ipv6 + self.private_endpoint_network_policies = private_endpoint_network_policies + self.private_link_service_network_policies = private_link_service_network_policies + self.network_security_group_id = network_security_group_id + + class SubResource(msrest.serialization.Model): """Azure resource identifier. - :param id: Azure resource identifier. - :type id: str + :ivar id: Azure resource identifier. + :vartype id: str """ _attribute_map = { @@ -3186,6 +4875,10 @@ def __init__( id: Optional[str] = None, **kwargs ): + """ + :keyword id: Azure resource identifier. + :paramtype id: str + """ super(SubResource, self).__init__(**kwargs) self.id = id @@ -3193,18 +4886,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 = { @@ -3227,6 +4920,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 @@ -3241,18 +4948,18 @@ class UniformInt64RangePartitionScheme(Partition): 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: "Singleton", "UniformInt64Range", "Named". - :type partition_scheme: str or + :ivar partition_scheme: Required. Specifies how the service is partitioned.Constant filled by + server. Possible values include: "Singleton", "UniformInt64Range", "Named". + :vartype partition_scheme: str or ~service_fabric_managed_clusters_management_client.models.PartitionScheme - :param count: Required. The number of partitions. - :type count: int - :param low_key: Required. The lower bound of the partition key range that + :ivar count: Required. The number of partitions. + :vartype count: int + :ivar low_key: Required. The lower bound of the partition key range that should be split between the partition ‘Count’. - :type low_key: long - :param high_key: Required. The upper bound of the partition key range that + :vartype low_key: long + :ivar high_key: Required. The upper bound of the partition key range that should be split between the partition ‘Count’. - :type high_key: long + :vartype high_key: long """ _validation = { @@ -3277,6 +4984,16 @@ def __init__( high_key: int, **kwargs ): + """ + :keyword count: Required. The number of partitions. + :paramtype count: int + :keyword low_key: Required. The lower bound of the partition key range that + should be split between the partition ‘Count’. + :paramtype low_key: long + :keyword high_key: Required. The upper bound of the partition key range that + should be split between the partition ‘Count’. + :paramtype high_key: long + """ super(UniformInt64RangePartitionScheme, self).__init__(**kwargs) self.partition_scheme = 'UniformInt64Range' # type: str self.count = count @@ -3309,6 +5026,8 @@ def __init__( self, **kwargs ): + """ + """ super(UserAssignedIdentity, self).__init__(**kwargs) self.principal_id = None self.client_id = None @@ -3319,21 +5038,21 @@ class VaultCertificate(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param certificate_url: Required. This is the URL of a certificate that has been uploaded to - Key Vault as a secret. For adding a secret to the Key Vault, see `Add a key or secret to the - key vault `_. In this - case, your certificate needs to be It is the Base64 encoding of the following JSON Object which - is encoded in UTF-8: :code:`
`:code:`
` {:code:`
` + :ivar certificate_url: Required. This is the URL of a certificate that has been uploaded to Key + Vault as a secret. For adding a secret to the Key Vault, see `Add a key or secret to the key + vault `_. In this case, + your certificate needs to be It is the Base64 encoding of the following JSON Object which is + encoded in UTF-8: :code:`
`:code:`
` {:code:`
` "data":":code:``",:code:`
` "dataType":"pfx",:code:`
` "password":":code:``":code:`
`}. - :type certificate_url: str - :param certificate_store: Required. For Windows VMs, specifies the certificate store on the + :vartype certificate_url: str + :ivar certificate_store: Required. For Windows VMs, specifies the certificate store on the Virtual Machine to which the certificate should be added. The specified certificate store is implicitly in the LocalMachine account. :code:`
`:code:`
`For Linux VMs, the certificate file is placed under the /var/lib/waagent directory, with the file name :code:``.crt for the X509 certificate file and :code:``.prv for private key. Both of these files are .pem formatted. - :type certificate_store: str + :vartype certificate_store: str """ _validation = { @@ -3353,6 +5072,23 @@ def __init__( certificate_store: str, **kwargs ): + """ + :keyword certificate_url: Required. This is the URL of a certificate that has been uploaded to + Key Vault as a secret. For adding a secret to the Key Vault, see `Add a key or secret to the + key vault `_. In this + case, your certificate needs to be It is the Base64 encoding of the following JSON Object which + is encoded in UTF-8: :code:`
`:code:`
` {:code:`
` + "data":":code:``",:code:`
` "dataType":"pfx",:code:`
` + "password":":code:``":code:`
`}. + :paramtype certificate_url: str + :keyword certificate_store: Required. For Windows VMs, specifies the certificate store on the + Virtual Machine to which the certificate should be added. The specified certificate store is + implicitly in the LocalMachine account. :code:`
`:code:`
`For Linux VMs, the certificate + file is placed under the /var/lib/waagent directory, with the file name + :code:``.crt for the X509 certificate file and + :code:``.prv for private key. Both of these files are .pem formatted. + :paramtype certificate_store: str + """ super(VaultCertificate, self).__init__(**kwargs) self.certificate_url = certificate_url self.certificate_store = certificate_store @@ -3363,12 +5099,12 @@ class VaultSecretGroup(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param source_vault: Required. The relative URL of the Key Vault containing all of the + :ivar source_vault: Required. The relative URL of the Key Vault containing all of the certificates in VaultCertificates. - :type source_vault: ~service_fabric_managed_clusters_management_client.models.SubResource - :param vault_certificates: Required. The list of key vault references in SourceVault which + :vartype source_vault: ~service_fabric_managed_clusters_management_client.models.SubResource + :ivar vault_certificates: Required. The list of key vault references in SourceVault which contain certificates. - :type vault_certificates: + :vartype vault_certificates: list[~service_fabric_managed_clusters_management_client.models.VaultCertificate] """ @@ -3389,6 +5125,15 @@ def __init__( vault_certificates: List["VaultCertificate"], **kwargs ): + """ + :keyword source_vault: Required. The relative URL of the Key Vault containing all of the + certificates in VaultCertificates. + :paramtype source_vault: ~service_fabric_managed_clusters_management_client.models.SubResource + :keyword vault_certificates: Required. The list of key vault references in SourceVault which + contain certificates. + :paramtype vault_certificates: + list[~service_fabric_managed_clusters_management_client.models.VaultCertificate] + """ super(VaultSecretGroup, self).__init__(**kwargs) self.source_vault = source_vault self.vault_certificates = vault_certificates @@ -3397,10 +5142,10 @@ def __init__( class VmManagedIdentity(msrest.serialization.Model): """Identities for the virtual machine scale set under the node type. - :param user_assigned_identities: The list of user identities associated with the virtual - machine scale set under the node type. Each entry will be an ARM resource ids in the form: + :ivar user_assigned_identities: The list of user identities associated with the virtual machine + scale set under the node type. Each entry will be an ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. - :type user_assigned_identities: list[str] + :vartype user_assigned_identities: list[str] """ _attribute_map = { @@ -3413,10 +5158,108 @@ def __init__( user_assigned_identities: Optional[List[str]] = None, **kwargs ): + """ + :keyword user_assigned_identities: The list of user identities associated with the virtual + machine scale set under the node type. Each entry will be an ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + :paramtype user_assigned_identities: list[str] + """ super(VmManagedIdentity, self).__init__(**kwargs) self.user_assigned_identities = user_assigned_identities +class VMSize(msrest.serialization.Model): + """VM Sizes properties. + + Variables are only populated by the server, and will be ignored when sending a request. + + :ivar size: VM Size name. + :vartype size: str + """ + + _validation = { + 'size': {'readonly': True}, + } + + _attribute_map = { + 'size': {'key': 'size', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + """ + """ + super(VMSize, self).__init__(**kwargs) + self.size = None + + +class VmssDataDisk(msrest.serialization.Model): + """Managed data disk description. + + All required parameters must be populated in order to send to Azure. + + :ivar lun: Required. Specifies the logical unit number of the data disk. This value is used to + identify data disks within the VM and therefore must be unique for each data disk attached to a + VM. Lun 0 is reserved for the service fabric data disk. + :vartype lun: int + :ivar disk_size_gb: Required. Disk size for each vm in the node type in GBs. + :vartype disk_size_gb: int + :ivar disk_type: Required. Managed data disk type. Specifies the storage account type for the + managed disk. Possible values include: "Standard_LRS", "StandardSSD_LRS", "Premium_LRS". + Default value: "StandardSSD_LRS". + :vartype disk_type: str or ~service_fabric_managed_clusters_management_client.models.DiskType + :ivar disk_letter: Required. Managed data disk letter. It can not use the reserved letter C or + D and it can not change after created. + :vartype disk_letter: str + """ + + _validation = { + 'lun': {'required': True, 'minimum': 1}, + 'disk_size_gb': {'required': True}, + 'disk_type': {'required': True}, + 'disk_letter': {'required': True, 'pattern': r'^[a-zA-Z]{1}$'}, + } + + _attribute_map = { + 'lun': {'key': 'lun', 'type': 'int'}, + 'disk_size_gb': {'key': 'diskSizeGB', 'type': 'int'}, + 'disk_type': {'key': 'diskType', 'type': 'str'}, + 'disk_letter': {'key': 'diskLetter', 'type': 'str'}, + } + + def __init__( + self, + *, + lun: int, + disk_size_gb: int, + disk_type: Union[str, "DiskType"] = "StandardSSD_LRS", + disk_letter: str, + **kwargs + ): + """ + :keyword lun: Required. Specifies the logical unit number of the data disk. This value is used + to identify data disks within the VM and therefore must be unique for each data disk attached + to a VM. Lun 0 is reserved for the service fabric data disk. + :paramtype lun: int + :keyword disk_size_gb: Required. Disk size for each vm in the node type in GBs. + :paramtype disk_size_gb: int + :keyword disk_type: Required. Managed data disk type. Specifies the storage account type for + the managed disk. Possible values include: "Standard_LRS", "StandardSSD_LRS", "Premium_LRS". + Default value: "StandardSSD_LRS". + :paramtype disk_type: str or ~service_fabric_managed_clusters_management_client.models.DiskType + :keyword disk_letter: Required. Managed data disk letter. It can not use the reserved letter C + or D and it can not change after created. + :paramtype disk_letter: str + """ + super(VmssDataDisk, self).__init__(**kwargs) + self.lun = lun + self.disk_size_gb = disk_size_gb + self.disk_type = disk_type + self.disk_letter = disk_letter + + class VMSSExtension(msrest.serialization.Model): """Specifies set of extensions that should be installed onto the virtual machines. @@ -3424,32 +5267,35 @@ class VMSSExtension(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The name of the extension. - :type name: str - :param publisher: Required. The name of the extension handler publisher. - :type publisher: str - :param type: Required. Specifies the type of the extension; an example is + :ivar name: Required. The name of the extension. + :vartype name: str + :ivar publisher: Required. The name of the extension handler publisher. + :vartype publisher: str + :ivar type: Required. Specifies the type of the extension; an example is "CustomScriptExtension". - :type type: str - :param type_handler_version: Required. Specifies the version of the script handler. - :type type_handler_version: str - :param auto_upgrade_minor_version: Indicates whether the extension should use a newer minor + :vartype type: str + :ivar type_handler_version: Required. Specifies the version of the script handler. + :vartype type_handler_version: str + :ivar auto_upgrade_minor_version: Indicates whether the extension should use a newer minor version if one is available at deployment time. Once deployed, however, the extension will not upgrade minor versions unless redeployed, even with this property set to true. - :type auto_upgrade_minor_version: bool - :param settings: Json formatted public settings for the extension. - :type settings: object - :param protected_settings: The extension can contain either protectedSettings or + :vartype auto_upgrade_minor_version: bool + :ivar settings: Json formatted public settings for the extension. + :vartype settings: any + :ivar protected_settings: The extension can contain either protectedSettings or protectedSettingsFromKeyVault or no protected settings at all. - :type protected_settings: object - :param force_update_tag: If a value is provided and is different from the previous value, the + :vartype protected_settings: any + :ivar force_update_tag: If a value is provided and is different from the previous value, the extension handler will be forced to update even if the extension configuration has not changed. - :type force_update_tag: str - :param provision_after_extensions: Collection of extension names after which this extension + :vartype force_update_tag: str + :ivar provision_after_extensions: Collection of extension names after which this extension needs to be provisioned. - :type provision_after_extensions: list[str] + :vartype provision_after_extensions: list[str] :ivar provisioning_state: The provisioning state, which only appears in the response. :vartype provisioning_state: str + :ivar enable_automatic_upgrade: Indicates whether the extension should be automatically + upgraded by the platform if there is a newer version of the extension available. + :vartype enable_automatic_upgrade: bool """ _validation = { @@ -3471,6 +5317,7 @@ class VMSSExtension(msrest.serialization.Model): 'force_update_tag': {'key': 'properties.forceUpdateTag', 'type': 'str'}, 'provision_after_extensions': {'key': 'properties.provisionAfterExtensions', 'type': '[str]'}, 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'enable_automatic_upgrade': {'key': 'properties.enableAutomaticUpgrade', 'type': 'bool'}, } def __init__( @@ -3481,12 +5328,42 @@ def __init__( type: str, type_handler_version: str, auto_upgrade_minor_version: Optional[bool] = None, - settings: Optional[object] = None, - protected_settings: Optional[object] = None, + settings: Optional[Any] = None, + protected_settings: Optional[Any] = None, force_update_tag: Optional[str] = None, provision_after_extensions: Optional[List[str]] = None, + enable_automatic_upgrade: Optional[bool] = None, **kwargs ): + """ + :keyword name: Required. The name of the extension. + :paramtype name: str + :keyword publisher: Required. The name of the extension handler publisher. + :paramtype publisher: str + :keyword type: Required. Specifies the type of the extension; an example is + "CustomScriptExtension". + :paramtype type: str + :keyword type_handler_version: Required. Specifies the version of the script handler. + :paramtype type_handler_version: str + :keyword auto_upgrade_minor_version: Indicates whether the extension should use a newer minor + version if one is available at deployment time. Once deployed, however, the extension will not + upgrade minor versions unless redeployed, even with this property set to true. + :paramtype auto_upgrade_minor_version: bool + :keyword settings: Json formatted public settings for the extension. + :paramtype settings: any + :keyword protected_settings: The extension can contain either protectedSettings or + protectedSettingsFromKeyVault or no protected settings at all. + :paramtype protected_settings: any + :keyword force_update_tag: If a value is provided and is different from the previous value, the + extension handler will be forced to update even if the extension configuration has not changed. + :paramtype force_update_tag: str + :keyword provision_after_extensions: Collection of extension names after which this extension + needs to be provisioned. + :paramtype provision_after_extensions: list[str] + :keyword enable_automatic_upgrade: Indicates whether the extension should be automatically + upgraded by the platform if there is a newer version of the extension available. + :paramtype enable_automatic_upgrade: bool + """ super(VMSSExtension, self).__init__(**kwargs) self.name = name self.publisher = publisher @@ -3498,3 +5375,4 @@ def __init__( self.force_update_tag = force_update_tag self.provision_after_extensions = provision_after_extensions self.provisioning_state = None + self.enable_automatic_upgrade = enable_automatic_upgrade diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/models/_service_fabric_managed_clusters_management_client_enums.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/models/_service_fabric_managed_clusters_management_client_enums.py index b69adbbae5ff2..73dd5e51df3de 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/models/_service_fabric_managed_clusters_management_client_enums.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/models/_service_fabric_managed_clusters_management_client_enums.py @@ -6,34 +6,19 @@ # 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 Access(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Access(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The network traffic is allowed or denied. """ ALLOW = "allow" DENY = "deny" -class ClusterState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ClusterState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The current state of the cluster. """ @@ -53,7 +38,7 @@ class ClusterState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: Indicates that the cluster is in a stable state. 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. """ @@ -68,7 +53,7 @@ class ClusterUpgradeCadence(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)) #: clusters. WAVE2 = "Wave2" -class ClusterUpgradeMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ClusterUpgradeMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The upgrade mode of the cluster when new Service Fabric runtime version is available. """ @@ -80,14 +65,14 @@ class ClusterUpgradeMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: The cluster is upgraded by setting the **clusterCodeVersion** property in the cluster resource. MANUAL = "Manual" -class Direction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Direction(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Network security rule direction. """ INBOUND = "inbound" OUTBOUND = "outbound" -class DiskType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class DiskType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Managed data disk type. IOPS and throughput are given by the disk size, to see more information go to https://docs.microsoft.com/en-us/azure/virtual-machines/disks-types. """ @@ -100,7 +85,7 @@ class DiskType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: Premium SSD locally redundant storage. Best for production and performance sensitive workloads. PREMIUM_LRS = "Premium_LRS" -class FailureAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class FailureAction(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The compensating action to perform when a Monitored upgrade encounters monitoring policy or health policy violations. Invalid indicates the failure action is invalid. Rollback specifies that the upgrade will start rolling back automatically. Manual indicates that the upgrade will @@ -114,15 +99,31 @@ class FailureAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: fails. Service Fabric will not proceed to the next upgrade domain automatically. MANUAL = "Manual" -class ManagedClusterAddOnFeature(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class IPAddressType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """The IP address type. + """ + + #: IPv4 address type. + I_PV4 = "IPv4" + #: IPv6 address type. + I_PV6 = "IPv6" + +class ManagedClusterAddOnFeature(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Available cluster add-on features """ + #: Dns service. DNS_SERVICE = "DnsService" + #: Backup and restore service. BACKUP_RESTORE_SERVICE = "BackupRestoreService" + #: Resource monitor service. RESOURCE_MONITOR_SERVICE = "ResourceMonitorService" -class ManagedIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ManagedClusterVersionEnvironment(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + + WINDOWS = "Windows" + +class ManagedIdentityType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The type of managed identity for the resource. """ @@ -136,7 +137,7 @@ class ManagedIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: resource. SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned, UserAssigned" -class ManagedResourceProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ManagedResourceProvisioningState(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The provisioning state of the managed resource. """ @@ -151,7 +152,7 @@ class ManagedResourceProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, DELETED = "Deleted" OTHER = "Other" -class MoveCost(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class MoveCost(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Specifies the move cost for the service. """ @@ -164,7 +165,18 @@ class MoveCost(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: Specifies the move cost of the service as High. The value is 3. HIGH = "High" -class NsgProtocol(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class NodeTypeSkuScaleType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Node type capacity scale type. + """ + + #: Node count is not adjustable in any way (e.g. it is fixed). + NONE = "None" + #: The user must manually scale out/in. + MANUAL = "Manual" + #: Automatic scale is allowed. + AUTOMATIC = "Automatic" + +class NsgProtocol(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Network protocol this rule applies to. """ @@ -176,7 +188,14 @@ class NsgProtocol(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): AH = "ah" ESP = "esp" -class PartitionScheme(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class OsType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Cluster operating system, the default will be Windows + """ + + #: Indicates os is Windows. + WINDOWS = "Windows" + +class PartitionScheme(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Enumerates the ways that a service can be partitioned. """ @@ -190,7 +209,21 @@ class PartitionScheme(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: The value is 2. NAMED = "Named" -class ProbeProtocol(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PrivateEndpointNetworkPolicies(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Enable or Disable apply network policies on private end point in the subnet. + """ + + ENABLED = "enabled" + DISABLED = "disabled" + +class PrivateLinkServiceNetworkPolicies(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): + """Enable or Disable apply network policies on private link service in the subnet. + """ + + ENABLED = "enabled" + DISABLED = "disabled" + +class ProbeProtocol(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """the reference to the load balancer probe used by the load balancing rule. """ @@ -198,14 +231,14 @@ class ProbeProtocol(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): HTTP = "http" HTTPS = "https" -class Protocol(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class Protocol(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The reference to the transport protocol used by the load balancing rule. """ TCP = "tcp" UDP = "udp" -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 Monitored, and UnmonitoredAuto. """ @@ -217,7 +250,7 @@ class RollingUpgradeMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: 1. UNMONITORED_AUTO = "UnmonitoredAuto" -class ServiceCorrelationScheme(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ServiceCorrelationScheme(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The service correlation scheme. """ @@ -230,7 +263,7 @@ class ServiceCorrelationScheme(with_metaclass(_CaseInsensitiveEnumMeta, str, Enu #: be collocated. The value is 1. 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). """ @@ -240,7 +273,7 @@ class ServiceKind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: value is 1. 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. @@ -255,7 +288,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 ServicePackageActivationMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ServicePackageActivationMode(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """The activation Mode of the service package """ @@ -264,7 +297,7 @@ class ServicePackageActivationMode(with_metaclass(_CaseInsensitiveEnumMeta, str, #: Indicates the application package activation mode will use exclusive process. EXCLUSIVE_PROCESS = "ExclusiveProcess" -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. """ @@ -291,7 +324,7 @@ class ServicePlacementPolicyType(with_metaclass(_CaseInsensitiveEnumMeta, str, E #: replicas of a particular partition of the service should be placed atomically. The value is 4. NON_PARTIALLY_PLACE_SERVICE = "NonPartiallyPlaceService" -class ServiceScalingMechanismKind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ServiceScalingMechanismKind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Enumerates the ways that a service can be partitioned. """ @@ -302,18 +335,18 @@ class ServiceScalingMechanismKind(with_metaclass(_CaseInsensitiveEnumMeta, str, #: The value is 1. ADD_REMOVE_INCREMENTAL_NAMED_PARTITION = "AddRemoveIncrementalNamedPartition" -class ServiceScalingTriggerKind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ServiceScalingTriggerKind(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Enumerates the ways that a service can be partitioned. """ #: Represents a scaling trigger related to an average load of a metric/resource of a partition. #: The value is 0. - AVERAGE_PARTITION_LOAD = "AveragePartitionLoad" + AVERAGE_PARTITION_LOAD_TRIGGER = "AveragePartitionLoadTrigger" #: Represents a scaling policy related to an average load of a metric/resource of a service. The #: value is 1. - AVERAGE_SERVICE_LOAD = "AverageServiceLoad" + AVERAGE_SERVICE_LOAD_TRIGGER = "AverageServiceLoadTrigger" -class SkuName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SkuName(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)): """Sku Name. """ diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/__init__.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/__init__.py index c4e1c9fcc149f..03d5bfe84af0d 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/__init__.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/__init__.py @@ -11,9 +11,14 @@ from ._applications_operations import ApplicationsOperations from ._services_operations import ServicesOperations from ._managed_clusters_operations import ManagedClustersOperations +from ._managed_az_resiliency_status_operations import ManagedAzResiliencyStatusOperations from ._managed_cluster_version_operations import ManagedClusterVersionOperations +from ._managed_unsupported_vm_sizes_operations import ManagedUnsupportedVMSizesOperations +from ._operation_status_operations import OperationStatusOperations +from ._operation_results_operations import OperationResultsOperations from ._operations import Operations from ._node_types_operations import NodeTypesOperations +from ._node_type_skus_operations import NodeTypeSkusOperations __all__ = [ 'ApplicationTypesOperations', @@ -21,7 +26,12 @@ 'ApplicationsOperations', 'ServicesOperations', 'ManagedClustersOperations', + 'ManagedAzResiliencyStatusOperations', 'ManagedClusterVersionOperations', + 'ManagedUnsupportedVMSizesOperations', + 'OperationStatusOperations', + 'OperationResultsOperations', 'Operations', 'NodeTypesOperations', + 'NodeTypeSkusOperations', ] diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_application_type_versions_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_application_type_versions_operations.py index 96d08e8c530ec..22793a8311790 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_application_type_versions_operations.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_application_type_versions_operations.py @@ -5,25 +5,239 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings 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 msrest import Serializer 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_get_request( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + application_type_name: str, + version: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applicationTypes/{applicationTypeName}/versions/{version}') + 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: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2022-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applicationTypes/{applicationTypeName}/versions/{version}') + 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_update_request( + 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: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2022-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applicationTypes/{applicationTypeName}/versions/{version}') + 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="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_type_name: str, + version: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applicationTypes/{applicationTypeName}/versions/{version}') + 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_by_application_types_request( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + application_type_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applicationTypes/{applicationTypeName}/versions') + 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. @@ -47,15 +261,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 managed application type version resource. Get a Service Fabric managed application type version resource created or in the process of @@ -71,7 +285,8 @@ def get( :type version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ApplicationTypeVersionResource, or the result of cls(response) - :rtype: ~service_fabric_managed_clusters_management_client.models.ApplicationTypeVersionResource + :rtype: + ~service_fabric_managed_clusters_management_client.models.ApplicationTypeVersionResource :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationTypeVersionResource"] @@ -79,35 +294,25 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-05-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') + + 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, + 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) 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) @@ -116,58 +321,48 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{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-05-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _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, + 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) - 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) 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('ApplicationTypeVersionResource', pipeline_response) @@ -179,18 +374,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/managedclusters/{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 managed application type version resource. Create or update a Service Fabric managed application type version resource with the specified @@ -205,18 +402,24 @@ def begin_create_or_update( :param version: The application type version. :type version: str :param parameters: The application type version resource. - :type parameters: ~service_fabric_managed_clusters_management_client.models.ApplicationTypeVersionResource + :type parameters: + ~service_fabric_managed_clusters_management_client.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: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or 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[~service_fabric_managed_clusters_management_client.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[~service_fabric_managed_clusters_management_client.models.ApplicationTypeVersionResource] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationTypeVersionResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -230,29 +433,21 @@ def begin_create_or_update( application_type_name=application_type_name, version=version, parameters=parameters, + 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, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -264,18 +459,19 @@ def get_long_running_output(pipeline_response): ) 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/managedclusters/{clusterName}/applicationTypes/{applicationTypeName}/versions/{version}'} # type: ignore + @distributed_trace def update( self, - resource_group_name, # type: str - cluster_name, # type: str - application_type_name, # type: str - version, # type: str - parameters, # type: "_models.ApplicationTypeVersionUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.ApplicationTypeVersionResource" + resource_group_name: str, + cluster_name: str, + application_type_name: str, + version: str, + parameters: "_models.ApplicationTypeVersionUpdateParameters", + **kwargs: Any + ) -> "_models.ApplicationTypeVersionResource": """Updates the tags of an application type version resource of a given managed cluster. Updates the tags of an application type version resource of a given managed cluster. @@ -289,10 +485,12 @@ def update( :param version: The application type version. :type version: str :param parameters: The application type version resource updated tags. - :type parameters: ~service_fabric_managed_clusters_management_client.models.ApplicationTypeVersionUpdateParameters + :type parameters: + ~service_fabric_managed_clusters_management_client.models.ApplicationTypeVersionUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: ApplicationTypeVersionResource, or the result of cls(response) - :rtype: ~service_fabric_managed_clusters_management_client.models.ApplicationTypeVersionResource + :rtype: + ~service_fabric_managed_clusters_management_client.models.ApplicationTypeVersionResource :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationTypeVersionResource"] @@ -300,40 +498,30 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-05-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.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'), - '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ApplicationTypeVersionUpdateParameters') - # 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') + request = build_update_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, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ApplicationTypeVersionUpdateParameters') - 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) 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) @@ -342,67 +530,58 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applicationTypes/{applicationTypeName}/versions/{version}'} # type: ignore + def _delete_initial( 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-05-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') + + 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, + 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) 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) - 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/managedclusters/{clusterName}/applicationTypes/{applicationTypeName}/versions/{version}'} # type: ignore + + @distributed_trace def begin_delete( 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 managed application type version resource. Delete a Service Fabric managed application type version resource with the specified name. @@ -417,15 +596,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: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or 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 """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -441,23 +622,14 @@ def begin_delete( 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, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -469,17 +641,19 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applicationTypes/{applicationTypeName}/versions/{version}'} # type: ignore + @distributed_trace def list_by_application_types( self, - resource_group_name, # type: str - cluster_name, # type: str - application_type_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ApplicationTypeVersionResourceList"] - """Gets the list of application type version resources created in the specified Service Fabric managed application type name resource. + resource_group_name: str, + cluster_name: str, + application_type_name: str, + **kwargs: Any + ) -> Iterable["_models.ApplicationTypeVersionResourceList"]: + """Gets the list of application type version resources created in the specified Service Fabric + managed application type name resource. Gets all application type version resources created or in the process of being created in the Service Fabric managed application type name resource. @@ -491,8 +665,10 @@ def list_by_application_types( :param application_type_name: The name of the application type name resource. :type application_type_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ApplicationTypeVersionResourceList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~service_fabric_managed_clusters_management_client.models.ApplicationTypeVersionResourceList] + :return: An iterator like instance of either ApplicationTypeVersionResourceList or the result + of cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~service_fabric_managed_clusters_management_client.models.ApplicationTypeVersionResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationTypeVersionResourceList"] @@ -500,37 +676,35 @@ def list_by_application_types( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-05-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_by_application_types.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') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_application_types_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_type_name=application_type_name, + template_url=self.list_by_application_types.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_by_application_types_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_type_name=application_type_name, + 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('ApplicationTypeVersionResourceList', pipeline_response) + deserialized = self._deserialize("ApplicationTypeVersionResourceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -543,12 +717,13 @@ def get_next(next_link=None): 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 ) diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_application_types_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_application_types_operations.py index 75cd55c81f5ed..42c1c431e1bcc 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_application_types_operations.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_application_types_operations.py @@ -5,25 +5,229 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings 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 msrest import Serializer 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_get_request( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + application_type_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applicationTypes/{applicationTypeName}') + 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: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2022-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applicationTypes/{applicationTypeName}') + 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_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: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2022-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applicationTypes/{applicationTypeName}') + 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="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_type_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applicationTypes/{applicationTypeName}') + 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 = "2022-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applicationTypes') + 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. @@ -47,14 +251,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 managed application type name resource. Get a Service Fabric application type name resource created or in the process of being created @@ -76,34 +280,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-05-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') - # 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, + 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) 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) @@ -112,17 +306,19 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{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 managed application type name resource. Create or update a Service Fabric managed application type name resource with the specified @@ -135,7 +331,8 @@ def create_or_update( :param application_type_name: The name of the application type name resource. :type application_type_name: str :param parameters: The application type name resource. - :type parameters: ~service_fabric_managed_clusters_management_client.models.ApplicationTypeResource + :type parameters: + ~service_fabric_managed_clusters_management_client.models.ApplicationTypeResource :keyword callable cls: A custom type or function that will be passed the direct response :return: ApplicationTypeResource, or the result of cls(response) :rtype: ~service_fabric_managed_clusters_management_client.models.ApplicationTypeResource @@ -146,39 +343,29 @@ def create_or_update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-05-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _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, + 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) - 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) 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) @@ -187,17 +374,19 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applicationTypes/{applicationTypeName}'} # type: ignore + + @distributed_trace def update( self, - resource_group_name, # type: str - cluster_name, # type: str - application_type_name, # type: str - parameters, # type: "_models.ApplicationTypeUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.ApplicationTypeResource" + resource_group_name: str, + cluster_name: str, + application_type_name: str, + parameters: "_models.ApplicationTypeUpdateParameters", + **kwargs: Any + ) -> "_models.ApplicationTypeResource": """Updates the tags of an application type resource of a given managed cluster. Updates the tags of an application type resource of a given managed cluster. @@ -209,7 +398,8 @@ def update( :param application_type_name: The name of the application type name resource. :type application_type_name: str :param parameters: The application type resource updated tags. - :type parameters: ~service_fabric_managed_clusters_management_client.models.ApplicationTypeUpdateParameters + :type parameters: + ~service_fabric_managed_clusters_management_client.models.ApplicationTypeUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: ApplicationTypeResource, or the result of cls(response) :rtype: ~service_fabric_managed_clusters_management_client.models.ApplicationTypeResource @@ -220,39 +410,29 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-05-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ApplicationTypeUpdateParameters') - # 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') + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_type_name=application_type_name, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ApplicationTypeUpdateParameters') - 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) 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) @@ -261,64 +441,55 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applicationTypes/{applicationTypeName}'} # type: ignore + def _delete_initial( 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-05-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') - # 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, + 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) 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) - 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/managedclusters/{clusterName}/applicationTypes/{applicationTypeName}'} # type: ignore + + @distributed_trace def begin_delete( 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 managed application type name resource. Delete a Service Fabric managed application type name resource with the specified name. @@ -331,15 +502,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: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or 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 """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -354,22 +527,14 @@ def begin_delete( 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, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -381,16 +546,18 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applicationTypes/{applicationTypeName}'} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ApplicationTypeResourceList"] - """Gets the list of application type name resources created in the specified Service Fabric managed cluster resource. + resource_group_name: str, + cluster_name: str, + **kwargs: Any + ) -> Iterable["_models.ApplicationTypeResourceList"]: + """Gets the list of application type name resources created in the specified Service Fabric + managed cluster resource. Gets all application type name resources created or in the process of being created in the Service Fabric managed cluster resource. @@ -400,8 +567,10 @@ def list( :param cluster_name: The name of the cluster resource. :type cluster_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ApplicationTypeResourceList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~service_fabric_managed_clusters_management_client.models.ApplicationTypeResourceList] + :return: An iterator like instance of either ApplicationTypeResourceList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~service_fabric_managed_clusters_management_client.models.ApplicationTypeResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationTypeResourceList"] @@ -409,36 +578,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-05-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 - 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') - - 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, + cluster_name=cluster_name, + 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, + cluster_name=cluster_name, + 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('ApplicationTypeResourceList', pipeline_response) + deserialized = self._deserialize("ApplicationTypeResourceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -451,12 +617,13 @@ def get_next(next_link=None): 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 ) diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_applications_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_applications_operations.py index 86016af8a49d8..b97eb2b541582 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_applications_operations.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_applications_operations.py @@ -5,25 +5,229 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings 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 msrest import Serializer 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_get_request( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + application_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applications/{applicationName}') + 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: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2022-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applications/{applicationName}') + 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( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + application_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2022-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applications/{applicationName}') + 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 = "2022-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applications/{applicationName}') + 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 = "2022-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applications') + 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. @@ -47,14 +251,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 managed application resource. Get a Service Fabric managed application resource created or in the process of being created in @@ -76,34 +280,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-05-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') - - # 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, + 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) 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) @@ -112,56 +306,46 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{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-05-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _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, + 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) - 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) 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('ApplicationResource', pipeline_response) @@ -173,17 +357,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/managedclusters/{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 managed application resource. Create or update a Service Fabric managed application resource with the specified name. @@ -198,15 +384,20 @@ def begin_create_or_update( :type parameters: ~service_fabric_managed_clusters_management_client.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: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or 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) - :rtype: ~azure.core.polling.LROPoller[~service_fabric_managed_clusters_management_client.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 LROPoller that returns either ApplicationResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~service_fabric_managed_clusters_management_client.models.ApplicationResource] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -219,28 +410,21 @@ def begin_create_or_update( cluster_name=cluster_name, application_name=application_name, parameters=parameters, + 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, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -252,17 +436,18 @@ def get_long_running_output(pipeline_response): ) 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/managedclusters/{clusterName}/applications/{applicationName}'} # type: ignore + @distributed_trace def update( self, - resource_group_name, # type: str - cluster_name, # type: str - application_name, # type: str - parameters, # type: "_models.ApplicationUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.ApplicationResource" + resource_group_name: str, + cluster_name: str, + application_name: str, + parameters: "_models.ApplicationUpdateParameters", + **kwargs: Any + ) -> "_models.ApplicationResource": """Updates the tags of an application resource of a given managed cluster. Updates the tags of an application resource of a given managed cluster. @@ -274,7 +459,8 @@ def update( :param application_name: The name of the application resource. :type application_name: str :param parameters: The application resource updated tags. - :type parameters: ~service_fabric_managed_clusters_management_client.models.ApplicationUpdateParameters + :type parameters: + ~service_fabric_managed_clusters_management_client.models.ApplicationUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: ApplicationResource, or the result of cls(response) :rtype: ~service_fabric_managed_clusters_management_client.models.ApplicationResource @@ -285,39 +471,29 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-05-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.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'), - '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ApplicationUpdateParameters') - # 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') + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_name=application_name, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ApplicationUpdateParameters') - 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) 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) @@ -326,64 +502,55 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applications/{applicationName}'} # type: ignore + def _delete_initial( 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-05-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') - # 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, + 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) 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) - 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/managedclusters/{clusterName}/applications/{applicationName}'} # type: ignore + + @distributed_trace def begin_delete( 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 managed application resource. Delete a Service Fabric managed application resource with the specified name. @@ -396,15 +563,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: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or 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 """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -419,22 +588,14 @@ def begin_delete( 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, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -446,16 +607,18 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applications/{applicationName}'} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ApplicationResourceList"] - """Gets the list of managed application resources created in the specified Service Fabric cluster resource. + resource_group_name: str, + cluster_name: str, + **kwargs: Any + ) -> Iterable["_models.ApplicationResourceList"]: + """Gets the list of managed application resources created in the specified Service Fabric cluster + resource. Gets all managed application resources created or in the process of being created in the Service Fabric cluster resource. @@ -465,8 +628,10 @@ def list( :param cluster_name: The name of the cluster resource. :type cluster_name: str :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ApplicationResourceList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~service_fabric_managed_clusters_management_client.models.ApplicationResourceList] + :return: An iterator like instance of either ApplicationResourceList or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~service_fabric_managed_clusters_management_client.models.ApplicationResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationResourceList"] @@ -474,36 +639,33 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-05-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 - 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') - - 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, + cluster_name=cluster_name, + 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, + cluster_name=cluster_name, + 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('ApplicationResourceList', pipeline_response) + deserialized = self._deserialize("ApplicationResourceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -516,12 +678,13 @@ def get_next(next_link=None): 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 ) diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_managed_az_resiliency_status_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_managed_az_resiliency_status_operations.py new file mode 100644 index 0000000000000..4884fbb79d0d2 --- /dev/null +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_managed_az_resiliency_status_operations.py @@ -0,0 +1,138 @@ +# 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 functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar +import warnings + +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 msrest import Serializer + +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_request( + resource_group_name: str, + cluster_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/azresiliencystatus') + 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 + ) + +class ManagedAzResiliencyStatusOperations(object): + """ManagedAzResiliencyStatusOperations 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: ~service_fabric_managed_clusters_management_client.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( + self, + resource_group_name: str, + cluster_name: str, + **kwargs: Any + ) -> "_models.ManagedAzResiliencyStatus": + """Get Az Resiliency Status of all the Base resources constituting Service Fabric Managed + Clusters. + + Get Az Resiliency Status of all the Base resources constituting Service Fabric Managed + Clusters. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. + :type cluster_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedAzResiliencyStatus, or the result of cls(response) + :rtype: ~service_fabric_managed_clusters_management_client.models.ManagedAzResiliencyStatus + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedAzResiliencyStatus"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + 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) + 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, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ManagedAzResiliencyStatus', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/azresiliencystatus'} # type: ignore + diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_managed_cluster_version_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_managed_cluster_version_operations.py index 5a66181029381..b3765dce6d4c5 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_managed_cluster_version_operations.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_managed_cluster_version_operations.py @@ -5,22 +5,164 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, List, Optional, TypeVar, Union import warnings 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 msrest import Serializer from .. import models as _models - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, List, 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') +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 = "2022-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/managedClusterVersions/{clusterVersion}') + 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.ManagedClusterVersionEnvironment"], + subscription_id: str, + cluster_version: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/environments/{environment}/managedClusterVersions/{clusterVersion}') + 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 = "2022-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/managedClusterVersions') + 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.ManagedClusterVersionEnvironment"], + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/environments/{environment}/managedClusterVersions') + 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 ManagedClusterVersionOperations(object): """ManagedClusterVersionOperations operations. @@ -44,14 +186,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.ManagedClusterCodeVersionResult" - """Gets information about a Service Fabric managed cluster code version available in the specified location. + location: str, + cluster_version: str, + **kwargs: Any + ) -> "_models.ManagedClusterCodeVersionResult": + """Gets information about a Service Fabric managed cluster code version available in the specified + location. Gets information about an available Service Fabric managed cluster code version. @@ -62,7 +205,8 @@ def get( :type cluster_version: str :keyword callable cls: A custom type or function that will be passed the direct response :return: ManagedClusterCodeVersionResult, or the result of cls(response) - :rtype: ~service_fabric_managed_clusters_management_client.models.ManagedClusterCodeVersionResult + :rtype: + ~service_fabric_managed_clusters_management_client.models.ManagedClusterCodeVersionResult :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterCodeVersionResult"] @@ -70,33 +214,23 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-05-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') + + request = build_get_request( + location=location, + subscription_id=self._config.subscription_id, + cluster_version=cluster_version, + template_url=self.get.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # 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) 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('ManagedClusterCodeVersionResult', pipeline_response) @@ -105,27 +239,35 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/managedClusterVersions/{clusterVersion}'} # type: ignore + + @distributed_trace def get_by_environment( self, - location, # type: str - cluster_version, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ManagedClusterCodeVersionResult" - """Gets information about a Service Fabric cluster code version available for the specified environment. + location: str, + environment: Union[str, "_models.ManagedClusterVersionEnvironment"], + cluster_version: str, + **kwargs: Any + ) -> "_models.ManagedClusterCodeVersionResult": + """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. :param location: The location for the cluster code versions. This is different from cluster location. :type location: str + :param environment: The operating system of the cluster. The default means all. + :type environment: str or + ~service_fabric_managed_clusters_management_client.models.ManagedClusterVersionEnvironment :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 :return: ManagedClusterCodeVersionResult, or the result of cls(response) - :rtype: ~service_fabric_managed_clusters_management_client.models.ManagedClusterCodeVersionResult + :rtype: + ~service_fabric_managed_clusters_management_client.models.ManagedClusterCodeVersionResult :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterCodeVersionResult"] @@ -133,35 +275,24 @@ def get_by_environment( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - environment = "Windows" - api_version = "2021-05-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') + + request = build_get_by_environment_request( + location=location, + environment=environment, + subscription_id=self._config.subscription_id, + cluster_version=cluster_version, + template_url=self.get_by_environment.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - # 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) 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('ManagedClusterCodeVersionResult', pipeline_response) @@ -170,14 +301,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}/managedClusterVersions/{clusterVersion}'} # type: ignore + + @distributed_trace def list( self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> List["_models.ManagedClusterCodeVersionResult"] + location: str, + **kwargs: Any + ) -> List["_models.ManagedClusterCodeVersionResult"]: """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. @@ -187,7 +320,8 @@ def list( :type location: str :keyword callable cls: A custom type or function that will be passed the direct response :return: list of ManagedClusterCodeVersionResult, or the result of cls(response) - :rtype: list[~service_fabric_managed_clusters_management_client.models.ManagedClusterCodeVersionResult] + :rtype: + list[~service_fabric_managed_clusters_management_client.models.ManagedClusterCodeVersionResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[List["_models.ManagedClusterCodeVersionResult"]] @@ -195,32 +329,22 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-05-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 = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + 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) 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('[ManagedClusterCodeVersionResult]', pipeline_response) @@ -229,14 +353,17 @@ def list( return cls(pipeline_response, deserialized, {}) return deserialized + list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/managedClusterVersions'} # type: ignore + + @distributed_trace def list_by_environment( self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> List["_models.ManagedClusterCodeVersionResult"] + location: str, + environment: Union[str, "_models.ManagedClusterVersionEnvironment"], + **kwargs: Any + ) -> List["_models.ManagedClusterCodeVersionResult"]: """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. @@ -244,9 +371,13 @@ def list_by_environment( :param location: The location for the cluster code versions. This is different from cluster location. :type location: str + :param environment: The operating system of the cluster. The default means all. + :type environment: str or + ~service_fabric_managed_clusters_management_client.models.ManagedClusterVersionEnvironment :keyword callable cls: A custom type or function that will be passed the direct response :return: list of ManagedClusterCodeVersionResult, or the result of cls(response) - :rtype: list[~service_fabric_managed_clusters_management_client.models.ManagedClusterCodeVersionResult] + :rtype: + list[~service_fabric_managed_clusters_management_client.models.ManagedClusterCodeVersionResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType[List["_models.ManagedClusterCodeVersionResult"]] @@ -254,34 +385,23 @@ def list_by_environment( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - environment = "Windows" - api_version = "2021-05-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 = build_list_by_environment_request( + location=location, + environment=environment, + subscription_id=self._config.subscription_id, + template_url=self.list_by_environment.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) 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('[ManagedClusterCodeVersionResult]', pipeline_response) @@ -290,4 +410,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}/managedClusterVersions'} # type: ignore + diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_managed_clusters_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_managed_clusters_operations.py index b51fdd547e974..90a34789adedb 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_managed_clusters_operations.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_managed_clusters_operations.py @@ -5,25 +5,250 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings 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 msrest import Serializer 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_by_resource_group_request( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters') + 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_by_subscription_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/managedClusters') + 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_get_request( + resource_group_name: str, + cluster_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}') + 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: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2022-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}') + 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( + resource_group_name: str, + cluster_name: str, + subscription_id: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2022-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}') + 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_initial( + resource_group_name: str, + cluster_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}') + 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 + ) class ManagedClustersOperations(object): """ManagedClustersOperations operations. @@ -47,12 +272,12 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ManagedClusterListResult"] + resource_group_name: str, + **kwargs: Any + ) -> Iterable["_models.ManagedClusterListResult"]: """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 @@ -61,8 +286,10 @@ def list_by_resource_group( :param resource_group_name: The name of the resource group. :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 ManagedClusterListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~service_fabric_managed_clusters_management_client.models.ManagedClusterListResult] + :return: An iterator like instance of either ManagedClusterListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~service_fabric_managed_clusters_management_client.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] @@ -70,35 +297,31 @@ def list_by_resource_group( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-05-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_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') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + template_url=self.list_by_resource_group.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_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + 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('ManagedClusterListResult', pipeline_response) + deserialized = self._deserialize("ManagedClusterListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -111,30 +334,33 @@ def get_next(next_link=None): 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_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters'} # type: ignore + @distributed_trace def list_by_subscription( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ManagedClusterListResult"] + **kwargs: Any + ) -> Iterable["_models.ManagedClusterListResult"]: """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 subscription. :keyword callable cls: A custom type or function that will be passed the direct response - :return: An iterator like instance of either ManagedClusterListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~service_fabric_managed_clusters_management_client.models.ManagedClusterListResult] + :return: An iterator like instance of either ManagedClusterListResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~service_fabric_managed_clusters_management_client.models.ManagedClusterListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] @@ -142,34 +368,29 @@ def list_by_subscription( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-05-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_by_subscription.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') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_subscription_request( + subscription_id=self._config.subscription_id, + template_url=self.list_by_subscription.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_by_subscription_request( + subscription_id=self._config.subscription_id, + 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('ManagedClusterListResult', pipeline_response) + deserialized = self._deserialize("ManagedClusterListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -182,24 +403,25 @@ def get_next(next_link=None): 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_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/managedClusters'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ManagedCluster" + resource_group_name: str, + cluster_name: str, + **kwargs: Any + ) -> "_models.ManagedCluster": """Gets a Service Fabric managed cluster resource. Get a Service Fabric managed cluster resource created or in the process of being created in the @@ -219,33 +441,23 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-05-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') - - # 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, + 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) 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('ManagedCluster', pipeline_response) @@ -254,54 +466,44 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}'} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - cluster_name, # type: str - parameters, # type: "_models.ManagedCluster" - **kwargs # type: Any - ): - # type: (...) -> "_models.ManagedCluster" + resource_group_name: str, + cluster_name: str, + parameters: "_models.ManagedCluster", + **kwargs: Any + ) -> "_models.ManagedCluster": cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-05-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'ManagedCluster') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + 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) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ManagedCluster') - 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) 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('ManagedCluster', pipeline_response) @@ -313,16 +515,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/managedClusters/{clusterName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - cluster_name, # type: str - parameters, # type: "_models.ManagedCluster" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ManagedCluster"] + resource_group_name: str, + cluster_name: str, + parameters: "_models.ManagedCluster", + **kwargs: Any + ) -> LROPoller["_models.ManagedCluster"]: """Creates or updates a Service Fabric managed cluster resource. Create or update a Service Fabric managed cluster resource with the specified name. @@ -335,15 +539,20 @@ def begin_create_or_update( :type parameters: ~service_fabric_managed_clusters_management_client.models.ManagedCluster :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: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or 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 ManagedCluster or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~service_fabric_managed_clusters_management_client.models.ManagedCluster] - :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 ManagedCluster or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~service_fabric_managed_clusters_management_client.models.ManagedCluster] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] lro_delay = kwargs.pop( 'polling_interval', @@ -355,27 +564,21 @@ def begin_create_or_update( resource_group_name=resource_group_name, cluster_name=cluster_name, parameters=parameters, + 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('ManagedCluster', 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, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -387,16 +590,17 @@ def get_long_running_output(pipeline_response): ) 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/managedClusters/{clusterName}'} # type: ignore + @distributed_trace def update( self, - resource_group_name, # type: str - cluster_name, # type: str - parameters, # type: "_models.ManagedClusterUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.ManagedCluster" + resource_group_name: str, + cluster_name: str, + parameters: "_models.ManagedClusterUpdateParameters", + **kwargs: Any + ) -> "_models.ManagedCluster": """Updates the tags of of a Service Fabric managed cluster resource. Update the tags of of a Service Fabric managed cluster resource with the specified name. @@ -406,7 +610,8 @@ def update( :param cluster_name: The name of the cluster resource. :type cluster_name: str :param parameters: The managed cluster resource updated tags. - :type parameters: ~service_fabric_managed_clusters_management_client.models.ManagedClusterUpdateParameters + :type parameters: + ~service_fabric_managed_clusters_management_client.models.ManagedClusterUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: ManagedCluster, or the result of cls(response) :rtype: ~service_fabric_managed_clusters_management_client.models.ManagedCluster @@ -417,38 +622,28 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-05-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.update.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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'ManagedClusterUpdateParameters') + + request = build_update_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ManagedClusterUpdateParameters') - 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) 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('ManagedCluster', pipeline_response) @@ -457,61 +652,52 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}'} # type: ignore + def _delete_initial( 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: 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-05-01" - accept = "application/json" - - # Construct URL - url = self._delete_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['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + 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) 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) - 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/managedClusters/{clusterName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + cluster_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a Service Fabric managed cluster resource. Delete a Service Fabric managed cluster resource with the specified name. @@ -522,15 +708,17 @@ def begin_delete( :type cluster_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: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or 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 """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -544,21 +732,14 @@ def begin_delete( 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 = { - '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, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -570,4 +751,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}'} # type: ignore diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_managed_unsupported_vm_sizes_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_managed_unsupported_vm_sizes_operations.py new file mode 100644 index 0000000000000..08f3587279135 --- /dev/null +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_managed_unsupported_vm_sizes_operations.py @@ -0,0 +1,245 @@ +# 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar +import warnings + +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 msrest import Serializer + +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( + location: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/managedUnsupportedVMSizes') + 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_get_request( + location: str, + subscription_id: str, + vm_size: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/managedUnsupportedVMSizes/{vmSize}') + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "vmSize": _SERIALIZER.url("vm_size", vm_size, '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 ManagedUnsupportedVMSizesOperations(object): + """ManagedUnsupportedVMSizesOperations 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: ~service_fabric_managed_clusters_management_client.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, + location: str, + **kwargs: Any + ) -> Iterable["_models.ManagedVMSizesResult"]: + """Get the lists of unsupported vm sizes for Service Fabric Managed Clusters. + + Get the lists of unsupported vm sizes for Service Fabric Managed Clusters. + + :param location: The location for the cluster code versions. This is different from cluster + location. + :type location: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ManagedVMSizesResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~service_fabric_managed_clusters_management_client.models.ManagedVMSizesResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedVMSizesResult"] + 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( + location=location, + subscription_id=self._config.subscription_id, + template_url=self.list.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) + + else: + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + 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("ManagedVMSizesResult", 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(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, 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.ServiceFabric/locations/{location}/managedUnsupportedVMSizes'} # type: ignore + + @distributed_trace + def get( + self, + location: str, + vm_size: str, + **kwargs: Any + ) -> "_models.ManagedVMSize": + """Get unsupported vm size for Service Fabric Managed Clusters. + + Get unsupported vm size for Service Fabric Managed Clusters. + + :param location: The location for the cluster code versions. This is different from cluster + location. + :type location: str + :param vm_size: VM Size name. + :type vm_size: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedVMSize, or the result of cls(response) + :rtype: ~service_fabric_managed_clusters_management_client.models.ManagedVMSize + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedVMSize"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + location=location, + subscription_id=self._config.subscription_id, + vm_size=vm_size, + 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) + 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, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ManagedVMSize', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/managedUnsupportedVMSizes/{vmSize}'} # type: ignore + diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_node_type_skus_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_node_type_skus_operations.py new file mode 100644 index 0000000000000..d01decb4c58b0 --- /dev/null +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_node_type_skus_operations.py @@ -0,0 +1,168 @@ +# 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar +import warnings + +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 msrest import Serializer + +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, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/nodeTypes/{nodeTypeName}/skus') + 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'), + "nodeTypeName": _SERIALIZER.url("node_type_name", node_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 NodeTypeSkusOperations(object): + """NodeTypeSkusOperations 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: ~service_fabric_managed_clusters_management_client.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, + cluster_name: str, + node_type_name: str, + **kwargs: Any + ) -> Iterable["_models.NodeTypeListSkuResult"]: + """Gets a Service Fabric node type SKUs. + + Get a Service Fabric node type supported SKUs. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. + :type cluster_name: str + :param node_type_name: The name of the node type. + :type node_type_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NodeTypeListSkuResult or the result of + cls(response) + :rtype: + ~azure.core.paging.ItemPaged[~service_fabric_managed_clusters_management_client.models.NodeTypeListSkuResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NodeTypeListSkuResult"] + 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, + cluster_name=cluster_name, + node_type_name=node_type_name, + 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, + cluster_name=cluster_name, + node_type_name=node_type_name, + 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("NodeTypeListSkuResult", 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(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, 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.ServiceFabric/managedClusters/{clusterName}/nodeTypes/{nodeTypeName}/skus'} # type: ignore diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_node_types_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_node_types_operations.py index 337b2f27e979a..fe56458cce729 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_node_types_operations.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_node_types_operations.py @@ -5,25 +5,367 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings 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 msrest import Serializer 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_by_managed_clusters_request( + resource_group_name: str, + subscription_id: str, + cluster_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/nodeTypes') + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, '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 + ) + + +def build_restart_request_initial( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2022-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/nodeTypes/{nodeTypeName}/restart') + 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'), + "nodeTypeName": _SERIALIZER.url("node_type_name", node_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="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_reimage_request_initial( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2022-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/nodeTypes/{nodeTypeName}/reimage') + 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'), + "nodeTypeName": _SERIALIZER.url("node_type_name", node_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="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_delete_node_request_initial( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2022-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/nodeTypes/{nodeTypeName}/deleteNode') + 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'), + "nodeTypeName": _SERIALIZER.url("node_type_name", node_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="POST", + url=url, + params=query_parameters, + headers=header_parameters, + json=json, + content=content, + **kwargs + ) + + +def build_get_request( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/nodeTypes/{nodeTypeName}') + 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'), + "nodeTypeName": _SERIALIZER.url("node_type_name", node_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_initial( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2022-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/nodeTypes/{nodeTypeName}') + 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'), + "nodeTypeName": _SERIALIZER.url("node_type_name", node_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_update_request( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + *, + json: JSONType = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2022-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/nodeTypes/{nodeTypeName}') + 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'), + "nodeTypeName": _SERIALIZER.url("node_type_name", node_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="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, + node_type_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/nodeTypes/{nodeTypeName}') + 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'), + "nodeTypeName": _SERIALIZER.url("node_type_name", node_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 + ) class NodeTypesOperations(object): """NodeTypesOperations operations. @@ -47,13 +389,13 @@ def __init__(self, client, config, serializer, deserializer): self._deserialize = deserializer self._config = config + @distributed_trace def list_by_managed_clusters( self, - resource_group_name, # type: str - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.NodeTypeListResult"] + resource_group_name: str, + cluster_name: str, + **kwargs: Any + ) -> Iterable["_models.NodeTypeListResult"]: """Gets the list of Node types of the specified managed cluster. Gets all Node types of the specified managed cluster. @@ -64,7 +406,8 @@ def list_by_managed_clusters( :type cluster_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either NodeTypeListResult or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~service_fabric_managed_clusters_management_client.models.NodeTypeListResult] + :rtype: + ~azure.core.paging.ItemPaged[~service_fabric_managed_clusters_management_client.models.NodeTypeListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.NodeTypeListResult"] @@ -72,36 +415,33 @@ def list_by_managed_clusters( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-05-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_by_managed_clusters.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'), - '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') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_managed_clusters_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + cluster_name=cluster_name, + template_url=self.list_by_managed_clusters.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_by_managed_clusters_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + cluster_name=cluster_name, + 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('NodeTypeListResult', pipeline_response) + deserialized = self._deserialize("NodeTypeListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -114,12 +454,13 @@ def get_next(next_link=None): 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 ) @@ -127,67 +468,56 @@ def get_next(next_link=None): def _restart_initial( self, - resource_group_name, # type: str - cluster_name, # type: str - node_type_name, # type: str - parameters, # type: "_models.NodeTypeActionParameters" - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: "_models.NodeTypeActionParameters", + **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-05-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._restart_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'), - 'nodeTypeName': self._serialize.url("node_type_name", node_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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'NodeTypeActionParameters') - # 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') + request = build_restart_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + node_type_name=node_type_name, + content_type=content_type, + json=_json, + template_url=self._restart_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'NodeTypeActionParameters') - 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) 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 cls: return cls(pipeline_response, None, {}) _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/nodeTypes/{nodeTypeName}/restart'} # type: ignore + + @distributed_trace def begin_restart( self, - resource_group_name, # type: str - cluster_name, # type: str - node_type_name, # type: str - parameters, # type: "_models.NodeTypeActionParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: "_models.NodeTypeActionParameters", + **kwargs: Any + ) -> LROPoller[None]: """Restarts one or more nodes on the node type. Restarts one or more nodes on the node type. It will disable the fabric nodes, trigger a @@ -200,18 +530,22 @@ def begin_restart( :param node_type_name: The name of the node type. :type node_type_name: str :param parameters: parameters for restart action. - :type parameters: ~service_fabric_managed_clusters_management_client.models.NodeTypeActionParameters + :type parameters: + ~service_fabric_managed_clusters_management_client.models.NodeTypeActionParameters :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: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or 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 """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -224,25 +558,18 @@ def begin_restart( cluster_name=cluster_name, node_type_name=node_type_name, parameters=parameters, + 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): 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'), - 'nodeTypeName': self._serialize.url("node_type_name", node_type_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -254,71 +581,61 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_restart.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/nodeTypes/{nodeTypeName}/restart'} # type: ignore def _reimage_initial( self, - resource_group_name, # type: str - cluster_name, # type: str - node_type_name, # type: str - parameters, # type: "_models.NodeTypeActionParameters" - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: "_models.NodeTypeActionParameters", + **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-05-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._reimage_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'), - 'nodeTypeName': self._serialize.url("node_type_name", node_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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _json = self._serialize.body(parameters, 'NodeTypeActionParameters') + + request = build_reimage_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + node_type_name=node_type_name, + content_type=content_type, + json=_json, + template_url=self._reimage_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'NodeTypeActionParameters') - 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) 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 cls: return cls(pipeline_response, None, {}) _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/nodeTypes/{nodeTypeName}/reimage'} # type: ignore + + @distributed_trace def begin_reimage( self, - resource_group_name, # type: str - cluster_name, # type: str - node_type_name, # type: str - parameters, # type: "_models.NodeTypeActionParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: "_models.NodeTypeActionParameters", + **kwargs: Any + ) -> LROPoller[None]: """Reimages one or more nodes on the node type. Reimages one or more nodes on the node type. It will disable the fabric nodes, trigger a @@ -331,18 +648,22 @@ def begin_reimage( :param node_type_name: The name of the node type. :type node_type_name: str :param parameters: parameters for reimage action. - :type parameters: ~service_fabric_managed_clusters_management_client.models.NodeTypeActionParameters + :type parameters: + ~service_fabric_managed_clusters_management_client.models.NodeTypeActionParameters :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: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or 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 """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -355,25 +676,18 @@ def begin_reimage( cluster_name=cluster_name, node_type_name=node_type_name, parameters=parameters, + 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): 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'), - 'nodeTypeName': self._serialize.url("node_type_name", node_type_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -385,71 +699,61 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_reimage.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/nodeTypes/{nodeTypeName}/reimage'} # type: ignore def _delete_node_initial( self, - resource_group_name, # type: str - cluster_name, # type: str - node_type_name, # type: str - parameters, # type: "_models.NodeTypeActionParameters" - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: "_models.NodeTypeActionParameters", + **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-05-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._delete_node_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'), - 'nodeTypeName': self._serialize.url("node_type_name", node_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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'NodeTypeActionParameters') - # 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') + request = build_delete_node_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + node_type_name=node_type_name, + content_type=content_type, + json=_json, + template_url=self._delete_node_initial.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'NodeTypeActionParameters') - 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) 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 cls: return cls(pipeline_response, None, {}) _delete_node_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/nodeTypes/{nodeTypeName}/deleteNode'} # type: ignore + + @distributed_trace def begin_delete_node( self, - resource_group_name, # type: str - cluster_name, # type: str - node_type_name, # type: str - parameters, # type: "_models.NodeTypeActionParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: "_models.NodeTypeActionParameters", + **kwargs: Any + ) -> LROPoller[None]: """Deletes one or more nodes on the node type. Deletes one or more nodes on the node type. It will disable the fabric nodes, trigger a delete @@ -462,18 +766,22 @@ def begin_delete_node( :param node_type_name: The name of the node type. :type node_type_name: str :param parameters: parameters for delete action. - :type parameters: ~service_fabric_managed_clusters_management_client.models.NodeTypeActionParameters + :type parameters: + ~service_fabric_managed_clusters_management_client.models.NodeTypeActionParameters :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: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or 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 """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -486,25 +794,18 @@ def begin_delete_node( cluster_name=cluster_name, node_type_name=node_type_name, parameters=parameters, + 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): 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'), - 'nodeTypeName': self._serialize.url("node_type_name", node_type_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -516,16 +817,17 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete_node.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/nodeTypes/{nodeTypeName}/deleteNode'} # type: ignore + @distributed_trace def get( self, - resource_group_name, # type: str - cluster_name, # type: str - node_type_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.NodeType" + resource_group_name: str, + cluster_name: str, + node_type_name: str, + **kwargs: Any + ) -> "_models.NodeType": """Gets a Service Fabric node type. Get a Service Fabric node type of a given managed cluster. @@ -546,34 +848,24 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-05-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'), - 'nodeTypeName': self._serialize.url("node_type_name", node_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['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, + node_type_name=node_type_name, + 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) 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('NodeType', pipeline_response) @@ -582,56 +874,46 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/nodeTypes/{nodeTypeName}'} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - cluster_name, # type: str - node_type_name, # type: str - parameters, # type: "_models.NodeType" - **kwargs # type: Any - ): - # type: (...) -> "_models.NodeType" + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: "_models.NodeType", + **kwargs: Any + ) -> "_models.NodeType": cls = kwargs.pop('cls', None) # type: ClsType["_models.NodeType"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-05-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'), - 'nodeTypeName': self._serialize.url("node_type_name", node_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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'NodeType') - # 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') + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + node_type_name=node_type_name, + 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) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'NodeType') - 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) 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('NodeType', pipeline_response) @@ -643,17 +925,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/managedClusters/{clusterName}/nodeTypes/{nodeTypeName}'} # type: ignore + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - cluster_name, # type: str - node_type_name, # type: str - parameters, # type: "_models.NodeType" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.NodeType"] + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: "_models.NodeType", + **kwargs: Any + ) -> LROPoller["_models.NodeType"]: """Creates or updates a Service Fabric node type. Create or update a Service Fabric node type of a given managed cluster. @@ -668,15 +952,19 @@ def begin_create_or_update( :type parameters: ~service_fabric_managed_clusters_management_client.models.NodeType :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: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or 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 NodeType or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~service_fabric_managed_clusters_management_client.models.NodeType] - :raises ~azure.core.exceptions.HttpResponseError: + :rtype: + ~azure.core.polling.LROPoller[~service_fabric_managed_clusters_management_client.models.NodeType] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.NodeType"] lro_delay = kwargs.pop( 'polling_interval', @@ -689,28 +977,21 @@ def begin_create_or_update( cluster_name=cluster_name, node_type_name=node_type_name, parameters=parameters, + 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('NodeType', 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'), - 'nodeTypeName': self._serialize.url("node_type_name", node_type_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -722,17 +1003,18 @@ def get_long_running_output(pipeline_response): ) 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/managedClusters/{clusterName}/nodeTypes/{nodeTypeName}'} # type: ignore + @distributed_trace def update( self, - resource_group_name, # type: str - cluster_name, # type: str - node_type_name, # type: str - parameters, # type: "_models.NodeTypeUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.NodeType" + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: "_models.NodeTypeUpdateParameters", + **kwargs: Any + ) -> "_models.NodeType": """Update the tags of a node type resource of a given managed cluster. Update the configuration of a node type of a given managed cluster, only updating tags. @@ -744,7 +1026,8 @@ def update( :param node_type_name: The name of the node type. :type node_type_name: str :param parameters: The parameters to update the node type configuration. - :type parameters: ~service_fabric_managed_clusters_management_client.models.NodeTypeUpdateParameters + :type parameters: + ~service_fabric_managed_clusters_management_client.models.NodeTypeUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: NodeType, or the result of cls(response) :rtype: ~service_fabric_managed_clusters_management_client.models.NodeType @@ -755,39 +1038,29 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-05-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.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'), - 'nodeTypeName': self._serialize.url("node_type_name", node_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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'NodeTypeUpdateParameters') - # 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') + request = build_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + node_type_name=node_type_name, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'NodeTypeUpdateParameters') - 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) 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('NodeType', pipeline_response) @@ -796,64 +1069,55 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/nodeTypes/{nodeTypeName}'} # type: ignore + def _delete_initial( self, - resource_group_name, # type: str - cluster_name, # type: str - node_type_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + cluster_name: str, + node_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-05-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'), - 'nodeTypeName': self._serialize.url("node_type_name", node_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['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, + node_type_name=node_type_name, + 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) 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) - 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/managedClusters/{clusterName}/nodeTypes/{nodeTypeName}'} # type: ignore + + @distributed_trace def begin_delete( self, - resource_group_name, # type: str - cluster_name, # type: str - node_type_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + cluster_name: str, + node_type_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a Service Fabric node type. Delete a Service Fabric node type of a given managed cluster. @@ -866,15 +1130,17 @@ def begin_delete( :type node_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: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or 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 """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -889,22 +1155,14 @@ def begin_delete( 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'), - 'nodeTypeName': self._serialize.url("node_type_name", node_type_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -916,4 +1174,5 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/nodeTypes/{nodeTypeName}'} # type: ignore diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_operation_results_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_operation_results_operations.py new file mode 100644 index 0000000000000..4535705aa19ed --- /dev/null +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_operation_results_operations.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. +# -------------------------------------------------------------------------- +import functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar +import warnings + +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 msrest import Serializer + +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_request( + subscription_id: str, + location: str, + operation_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/managedClusterOperationResults/{operationId}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "location": _SERIALIZER.url("location", location, 'str'), + "operationId": _SERIALIZER.url("operation_id", operation_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 OperationResultsOperations(object): + """OperationResultsOperations 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: ~service_fabric_managed_clusters_management_client.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( + self, + location: str, + operation_id: str, + **kwargs: Any + ) -> None: + """Get long running operation result. + + Get long running operation result. + + :param location: The location for the cluster code versions. This is different from cluster + location. + :type location: str + :param operation_id: operation identifier. + :type operation_id: 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', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + location=location, + operation_id=operation_id, + 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) + 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) + 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, {}) + + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/managedClusterOperationResults/{operationId}'} # type: ignore + diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_operation_status_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_operation_status_operations.py new file mode 100644 index 0000000000000..b52fe4f7a08ce --- /dev/null +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_operation_status_operations.py @@ -0,0 +1,137 @@ +# 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 functools +from typing import Any, Callable, Dict, Generic, Optional, TypeVar +import warnings + +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 msrest import Serializer + +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_request( + subscription_id: str, + location: str, + operation_id: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/managedClusterOperations/{operationId}') + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "location": _SERIALIZER.url("location", location, 'str'), + "operationId": _SERIALIZER.url("operation_id", operation_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 OperationStatusOperations(object): + """OperationStatusOperations 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: ~service_fabric_managed_clusters_management_client.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( + self, + location: str, + operation_id: str, + **kwargs: Any + ) -> "_models.LongRunningOperationResult": + """Get long running operation status. + + Get long running operation status. + + :param location: The location for the cluster code versions. This is different from cluster + location. + :type location: str + :param operation_id: operation identifier. + :type operation_id: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: LongRunningOperationResult, or the result of cls(response) + :rtype: ~service_fabric_managed_clusters_management_client.models.LongRunningOperationResult + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.LongRunningOperationResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + + + request = build_get_request( + subscription_id=self._config.subscription_id, + location=location, + operation_id=operation_id, + 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) + 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, pipeline_response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('LongRunningOperationResult', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + + get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/managedClusterOperations/{operationId}'} # type: ignore + diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_operations.py index 96b28db7ca729..507a1a205392f 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_operations.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_operations.py @@ -5,23 +5,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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar import warnings 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 msrest import Serializer 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 = "2022-02-01-preview" + 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,18 +72,19 @@ 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. :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[~service_fabric_managed_clusters_management_client.models.OperationListResult] + :rtype: + ~azure.core.paging.ItemPaged[~service_fabric_managed_clusters_management_client.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] @@ -64,30 +92,27 @@ def list( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-05-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( + 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( + 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) @@ -100,12 +125,13 @@ def get_next(next_link=None): 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 ) diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_services_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_services_operations.py index eb9645bdb4011..5b15f413c15ac 100644 --- a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_services_operations.py +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_services_operations.py @@ -5,25 +5,239 @@ # 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 functools +from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union import warnings 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 msrest import Serializer 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_get_request( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + application_name: str, + service_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applications/{applicationName}/services/{serviceName}') + 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: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2022-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applications/{applicationName}/services/{serviceName}') + 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( + 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: + content_type = kwargs.pop('content_type', None) # type: Optional[str] + + api_version = "2022-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applications/{applicationName}/services/{serviceName}') + 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 = "2022-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applications/{applicationName}/services/{serviceName}') + 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_by_applications_request( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + application_name: str, + **kwargs: Any +) -> HttpRequest: + api_version = "2022-02-01-preview" + accept = "application/json" + # Construct URL + url = kwargs.pop("template_url", '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applications/{applicationName}/services') + 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. @@ -47,15 +261,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 managed service resource. Get a Service Fabric service resource created or in the process of being created in the Service @@ -80,35 +294,25 @@ def get( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-05-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') + + 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, + 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) 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) @@ -117,58 +321,48 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{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-05-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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[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') + _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, + 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) - 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) 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('ServiceResource', pipeline_response) @@ -180,18 +374,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/managedclusters/{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 managed service resource. Create or update a Service Fabric managed service resource with the specified name. @@ -209,15 +405,20 @@ def begin_create_or_update( :type parameters: ~service_fabric_managed_clusters_management_client.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: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or 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) - :rtype: ~azure.core.polling.LROPoller[~service_fabric_managed_clusters_management_client.models.ServiceResource] - :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 ServiceResource or the result of + cls(response) + :rtype: + ~azure.core.polling.LROPoller[~service_fabric_managed_clusters_management_client.models.ServiceResource] + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] lro_delay = kwargs.pop( 'polling_interval', @@ -231,29 +432,21 @@ def begin_create_or_update( application_name=application_name, service_name=service_name, parameters=parameters, + 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, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -265,18 +458,19 @@ def get_long_running_output(pipeline_response): ) 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/managedclusters/{clusterName}/applications/{applicationName}/services/{serviceName}'} # type: ignore + @distributed_trace def update( self, - resource_group_name, # type: str - cluster_name, # type: str - application_name, # type: str - service_name, # type: str - parameters, # type: "_models.ServiceUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.ServiceResource" + resource_group_name: str, + cluster_name: str, + application_name: str, + service_name: str, + parameters: "_models.ServiceUpdateParameters", + **kwargs: Any + ) -> "_models.ServiceResource": """Updates the tags of a service resource of a given managed cluster. Updates the tags of a service resource of a given managed cluster. @@ -291,7 +485,8 @@ def update( {applicationName}~{serviceName}. :type service_name: str :param parameters: The service resource updated tags. - :type parameters: ~service_fabric_managed_clusters_management_client.models.ServiceUpdateParameters + :type parameters: + ~service_fabric_managed_clusters_management_client.models.ServiceUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :return: ServiceResource, or the result of cls(response) :rtype: ~service_fabric_managed_clusters_management_client.models.ServiceResource @@ -302,40 +497,30 @@ def update( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-05-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.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'), - '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') + content_type = kwargs.pop('content_type', "application/json") # type: Optional[str] + + _json = self._serialize.body(parameters, 'ServiceUpdateParameters') - # 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') + request = build_update_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, + content_type=content_type, + json=_json, + template_url=self.update.metadata['url'], + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ServiceUpdateParameters') - 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) 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) @@ -344,67 +529,58 @@ def update( return cls(pipeline_response, deserialized, {}) return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applications/{applicationName}/services/{serviceName}'} # type: ignore + def _delete_initial( 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-05-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') + + 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, + 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) 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) - 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/managedclusters/{clusterName}/applications/{applicationName}/services/{serviceName}'} # type: ignore + + @distributed_trace def begin_delete( 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 managed service resource. Delete a Service Fabric managed service resource with the specified name. @@ -420,15 +596,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: Pass in True if you'd like the ARMPolling polling method, - False for no polling, or 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 """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + polling = kwargs.pop('polling', True) # type: Union[bool, azure.core.polling.PollingMethod] cls = kwargs.pop('cls', None) # type: ClsType[None] lro_delay = kwargs.pop( 'polling_interval', @@ -444,23 +622,14 @@ def begin_delete( 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, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, **kwargs) elif polling is False: polling_method = NoPolling() else: polling_method = polling if cont_token: @@ -472,17 +641,19 @@ def get_long_running_output(pipeline_response): ) else: return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applications/{applicationName}/services/{serviceName}'} # type: ignore + @distributed_trace def list_by_applications( self, - resource_group_name, # type: str - cluster_name, # type: str - application_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.ServiceResourceList"] - """Gets the list of service resources created in the specified Service Fabric managed application resource. + resource_group_name: str, + cluster_name: str, + application_name: str, + **kwargs: Any + ) -> Iterable["_models.ServiceResourceList"]: + """Gets the list of service resources created in the specified Service Fabric managed application + resource. Gets all service resources created or in the process of being created in the Service Fabric managed application resource. @@ -495,7 +666,8 @@ def list_by_applications( :type application_name: str :keyword callable cls: A custom type or function that will be passed the direct response :return: An iterator like instance of either ServiceResourceList or the result of cls(response) - :rtype: ~azure.core.paging.ItemPaged[~service_fabric_managed_clusters_management_client.models.ServiceResourceList] + :rtype: + ~azure.core.paging.ItemPaged[~service_fabric_managed_clusters_management_client.models.ServiceResourceList] :raises: ~azure.core.exceptions.HttpResponseError """ cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResourceList"] @@ -503,37 +675,35 @@ def list_by_applications( 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-05-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_by_applications.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') - - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_by_applications_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_name=application_name, + template_url=self.list_by_applications.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_by_applications_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_name=application_name, + 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('ServiceResourceList', pipeline_response) + deserialized = self._deserialize("ServiceResourceList", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -546,12 +716,13 @@ def get_next(next_link=None): 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 )