From 03aae4bf2533dd90858e5e507423d8639d945f51 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Fri, 5 Aug 2022 09:14:49 +0000 Subject: [PATCH] CodeGen from PR 20092 in Azure/azure-rest-api-specs migrate to .net track 2 batch 2 (#20092) --- .../azure-mgmt-servicefabric/_meta.json | 10 +- .../azure/mgmt/servicefabric/__init__.py | 12 +- .../mgmt/servicefabric/_configuration.py | 28 +- .../azure/mgmt/servicefabric/_metadata.json | 109 - .../azure/mgmt/servicefabric/_patch.py | 19 + .../_service_fabric_management_client.py | 113 +- .../azure/mgmt/servicefabric/_vendor.py | 27 + .../azure/mgmt/servicefabric/_version.py | 2 +- .../azure/mgmt/servicefabric/aio/__init__.py | 10 + .../mgmt/servicefabric/aio/_configuration.py | 15 +- .../azure/mgmt/servicefabric/aio/_patch.py | 19 + .../aio/_service_fabric_management_client.py | 101 +- .../servicefabric/aio/operations/__init__.py | 5 + .../_application_type_versions_operations.py | 402 +- .../_application_types_operations.py | 333 +- .../operations/_applications_operations.py | 523 +-- .../_cluster_versions_operations.py | 290 +- .../aio/operations/_clusters_operations.py | 575 +-- .../aio/operations/_operations.py | 103 +- .../servicefabric/aio/operations/_patch.py | 19 + .../aio/operations/_services_operations.py | 530 +-- .../mgmt/servicefabric/models/__init__.py | 226 +- .../mgmt/servicefabric/models/_models.py | 3507 ----------------- .../mgmt/servicefabric/models/_models_py3.py | 3066 +++++++++----- .../azure/mgmt/servicefabric/models/_patch.py | 19 + ..._service_fabric_management_client_enums.py | 82 +- .../mgmt/servicefabric/operations/__init__.py | 5 + .../_application_type_versions_operations.py | 655 +-- .../_application_types_operations.py | 557 ++- .../operations/_applications_operations.py | 815 ++-- .../_cluster_versions_operations.py | 477 ++- .../operations/_clusters_operations.py | 920 +++-- .../servicefabric/operations/_operations.py | 137 +- .../mgmt/servicefabric/operations/_patch.py | 19 + .../operations/_services_operations.py | 854 ++-- 35 files changed, 6982 insertions(+), 7602 deletions(-) delete mode 100644 sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/_metadata.json create mode 100644 sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/_patch.py create mode 100644 sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/_vendor.py create mode 100644 sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/aio/_patch.py create mode 100644 sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/aio/operations/_patch.py delete mode 100644 sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/models/_models.py create mode 100644 sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/models/_patch.py create mode 100644 sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/operations/_patch.py diff --git a/sdk/servicefabric/azure-mgmt-servicefabric/_meta.json b/sdk/servicefabric/azure-mgmt-servicefabric/_meta.json index cafc58d3eeea..24d95535a413 100644 --- a/sdk/servicefabric/azure-mgmt-servicefabric/_meta.json +++ b/sdk/servicefabric/azure-mgmt-servicefabric/_meta.json @@ -1,11 +1,11 @@ { - "autorest": "3.4.5", + "autorest": "3.7.2", "use": [ - "@autorest/python@5.8.4", - "@autorest/modelerfour@4.19.2" + "@autorest/python@5.16.0", + "@autorest/modelerfour@4.19.3" ], - "commit": "4272591f9214235c325d8e49ff3eedc7cd022f6a", + "commit": "63f4e39c20223c20941614e776d33e699c3e2777", "repository_url": "https://github.com/Azure/azure-rest-api-specs", - "autorest_command": "autorest specification/servicefabric/resource-manager/readme.md --multiapi --python --python-mode=update --python-sdks-folder=/home/vsts/work/1/s/azure-sdk-for-python/sdk --track2 --use=@autorest/python@5.8.4 --use=@autorest/modelerfour@4.19.2 --version=3.4.5", + "autorest_command": "autorest specification/servicefabric/resource-manager/readme.md --python --python-sdks-folder=/mnt/vss/_work/1/s/azure-sdk-for-python/sdk --python3-only --use=@autorest/python@5.16.0 --use=@autorest/modelerfour@4.19.3 --version=3.7.2", "readme": "specification/servicefabric/resource-manager/readme.md" } \ No newline at end of file diff --git a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/__init__.py b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/__init__.py index 4757f3109a7c..1053c6d9770b 100644 --- a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/__init__.py +++ b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/__init__.py @@ -10,10 +10,14 @@ from ._version import VERSION __version__ = VERSION -__all__ = ['ServiceFabricManagementClient'] try: - from ._patch import patch_sdk # type: ignore - patch_sdk() + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import except ImportError: - pass + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk +__all__ = ['ServiceFabricManagementClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/_configuration.py b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/_configuration.py index 208b027514b2..3d00d2253fea 100644 --- a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/_configuration.py +++ b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/_configuration.py @@ -6,22 +6,20 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from typing import Any, TYPE_CHECKING from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy from ._version import VERSION if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports - from typing import Any - from azure.core.credentials import TokenCredential -class ServiceFabricManagementClientConfiguration(Configuration): +class ServiceFabricManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for ServiceFabricManagementClient. Note that all parameters used to create this instance are saved as instance @@ -31,24 +29,28 @@ class ServiceFabricManagementClientConfiguration(Configuration): :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The customer subscription identifier. :type subscription_id: str + :keyword api_version: Api Version. Default value is "2021-06-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + credential: "TokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + super(ServiceFabricManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2021-06-01") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(ServiceFabricManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id - self.api_version = "2021-06-01" + self.api_version = api_version self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-servicefabric/{}'.format(VERSION)) self._configure(**kwargs) @@ -68,4 +70,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/_metadata.json b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/_metadata.json deleted file mode 100644 index e2d072b58bc8..000000000000 --- a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/_metadata.json +++ /dev/null @@ -1,109 +0,0 @@ -{ - "chosen_version": "2021-06-01", - "total_api_version_list": ["2021-06-01"], - "client": { - "name": "ServiceFabricManagementClient", - "filename": "_service_fabric_management_client", - "description": "Service Fabric Management Client.", - "base_url": "\u0027https://management.azure.com\u0027", - "custom_base_url": null, - "azure_arm": true, - "has_lro_operations": true, - "client_side_validation": false, - "sync_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"ARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ServiceFabricManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"HttpRequest\", \"HttpResponse\"]}}}", - "async_imports": "{\"typing\": {\"azurecore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}, \"regular\": {\"azurecore\": {\"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"], \"msrest\": [\"Deserializer\", \"Serializer\"], \"azure.mgmt.core\": [\"AsyncARMPipelineClient\"]}, \"local\": {\"._configuration\": [\"ServiceFabricManagementClientConfiguration\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}, \"azurecore\": {\"azure.core.pipeline.transport\": [\"AsyncHttpResponse\", \"HttpRequest\"]}}}" - }, - "global_parameters": { - "sync": { - "credential": { - "signature": "credential, # type: \"TokenCredential\"", - "description": "Credential needed for the client to connect to Azure.", - "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true - }, - "subscription_id": { - "signature": "subscription_id, # type: str", - "description": "The customer subscription identifier.", - "docstring_type": "str", - "required": true - } - }, - "async": { - "credential": { - "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure.", - "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", - "required": true - }, - "subscription_id": { - "signature": "subscription_id: str,", - "description": "The customer subscription identifier.", - "docstring_type": "str", - "required": true - } - }, - "constant": { - }, - "call": "credential, subscription_id", - "service_client_specific": { - "sync": { - "api_version": { - "signature": "api_version=None, # type: Optional[str]", - "description": "API version to use if no profile is provided, or if missing in profile.", - "docstring_type": "str", - "required": false - }, - "base_url": { - "signature": "base_url=None, # type: Optional[str]", - "description": "Service URL", - "docstring_type": "str", - "required": false - }, - "profile": { - "signature": "profile=KnownProfiles.default, # type: KnownProfiles", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false - } - }, - "async": { - "api_version": { - "signature": "api_version: Optional[str] = None,", - "description": "API version to use if no profile is provided, or if missing in profile.", - "docstring_type": "str", - "required": false - }, - "base_url": { - "signature": "base_url: Optional[str] = None,", - "description": "Service URL", - "docstring_type": "str", - "required": false - }, - "profile": { - "signature": "profile: KnownProfiles = KnownProfiles.default,", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false - } - } - } - }, - "config": { - "credential": true, - "credential_scopes": ["https://management.azure.com/.default"], - "credential_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\"]}}}" - }, - "operation_groups": { - "clusters": "ClustersOperations", - "cluster_versions": "ClusterVersionsOperations", - "operations": "Operations", - "application_types": "ApplicationTypesOperations", - "application_type_versions": "ApplicationTypeVersionsOperations", - "applications": "ApplicationsOperations", - "services": "ServicesOperations" - } -} \ No newline at end of file diff --git a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/_patch.py b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/_service_fabric_management_client.py b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/_service_fabric_management_client.py index 1a50f2e95575..713375c6fff2 100644 --- a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/_service_fabric_management_client.py +++ b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/_service_fabric_management_client.py @@ -6,30 +6,23 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING +from copy import deepcopy +from typing import Any, TYPE_CHECKING -from azure.mgmt.core import ARMPipelineClient from msrest import Deserializer, Serializer -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Optional - - from azure.core.credentials import TokenCredential - from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.rest import HttpRequest, HttpResponse +from azure.mgmt.core import ARMPipelineClient -from ._configuration import ServiceFabricManagementClientConfiguration -from .operations import ClustersOperations -from .operations import ClusterVersionsOperations -from .operations import Operations -from .operations import ApplicationTypesOperations -from .operations import ApplicationTypeVersionsOperations -from .operations import ApplicationsOperations -from .operations import ServicesOperations from . import models +from ._configuration import ServiceFabricManagementClientConfiguration +from .operations import ApplicationTypeVersionsOperations, ApplicationTypesOperations, ApplicationsOperations, ClusterVersionsOperations, ClustersOperations, Operations, ServicesOperations +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials import TokenCredential -class ServiceFabricManagementClient(object): +class ServiceFabricManagementClient: # pylint: disable=too-many-instance-attributes """Service Fabric Management Client. :ivar clusters: ClustersOperations operations @@ -41,7 +34,8 @@ class ServiceFabricManagementClient(object): :ivar application_types: ApplicationTypesOperations operations :vartype application_types: azure.mgmt.servicefabric.operations.ApplicationTypesOperations :ivar application_type_versions: ApplicationTypeVersionsOperations operations - :vartype application_type_versions: azure.mgmt.servicefabric.operations.ApplicationTypeVersionsOperations + :vartype application_type_versions: + azure.mgmt.servicefabric.operations.ApplicationTypeVersionsOperations :ivar applications: ApplicationsOperations operations :vartype applications: azure.mgmt.servicefabric.operations.ApplicationsOperations :ivar services: ServicesOperations operations @@ -50,60 +44,77 @@ class ServiceFabricManagementClient(object): :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The customer subscription identifier. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is "https://management.azure.com". + :type base_url: str + :keyword api_version: Api Version. Default value is "2021-06-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, - credential, # type: "TokenCredential" - subscription_id, # type: str - base_url=None, # type: Optional[str] - **kwargs # type: Any - ): - # type: (...) -> None - if not base_url: - base_url = 'https://management.azure.com' - self._config = ServiceFabricManagementClientConfiguration(credential, subscription_id, **kwargs) + credential: "TokenCredential", + subscription_id: str, + base_url: str = "https://management.azure.com", + **kwargs: Any + ) -> None: + self._config = ServiceFabricManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) - + self._serialize.client_side_validation = False self.clusters = ClustersOperations( - self._client, self._config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize + ) self.cluster_versions = ClusterVersionsOperations( - self._client, self._config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize + ) self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize + ) self.application_types = ApplicationTypesOperations( - self._client, self._config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize + ) self.application_type_versions = ApplicationTypeVersionsOperations( - self._client, self._config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize + ) self.applications = ApplicationsOperations( - self._client, self._config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize + ) self.services = ServicesOperations( - self._client, self._config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize + ) + - def _send_request(self, http_request, **kwargs): - # type: (HttpRequest, Any) -> HttpResponse + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> HttpResponse: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.HttpResponse + :rtype: ~azure.core.rest.HttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) def close(self): # type: () -> None diff --git a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/_vendor.py b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/_vendor.py new file mode 100644 index 000000000000..138f663c53a4 --- /dev/null +++ b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/_vendor.py @@ -0,0 +1,27 @@ +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from azure.core.pipeline.transport import HttpRequest + +def _convert_request(request, files=None): + data = request.content if not files else None + request = HttpRequest(method=request.method, url=request.url, headers=request.headers, data=data) + if files: + request.set_formdata_body(files) + return request + +def _format_url_section(template, **kwargs): + components = template.split("/") + while components: + try: + return template.format(**kwargs) + except KeyError as key: + formatted_components = template.split("/") + components = [ + c for c in formatted_components if "{}".format(key.args[0]) not in c + ] + template = "/".join(components) diff --git a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/_version.py b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/_version.py index 48944bf3938a..e5754a47ce68 100644 --- a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/_version.py +++ b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/_version.py @@ -6,4 +6,4 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -VERSION = "2.0.0" +VERSION = "1.0.0b1" diff --git a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/aio/__init__.py b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/aio/__init__.py index 2f0d7de874fd..85c95c395b6c 100644 --- a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/aio/__init__.py +++ b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/aio/__init__.py @@ -7,4 +7,14 @@ # -------------------------------------------------------------------------- from ._service_fabric_management_client import ServiceFabricManagementClient + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk __all__ = ['ServiceFabricManagementClient'] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/aio/_configuration.py b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/aio/_configuration.py index cba0c3a330ce..967db0471633 100644 --- a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/aio/_configuration.py +++ b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/aio/_configuration.py @@ -10,7 +10,7 @@ from azure.core.configuration import Configuration from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy +from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy from .._version import VERSION @@ -19,7 +19,7 @@ from azure.core.credentials_async import AsyncTokenCredential -class ServiceFabricManagementClientConfiguration(Configuration): +class ServiceFabricManagementClientConfiguration(Configuration): # pylint: disable=too-many-instance-attributes """Configuration for ServiceFabricManagementClient. Note that all parameters used to create this instance are saved as instance @@ -29,6 +29,9 @@ class ServiceFabricManagementClientConfiguration(Configuration): :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The customer subscription identifier. :type subscription_id: str + :keyword api_version: Api Version. Default value is "2021-06-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ def __init__( @@ -37,15 +40,17 @@ def __init__( subscription_id: str, **kwargs: Any ) -> None: + super(ServiceFabricManagementClientConfiguration, self).__init__(**kwargs) + api_version = kwargs.pop('api_version', "2021-06-01") # type: str + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: raise ValueError("Parameter 'subscription_id' must not be None.") - super(ServiceFabricManagementClientConfiguration, self).__init__(**kwargs) self.credential = credential self.subscription_id = subscription_id - self.api_version = "2021-06-01" + self.api_version = api_version self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) kwargs.setdefault('sdk_moniker', 'mgmt-servicefabric/{}'.format(VERSION)) self._configure(**kwargs) @@ -64,4 +69,4 @@ def _configure( self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) self.authentication_policy = kwargs.get('authentication_policy') if self.credential and not self.authentication_policy: - self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/aio/_patch.py b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/aio/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/aio/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/aio/_service_fabric_management_client.py b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/aio/_service_fabric_management_client.py index f9db8bc059c1..509d42266a52 100644 --- a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/aio/_service_fabric_management_client.py +++ b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/aio/_service_fabric_management_client.py @@ -6,28 +6,23 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, TYPE_CHECKING -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest -from azure.mgmt.core import AsyncARMPipelineClient from msrest import Deserializer, Serializer -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential +from azure.core.rest import AsyncHttpResponse, HttpRequest +from azure.mgmt.core import AsyncARMPipelineClient -from ._configuration import ServiceFabricManagementClientConfiguration -from .operations import ClustersOperations -from .operations import ClusterVersionsOperations -from .operations import Operations -from .operations import ApplicationTypesOperations -from .operations import ApplicationTypeVersionsOperations -from .operations import ApplicationsOperations -from .operations import ServicesOperations from .. import models +from ._configuration import ServiceFabricManagementClientConfiguration +from .operations import ApplicationTypeVersionsOperations, ApplicationTypesOperations, ApplicationsOperations, ClusterVersionsOperations, ClustersOperations, Operations, ServicesOperations +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential -class ServiceFabricManagementClient(object): +class ServiceFabricManagementClient: # pylint: disable=too-many-instance-attributes """Service Fabric Management Client. :ivar clusters: ClustersOperations operations @@ -39,7 +34,8 @@ class ServiceFabricManagementClient(object): :ivar application_types: ApplicationTypesOperations operations :vartype application_types: azure.mgmt.servicefabric.aio.operations.ApplicationTypesOperations :ivar application_type_versions: ApplicationTypeVersionsOperations operations - :vartype application_type_versions: azure.mgmt.servicefabric.aio.operations.ApplicationTypeVersionsOperations + :vartype application_type_versions: + azure.mgmt.servicefabric.aio.operations.ApplicationTypeVersionsOperations :ivar applications: ApplicationsOperations operations :vartype applications: azure.mgmt.servicefabric.aio.operations.ApplicationsOperations :ivar services: ServicesOperations operations @@ -48,58 +44,77 @@ class ServiceFabricManagementClient(object): :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The customer subscription identifier. :type subscription_id: str - :param str base_url: Service URL - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :param base_url: Service URL. Default value is "https://management.azure.com". + :type base_url: str + :keyword api_version: Api Version. Default value is "2021-06-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, - base_url: Optional[str] = None, + base_url: str = "https://management.azure.com", **kwargs: Any ) -> None: - if not base_url: - base_url = 'https://management.azure.com' - self._config = ServiceFabricManagementClientConfiguration(credential, subscription_id, **kwargs) + self._config = ServiceFabricManagementClientConfiguration(credential=credential, subscription_id=subscription_id, **kwargs) self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} self._serialize = Serializer(client_models) - self._serialize.client_side_validation = False self._deserialize = Deserializer(client_models) - + self._serialize.client_side_validation = False self.clusters = ClustersOperations( - self._client, self._config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize + ) self.cluster_versions = ClusterVersionsOperations( - self._client, self._config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize + ) self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize + ) self.application_types = ApplicationTypesOperations( - self._client, self._config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize + ) self.application_type_versions = ApplicationTypeVersionsOperations( - self._client, self._config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize + ) self.applications = ApplicationsOperations( - self._client, self._config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize + ) self.services = ServicesOperations( - self._client, self._config, self._serialize, self._deserialize) + self._client, self._config, self._serialize, self._deserialize + ) - async def _send_request(self, http_request: HttpRequest, **kwargs: Any) -> AsyncHttpResponse: + + def _send_request( + self, + request: HttpRequest, + **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: """Runs the network request through the client's chained policies. - :param http_request: The network request you want to make. Required. - :type http_request: ~azure.core.pipeline.transport.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to True. + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + + + For more information on this code flow, see https://aka.ms/azsdk/python/protocol/quickstart + + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.pipeline.transport.AsyncHttpResponse + :rtype: ~azure.core.rest.AsyncHttpResponse """ - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - http_request.url = self._client.format_url(http_request.url, **path_format_arguments) - stream = kwargs.pop("stream", True) - pipeline_response = await self._client._pipeline.run(http_request, stream=stream, **kwargs) - return pipeline_response.http_response + + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, **kwargs) async def close(self) -> None: await self._client.close() diff --git a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/aio/operations/__init__.py b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/aio/operations/__init__.py index dd0e1c0084f7..82604b38fded 100644 --- a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/aio/operations/__init__.py +++ b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/aio/operations/__init__.py @@ -14,6 +14,9 @@ from ._applications_operations import ApplicationsOperations from ._services_operations import ServicesOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'ClustersOperations', 'ClusterVersionsOperations', @@ -23,3 +26,5 @@ 'ApplicationsOperations', 'ServicesOperations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/aio/operations/_application_type_versions_operations.py b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/aio/operations/_application_type_versions_operations.py index 24ad457214c3..efac1fe60ba9 100644 --- a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/aio/operations/_application_type_versions_operations.py +++ b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/aio/operations/_application_type_versions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,43 +6,45 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._application_type_versions_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class ApplicationTypeVersionsOperations: - """ApplicationTypeVersionsOperations 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. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.servicefabric.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. + Instead, you should access the following operations through + :class:`~azure.mgmt.servicefabric.aio.ServiceFabricManagementClient`'s + :attr:`application_type_versions` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -49,7 +52,7 @@ async def get( application_type_name: str, version: str, **kwargs: Any - ) -> "_models.ApplicationTypeVersionResource": + ) -> _models.ApplicationTypeVersionResource: """Gets a Service Fabric application type version resource. Get a Service Fabric application type version resource created or in the process of being @@ -68,40 +71,42 @@ async def get( :rtype: ~azure.mgmt.servicefabric.models.ApplicationTypeVersionResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationTypeVersionResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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') + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ApplicationTypeVersionResource] + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_type_name=application_type_name, + version=version, + api_version=api_version, + template_url=self.get.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ApplicationTypeVersionResource', pipeline_response) @@ -110,7 +115,9 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}/versions/{version}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}/versions/{version}"} # type: ignore + async def _create_or_update_initial( self, @@ -118,49 +125,49 @@ async def _create_or_update_initial( cluster_name: str, application_type_name: str, version: str, - parameters: "_models.ApplicationTypeVersionResource", + parameters: _models.ApplicationTypeVersionResource, **kwargs: Any - ) -> "_models.ApplicationTypeVersionResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationTypeVersionResource"] + ) -> _models.ApplicationTypeVersionResource: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'applicationTypeName': self._serialize.url("application_type_name", application_type_name, 'str'), - 'version': self._serialize.url("version", version, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ApplicationTypeVersionResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ApplicationTypeVersionResource] + + _json = self._serialize.body(parameters, 'ApplicationTypeVersionResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_type_name=application_type_name, + version=version, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = self._deserialize('ApplicationTypeVersionResource', pipeline_response) @@ -168,17 +175,20 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}/versions/{version}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}/versions/{version}"} # type: ignore + + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, cluster_name: str, application_type_name: str, version: str, - parameters: "_models.ApplicationTypeVersionResource", + parameters: _models.ApplicationTypeVersionResource, **kwargs: Any - ) -> AsyncLROPoller["_models.ApplicationTypeVersionResource"]: + ) -> AsyncLROPoller[_models.ApplicationTypeVersionResource]: """Creates or updates a Service Fabric application type version resource. Create or update a Service Fabric application type version resource with the specified name. @@ -195,52 +205,61 @@ async def begin_create_or_update( :type parameters: ~azure.mgmt.servicefabric.models.ApplicationTypeVersionResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ApplicationTypeVersionResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicefabric.models.ApplicationTypeVersionResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ApplicationTypeVersionResource or + the result of cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicefabric.models.ApplicationTypeVersionResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ApplicationTypeVersionResource] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationTypeVersionResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_name, application_type_name=application_type_name, version=version, parameters=parameters, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): deserialized = self._deserialize('ApplicationTypeVersionResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'applicationTypeName': self._serialize.url("application_type_name", application_type_name, 'str'), - 'version': self._serialize.url("version", version, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -249,11 +268,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}/versions/{version}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - async def _delete_initial( + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}/versions/{version}"} # type: ignore + + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cluster_name: str, @@ -261,48 +280,51 @@ async def _delete_initial( version: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'applicationTypeName': self._serialize.url("application_type_name", application_type_name, 'str'), - 'version': self._serialize.url("version", version, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) + error_map.update(kwargs.pop('error_map', {}) or {}) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_type_name=application_type_name, + version=version, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}/versions/{version}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}/versions/{version}"} # type: ignore + - async def begin_delete( + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cluster_name: str, @@ -324,48 +346,54 @@ async def begin_delete( :type version: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_name, application_type_name=application_type_name, version=version, + api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'applicationTypeName': self._serialize.url("application_type_name", application_type_name, 'str'), - 'version': self._serialize.url("version", version, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -374,18 +402,20 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}/versions/{version}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}/versions/{version}"} # type: ignore + @distributed_trace_async async def list( self, resource_group_name: str, cluster_name: str, application_type_name: str, **kwargs: Any - ) -> "_models.ApplicationTypeVersionResourceList": - """Gets the list of application type version resources created in the specified Service Fabric application type name resource. + ) -> _models.ApplicationTypeVersionResourceList: + """Gets the list of application type version resources created in the specified Service Fabric + application type name resource. Gets all application type version resources created or in the process of being created in the Service Fabric application type name resource. @@ -401,39 +431,41 @@ async def list( :rtype: ~azure.mgmt.servicefabric.models.ApplicationTypeVersionResourceList :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationTypeVersionResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'applicationTypeName': self._serialize.url("application_type_name", application_type_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ApplicationTypeVersionResourceList] + + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_type_name=application_type_name, + api_version=api_version, + template_url=self.list.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ApplicationTypeVersionResourceList', pipeline_response) @@ -442,4 +474,6 @@ async def list( return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}/versions'} # type: ignore + + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}/versions"} # type: ignore + diff --git a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/aio/operations/_application_types_operations.py b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/aio/operations/_application_types_operations.py index 16ea77c9b92b..b002ec4e09f8 100644 --- a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/aio/operations/_application_types_operations.py +++ b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/aio/operations/_application_types_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,50 +6,52 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._application_types_operations import build_create_or_update_request, build_delete_request_initial, build_get_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class ApplicationTypesOperations: - """ApplicationTypesOperations 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. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.servicefabric.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. + Instead, you should access the following operations through + :class:`~azure.mgmt.servicefabric.aio.ServiceFabricManagementClient`'s + :attr:`application_types` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async async def get( self, resource_group_name: str, cluster_name: str, application_type_name: str, **kwargs: Any - ) -> "_models.ApplicationTypeResource": + ) -> _models.ApplicationTypeResource: """Gets a Service Fabric application type name resource. Get a Service Fabric application type name resource created or in the process of being created @@ -65,39 +68,41 @@ async def get( :rtype: ~azure.mgmt.servicefabric.models.ApplicationTypeResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationTypeResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.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') + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ApplicationTypeResource] + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_type_name=application_type_name, + api_version=api_version, + template_url=self.get.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ApplicationTypeResource', pipeline_response) @@ -106,16 +111,19 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}"} # type: ignore + + + @distributed_trace_async async def create_or_update( self, resource_group_name: str, cluster_name: str, application_type_name: str, - parameters: "_models.ApplicationTypeResource", + parameters: _models.ApplicationTypeResource, **kwargs: Any - ) -> "_models.ApplicationTypeResource": + ) -> _models.ApplicationTypeResource: """Creates or updates a Service Fabric application type name resource. Create or update a Service Fabric application type name resource with the specified name. @@ -133,44 +141,45 @@ async def create_or_update( :rtype: ~azure.mgmt.servicefabric.models.ApplicationTypeResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationTypeResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'applicationTypeName': self._serialize.url("application_type_name", application_type_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ApplicationTypeResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ApplicationTypeResource] + + _json = self._serialize.body(parameters, 'ApplicationTypeResource') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_type_name=application_type_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ApplicationTypeResource', pipeline_response) @@ -179,56 +188,61 @@ async def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}'} # type: ignore - async def _delete_initial( + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}"} # type: ignore + + + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cluster_name: str, application_type_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'applicationTypeName': self._serialize.url("application_type_name", application_type_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_type_name=application_type_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}"} # type: ignore + - async def begin_delete( + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cluster_name: str, @@ -247,46 +261,53 @@ async def begin_delete( :type application_type_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_name, application_type_name=application_type_name, + api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'applicationTypeName': self._serialize.url("application_type_name", application_type_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -295,17 +316,19 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}"} # type: ignore + @distributed_trace_async async def list( self, resource_group_name: str, cluster_name: str, **kwargs: Any - ) -> "_models.ApplicationTypeResourceList": - """Gets the list of application type name resources created in the specified Service Fabric cluster resource. + ) -> _models.ApplicationTypeResourceList: + """Gets the list of application type name resources created in the specified Service Fabric + cluster resource. Gets all application type name resources created or in the process of being created in the Service Fabric cluster resource. @@ -319,38 +342,40 @@ async def list( :rtype: ~azure.mgmt.servicefabric.models.ApplicationTypeResourceList :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationTypeResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ApplicationTypeResourceList] + + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + api_version=api_version, + template_url=self.list.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ApplicationTypeResourceList', pipeline_response) @@ -359,4 +384,6 @@ async def list( return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes'} # type: ignore + + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes"} # type: ignore + diff --git a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/aio/operations/_applications_operations.py b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/aio/operations/_applications_operations.py index 5dbd2c7b4986..ad884dbd1f68 100644 --- a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/aio/operations/_applications_operations.py +++ b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/aio/operations/_applications_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,50 +6,52 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._applications_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class ApplicationsOperations: - """ApplicationsOperations 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. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.servicefabric.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. + Instead, you should access the following operations through + :class:`~azure.mgmt.servicefabric.aio.ServiceFabricManagementClient`'s + :attr:`applications` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async async def get( self, resource_group_name: str, cluster_name: str, application_name: str, **kwargs: Any - ) -> "_models.ApplicationResource": + ) -> _models.ApplicationResource: """Gets a Service Fabric application resource. Get a Service Fabric application resource created or in the process of being created in the @@ -65,39 +68,41 @@ async def get( :rtype: ~azure.mgmt.servicefabric.models.ApplicationResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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') + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ApplicationResource] + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_name=application_name, + api_version=api_version, + template_url=self.get.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ApplicationResource', pipeline_response) @@ -106,55 +111,57 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}"} # type: ignore + async def _create_or_update_initial( self, resource_group_name: str, cluster_name: str, application_name: str, - parameters: "_models.ApplicationResource", + parameters: _models.ApplicationResource, **kwargs: Any - ) -> "_models.ApplicationResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationResource"] + ) -> _models.ApplicationResource: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'applicationName': self._serialize.url("application_name", application_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ApplicationResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ApplicationResource] + + _json = self._serialize.body(parameters, 'ApplicationResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_name=application_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = self._deserialize('ApplicationResource', pipeline_response) @@ -162,16 +169,19 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}"} # type: ignore + + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, cluster_name: str, application_name: str, - parameters: "_models.ApplicationResource", + parameters: _models.ApplicationResource, **kwargs: Any - ) -> AsyncLROPoller["_models.ApplicationResource"]: + ) -> AsyncLROPoller[_models.ApplicationResource]: """Creates or updates a Service Fabric application resource. Create or update a Service Fabric application resource with the specified name. @@ -186,50 +196,60 @@ async def begin_create_or_update( :type parameters: ~azure.mgmt.servicefabric.models.ApplicationResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ApplicationResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicefabric.models.ApplicationResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ApplicationResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicefabric.models.ApplicationResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ApplicationResource] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_name, application_name=application_name, parameters=parameters, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): deserialized = self._deserialize('ApplicationResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'applicationName': self._serialize.url("application_name", application_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -238,57 +258,57 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}"} # type: ignore async def _update_initial( self, resource_group_name: str, cluster_name: str, application_name: str, - parameters: "_models.ApplicationResourceUpdate", + parameters: _models.ApplicationResourceUpdate, **kwargs: Any - ) -> "_models.ApplicationResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationResource"] + ) -> _models.ApplicationResource: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'applicationName': self._serialize.url("application_name", application_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ApplicationResourceUpdate') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ApplicationResource] + + _json = self._serialize.body(parameters, 'ApplicationResourceUpdate') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_name=application_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = self._deserialize('ApplicationResource', pipeline_response) @@ -296,16 +316,19 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}"} # type: ignore + + + @distributed_trace_async async def begin_update( self, resource_group_name: str, cluster_name: str, application_name: str, - parameters: "_models.ApplicationResourceUpdate", + parameters: _models.ApplicationResourceUpdate, **kwargs: Any - ) -> AsyncLROPoller["_models.ApplicationResource"]: + ) -> AsyncLROPoller[_models.ApplicationResource]: """Updates a Service Fabric application resource. Update a Service Fabric application resource with the specified name. @@ -320,50 +343,60 @@ async def begin_update( :type parameters: ~azure.mgmt.servicefabric.models.ApplicationResourceUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ApplicationResource or the result of cls(response) - :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicefabric.models.ApplicationResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ApplicationResource or the result of + cls(response) + :rtype: + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicefabric.models.ApplicationResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ApplicationResource] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._update_initial( + raw_result = await self._update_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_name, application_name=application_name, parameters=parameters, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): deserialized = self._deserialize('ApplicationResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'applicationName': self._serialize.url("application_name", application_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -372,58 +405,61 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cluster_name: str, application_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'applicationName': self._serialize.url("application_name", application_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) + error_map.update(kwargs.pop('error_map', {}) or {}) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_name=application_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}"} # type: ignore + - async def begin_delete( + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cluster_name: str, @@ -442,46 +478,53 @@ async def begin_delete( :type application_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_name, application_name=application_name, + api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'applicationName': self._serialize.url("application_name", application_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -490,17 +533,19 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}"} # type: ignore + @distributed_trace_async async def list( self, resource_group_name: str, cluster_name: str, **kwargs: Any - ) -> "_models.ApplicationResourceList": - """Gets the list of application resources created in the specified Service Fabric cluster resource. + ) -> _models.ApplicationResourceList: + """Gets the list of application resources created in the specified Service Fabric cluster + resource. Gets all application resources created or in the process of being created in the Service Fabric cluster resource. @@ -514,38 +559,40 @@ async def list( :rtype: ~azure.mgmt.servicefabric.models.ApplicationResourceList :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ApplicationResourceList] + + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + api_version=api_version, + template_url=self.list.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ApplicationResourceList', pipeline_response) @@ -554,4 +601,6 @@ async def list( return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications'} # type: ignore + + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications"} # type: ignore + diff --git a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/aio/operations/_cluster_versions_operations.py b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/aio/operations/_cluster_versions_operations.py index 242e960af2ae..c776ca2194f8 100644 --- a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/aio/operations/_cluster_versions_operations.py +++ b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/aio/operations/_cluster_versions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,48 +6,51 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar, Union from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._cluster_versions_operations import build_get_by_environment_request, build_get_request, build_list_by_environment_request, build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class ClusterVersionsOperations: - """ClusterVersionsOperations 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. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.servicefabric.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. + Instead, you should access the following operations through + :class:`~azure.mgmt.servicefabric.aio.ServiceFabricManagementClient`'s + :attr:`cluster_versions` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async async def get( self, location: str, cluster_version: str, **kwargs: Any - ) -> "_models.ClusterCodeVersionsListResult": - """Gets information about a Service Fabric cluster code version available in the specified location. + ) -> _models.ClusterCodeVersionsListResult: + """Gets information about a Service Fabric cluster code version available in the specified + location. Gets information about an available Service Fabric cluster code version. @@ -60,38 +64,40 @@ async def get( :rtype: ~azure.mgmt.servicefabric.models.ClusterCodeVersionsListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ClusterCodeVersionsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'location': self._serialize.url("location", location, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'clusterVersion': self._serialize.url("cluster_version", cluster_version, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ClusterCodeVersionsListResult] + + + request = build_get_request( + location=location, + subscription_id=self._config.subscription_id, + cluster_version=cluster_version, + api_version=api_version, + template_url=self.get.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ClusterCodeVersionsListResult', pipeline_response) @@ -100,16 +106,20 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/clusterVersions/{clusterVersion}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/clusterVersions/{clusterVersion}"} # type: ignore + + + @distributed_trace_async async def get_by_environment( self, location: str, - environment: Union[str, "_models.Enum14"], + environment: Union[str, "_models.ClusterVersionsEnvironment"], cluster_version: str, **kwargs: Any - ) -> "_models.ClusterCodeVersionsListResult": - """Gets information about a Service Fabric cluster code version available for the specified environment. + ) -> _models.ClusterCodeVersionsListResult: + """Gets information about a Service Fabric cluster code version available for the specified + environment. Gets information about an available Service Fabric cluster code version by environment. @@ -117,7 +127,7 @@ async def get_by_environment( location. :type location: str :param environment: The operating system of the cluster. The default means all. - :type environment: str or ~azure.mgmt.servicefabric.models.Enum14 + :type environment: str or ~azure.mgmt.servicefabric.models.ClusterVersionsEnvironment :param cluster_version: The cluster code version. :type cluster_version: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -125,39 +135,41 @@ async def get_by_environment( :rtype: ~azure.mgmt.servicefabric.models.ClusterCodeVersionsListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ClusterCodeVersionsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get_by_environment.metadata['url'] # type: ignore - path_format_arguments = { - 'location': self._serialize.url("location", location, 'str'), - 'environment': self._serialize.url("environment", environment, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'clusterVersion': self._serialize.url("cluster_version", cluster_version, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ClusterCodeVersionsListResult] + + + request = build_get_by_environment_request( + location=location, + environment=environment, + subscription_id=self._config.subscription_id, + cluster_version=cluster_version, + api_version=api_version, + template_url=self.get_by_environment.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ClusterCodeVersionsListResult', pipeline_response) @@ -166,13 +178,16 @@ async def get_by_environment( return cls(pipeline_response, deserialized, {}) return deserialized - get_by_environment.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/environments/{environment}/clusterVersions/{clusterVersion}'} # type: ignore + get_by_environment.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/environments/{environment}/clusterVersions/{clusterVersion}"} # type: ignore + + + @distributed_trace_async async def list( self, location: str, **kwargs: Any - ) -> "_models.ClusterCodeVersionsListResult": + ) -> _models.ClusterCodeVersionsListResult: """Gets the list of Service Fabric cluster code versions available for the specified location. Gets all available code versions for Service Fabric cluster resources by location. @@ -185,37 +200,39 @@ async def list( :rtype: ~azure.mgmt.servicefabric.models.ClusterCodeVersionsListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ClusterCodeVersionsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'location': self._serialize.url("location", location, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ClusterCodeVersionsListResult] + + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ClusterCodeVersionsListResult', pipeline_response) @@ -224,14 +241,17 @@ async def list( return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/clusterVersions'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/clusterVersions"} # type: ignore + + + @distributed_trace_async async def list_by_environment( self, location: str, - environment: Union[str, "_models.Enum14"], + environment: Union[str, "_models.ClusterVersionsEnvironment"], **kwargs: Any - ) -> "_models.ClusterCodeVersionsListResult": + ) -> _models.ClusterCodeVersionsListResult: """Gets the list of Service Fabric cluster code versions available for the specified environment. Gets all available code versions for Service Fabric cluster resources by environment. @@ -240,44 +260,46 @@ async def list_by_environment( location. :type location: str :param environment: The operating system of the cluster. The default means all. - :type environment: str or ~azure.mgmt.servicefabric.models.Enum14 + :type environment: str or ~azure.mgmt.servicefabric.models.ClusterVersionsEnvironment :keyword callable cls: A custom type or function that will be passed the direct response :return: ClusterCodeVersionsListResult, or the result of cls(response) :rtype: ~azure.mgmt.servicefabric.models.ClusterCodeVersionsListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ClusterCodeVersionsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.list_by_environment.metadata['url'] # type: ignore - path_format_arguments = { - 'location': self._serialize.url("location", location, 'str'), - 'environment': self._serialize.url("environment", environment, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ClusterCodeVersionsListResult] + + + request = build_list_by_environment_request( + location=location, + environment=environment, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_environment.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ClusterCodeVersionsListResult', pipeline_response) @@ -286,4 +308,6 @@ async def list_by_environment( return cls(pipeline_response, deserialized, {}) return deserialized - list_by_environment.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/environments/{environment}/clusterVersions'} # type: ignore + + list_by_environment.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/environments/{environment}/clusterVersions"} # type: ignore + diff --git a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/aio/operations/_clusters_operations.py b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/aio/operations/_clusters_operations.py index 3b05f0764ef3..d829b4a71e1a 100644 --- a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/aio/operations/_clusters_operations.py +++ b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/aio/operations/_clusters_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,49 +6,51 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._clusters_operations import build_create_or_update_request_initial, build_delete_request, build_get_request, build_list_by_resource_group_request, build_list_request, build_list_upgradable_versions_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class ClustersOperations: - """ClustersOperations 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. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.servicefabric.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. + Instead, you should access the following operations through + :class:`~azure.mgmt.servicefabric.aio.ServiceFabricManagementClient`'s + :attr:`clusters` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async async def get( self, resource_group_name: str, cluster_name: str, **kwargs: Any - ) -> "_models.Cluster": + ) -> _models.Cluster: """Gets a Service Fabric cluster resource. Get a Service Fabric cluster resource created or in the process of being created in the @@ -62,38 +65,40 @@ async def get( :rtype: ~azure.mgmt.servicefabric.models.Cluster :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Cluster"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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') + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Cluster] + + + request = build_get_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Cluster', pipeline_response) @@ -102,53 +107,55 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}"} # type: ignore + async def _create_or_update_initial( self, resource_group_name: str, cluster_name: str, - parameters: "_models.Cluster", + parameters: _models.Cluster, **kwargs: Any - ) -> "_models.Cluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.Cluster"] + ) -> _models.Cluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'Cluster') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Cluster] + + _json = self._serialize.body(parameters, 'Cluster') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('Cluster', pipeline_response) @@ -160,15 +167,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/clusters/{clusterName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}"} # type: ignore + + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, cluster_name: str, - parameters: "_models.Cluster", + parameters: _models.Cluster, **kwargs: Any - ) -> AsyncLROPoller["_models.Cluster"]: + ) -> AsyncLROPoller[_models.Cluster]: """Creates or updates a Service Fabric cluster resource. Create or update a Service Fabric cluster resource with the specified name. @@ -181,48 +191,58 @@ async def begin_create_or_update( :type parameters: ~azure.mgmt.servicefabric.models.Cluster :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Cluster or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Cluster or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicefabric.models.Cluster] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Cluster] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.Cluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_name, parameters=parameters, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): deserialized = self._deserialize('Cluster', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -231,55 +251,55 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}"} # type: ignore async def _update_initial( self, resource_group_name: str, cluster_name: str, - parameters: "_models.ClusterUpdateParameters", + parameters: _models.ClusterUpdateParameters, **kwargs: Any - ) -> "_models.Cluster": - cls = kwargs.pop('cls', None) # type: ClsType["_models.Cluster"] + ) -> _models.Cluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ClusterUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Cluster] + + _json = self._serialize.body(parameters, 'ClusterUpdateParameters') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('Cluster', pipeline_response) @@ -291,15 +311,18 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}"} # type: ignore + + + @distributed_trace_async async def begin_update( self, resource_group_name: str, cluster_name: str, - parameters: "_models.ClusterUpdateParameters", + parameters: _models.ClusterUpdateParameters, **kwargs: Any - ) -> AsyncLROPoller["_models.Cluster"]: + ) -> AsyncLROPoller[_models.Cluster]: """Updates the configuration of a Service Fabric cluster resource. Update the configuration of a Service Fabric cluster resource with the specified name. @@ -313,48 +336,58 @@ async def begin_update( :type parameters: ~azure.mgmt.servicefabric.models.ClusterUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either Cluster or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either Cluster or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicefabric.models.Cluster] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Cluster] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.Cluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._update_initial( + raw_result = await self._update_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_name, parameters=parameters, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): deserialized = self._deserialize('Cluster', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -363,11 +396,12 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}"} # type: ignore - async def delete( + @distributed_trace_async + async def delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cluster_name: str, @@ -386,50 +420,54 @@ async def delete( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) + error_map.update(kwargs.pop('error_map', {}) or {}) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + + + request = build_delete_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.delete.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}"} # type: ignore + + @distributed_trace_async async def list_by_resource_group( self, resource_group_name: str, **kwargs: Any - ) -> "_models.ClusterListResult": + ) -> _models.ClusterListResult: """Gets the list of Service Fabric cluster resources created in the specified resource group. Gets all Service Fabric cluster resources created or in the process of being created in the @@ -442,37 +480,39 @@ async def list_by_resource_group( :rtype: ~azure.mgmt.servicefabric.models.ClusterListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ClusterListResult] + + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_resource_group.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ClusterListResult', pipeline_response) @@ -481,12 +521,15 @@ async def list_by_resource_group( return cls(pipeline_response, deserialized, {}) return deserialized - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters"} # type: ignore + + + @distributed_trace_async async def list( self, **kwargs: Any - ) -> "_models.ClusterListResult": + ) -> _models.ClusterListResult: """Gets the list of Service Fabric cluster resources created in the specified subscription. Gets all Service Fabric cluster resources created or in the process of being created in the @@ -497,36 +540,38 @@ async def list( :rtype: ~azure.mgmt.servicefabric.models.ClusterListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ClusterListResult] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ClusterListResult', pipeline_response) @@ -535,16 +580,20 @@ async def list( return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/clusters'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/clusters"} # type: ignore + + + @distributed_trace_async async def list_upgradable_versions( self, resource_group_name: str, cluster_name: str, - versions_description: Optional["_models.UpgradableVersionsDescription"] = None, + versions_description: Optional[_models.UpgradableVersionsDescription] = None, **kwargs: Any - ) -> "_models.UpgradableVersionPathResult": - """Operation to get the minimum and maximum upgradable version from the current cluster version, or the required path to get to the an specific target version. + ) -> _models.UpgradableVersionPathResult: + """Operation to get the minimum and maximum upgradable version from the current cluster version, + or the required path to get to the an specific target version. If a target is not provided, it will get the minimum and maximum versions available from the current cluster version. If a target is given, it will provide the required path to get from @@ -554,53 +603,55 @@ async def list_upgradable_versions( :type resource_group_name: str :param cluster_name: The name of the cluster resource. :type cluster_name: str - :param versions_description: The upgrade path description with target version. + :param versions_description: The upgrade path description with target version. Default value is + None. :type versions_description: ~azure.mgmt.servicefabric.models.UpgradableVersionsDescription :keyword callable cls: A custom type or function that will be passed the direct response :return: UpgradableVersionPathResult, or the result of cls(response) :rtype: ~azure.mgmt.servicefabric.models.UpgradableVersionPathResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.UpgradableVersionPathResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.list_upgradable_versions.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) + error_map.update(kwargs.pop('error_map', {}) or {}) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.UpgradableVersionPathResult] - body_content_kwargs = {} # type: Dict[str, Any] if versions_description is not None: - body_content = self._serialize.body(versions_description, 'UpgradableVersionsDescription') + _json = self._serialize.body(versions_description, 'UpgradableVersionsDescription') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + _json = None + + request = build_list_upgradable_versions_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.list_upgradable_versions.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('UpgradableVersionPathResult', pipeline_response) @@ -609,4 +660,6 @@ async def list_upgradable_versions( return cls(pipeline_response, deserialized, {}) return deserialized - list_upgradable_versions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/listUpgradableVersions'} # type: ignore + + list_upgradable_versions.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/listUpgradableVersions"} # type: ignore + diff --git a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/aio/operations/_operations.py b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/aio/operations/_operations.py index 9a03647156cf..a3a01c5b4e52 100644 --- a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/aio/operations/_operations.py +++ b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/aio/operations/_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,84 +6,95 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar -import warnings +from typing import Any, AsyncIterable, Callable, Dict, Optional, TypeVar from azure.core.async_paging import AsyncItemPaged, AsyncList from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._operations import build_list_request T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class Operations: - """Operations async operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.servicefabric.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. + Instead, you should access the following operations through + :class:`~azure.mgmt.servicefabric.aio.ServiceFabricManagementClient`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace def list( self, **kwargs: Any - ) -> AsyncIterable["_models.OperationListResult"]: + ) -> AsyncIterable[_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.async_paging.AsyncItemPaged[~azure.mgmt.servicefabric.models.OperationListResult] + :rtype: + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.servicefabric.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + api_version=api_version, + template_url=self.list.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + api_version=api_version, + template_url=next_link, + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" return request async def extract_data(pipeline_response): - deserialized = self._deserialize('OperationListResult', pipeline_response) + deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -91,17 +103,22 @@ async def extract_data(pipeline_response): async def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return AsyncItemPaged( get_next, extract_data ) - list.metadata = {'url': '/providers/Microsoft.ServiceFabric/operations'} # type: ignore + list.metadata = {'url': "/providers/Microsoft.ServiceFabric/operations"} # type: ignore diff --git a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/aio/operations/_patch.py b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/aio/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/aio/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/aio/operations/_services_operations.py b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/aio/operations/_services_operations.py index 34709800f371..ce08df8b4365 100644 --- a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/aio/operations/_services_operations.py +++ b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/aio/operations/_services_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,43 +6,45 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.pipeline.transport import AsyncHttpResponse from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator_async import distributed_trace_async +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling from ... import models as _models - +from ..._vendor import _convert_request +from ...operations._services_operations import build_create_or_update_request_initial, build_delete_request_initial, build_get_request, build_list_request, build_update_request_initial T = TypeVar('T') ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] class ServicesOperations: - """ServicesOperations 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. + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.servicefabric.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. + Instead, you should access the following operations through + :class:`~azure.mgmt.servicefabric.aio.ServiceFabricManagementClient`'s + :attr:`services` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer) -> None: - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs) -> None: + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace_async async def get( self, resource_group_name: str, @@ -49,7 +52,7 @@ async def get( application_name: str, service_name: str, **kwargs: Any - ) -> "_models.ServiceResource": + ) -> _models.ServiceResource: """Gets a Service Fabric service resource. Get a Service Fabric service resource created or in the process of being created in the Service @@ -69,40 +72,42 @@ async def get( :rtype: ~azure.mgmt.servicefabric.models.ServiceResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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') + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ServiceResource] + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_name=application_name, + service_name=service_name, + api_version=api_version, + template_url=self.get.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ServiceResource', pipeline_response) @@ -111,7 +116,9 @@ async def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}/services/{serviceName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}/services/{serviceName}"} # type: ignore + async def _create_or_update_initial( self, @@ -119,49 +126,49 @@ async def _create_or_update_initial( cluster_name: str, application_name: str, service_name: str, - parameters: "_models.ServiceResource", + parameters: _models.ServiceResource, **kwargs: Any - ) -> "_models.ServiceResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] + ) -> _models.ServiceResource: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'applicationName': self._serialize.url("application_name", application_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ServiceResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ServiceResource] + + _json = self._serialize.body(parameters, 'ServiceResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_name=application_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = self._deserialize('ServiceResource', pipeline_response) @@ -169,17 +176,20 @@ async def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}/services/{serviceName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}/services/{serviceName}"} # type: ignore + + + @distributed_trace_async async def begin_create_or_update( self, resource_group_name: str, cluster_name: str, application_name: str, service_name: str, - parameters: "_models.ServiceResource", + parameters: _models.ServiceResource, **kwargs: Any - ) -> AsyncLROPoller["_models.ServiceResource"]: + ) -> AsyncLROPoller[_models.ServiceResource]: """Creates or updates a Service Fabric service resource. Create or update a Service Fabric service resource with the specified name. @@ -197,52 +207,60 @@ async def begin_create_or_update( :type parameters: ~azure.mgmt.servicefabric.models.ServiceResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicefabric.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ServiceResource] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._create_or_update_initial( + raw_result = await self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_name, application_name=application_name, service_name=service_name, parameters=parameters, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): deserialized = self._deserialize('ServiceResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'applicationName': self._serialize.url("application_name", application_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -251,9 +269,9 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}/services/{serviceName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}/services/{serviceName}"} # type: ignore async def _update_initial( self, @@ -261,49 +279,49 @@ async def _update_initial( cluster_name: str, application_name: str, service_name: str, - parameters: "_models.ServiceResourceUpdate", + parameters: _models.ServiceResourceUpdate, **kwargs: Any - ) -> "_models.ServiceResource": - cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] + ) -> _models.ServiceResource: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'applicationName': self._serialize.url("application_name", application_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ServiceResourceUpdate') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ServiceResource] + + _json = self._serialize.body(parameters, 'ServiceResourceUpdate') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_name=application_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = self._deserialize('ServiceResource', pipeline_response) @@ -311,17 +329,20 @@ async def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}/services/{serviceName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}/services/{serviceName}"} # type: ignore + + + @distributed_trace_async async def begin_update( self, resource_group_name: str, cluster_name: str, application_name: str, service_name: str, - parameters: "_models.ServiceResourceUpdate", + parameters: _models.ServiceResourceUpdate, **kwargs: Any - ) -> AsyncLROPoller["_models.ServiceResource"]: + ) -> AsyncLROPoller[_models.ServiceResource]: """Updates a Service Fabric service resource. Update a Service Fabric service resource with the specified name. @@ -339,52 +360,60 @@ async def begin_update( :type parameters: ~azure.mgmt.servicefabric.models.ServiceResourceUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of + cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.servicefabric.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ServiceResource] polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._update_initial( + raw_result = await self._update_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_name, application_name=application_name, service_name=service_name, parameters=parameters, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): deserialized = self._deserialize('ServiceResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'applicationName': self._serialize.url("application_name", application_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -393,11 +422,11 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}/services/{serviceName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}/services/{serviceName}"} # type: ignore - async def _delete_initial( + async def _delete_initial( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cluster_name: str, @@ -405,48 +434,51 @@ async def _delete_initial( service_name: str, **kwargs: Any ) -> None: - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'applicationName': self._serialize.url("application_name", application_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) + error_map.update(kwargs.pop('error_map', {}) or {}) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] - # 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, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}/services/{serviceName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}/services/{serviceName}"} # type: ignore + - async def begin_delete( + @distributed_trace_async + async def begin_delete( # pylint: disable=inconsistent-return-statements self, resource_group_name: str, cluster_name: str, @@ -469,48 +501,54 @@ async def begin_delete( :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be AsyncARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for + this operation to not poll, or pass in your own initialized polling object for a personal + polling strategy. :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.AsyncLROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = await self._delete_initial( + raw_result = await self._delete_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_name, application_name=application_name, service_name=service_name, + api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'applicationName': self._serialize.url("application_name", application_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - if polling is True: polling_method = AsyncARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = AsyncNoPolling() + if polling is True: + polling_method = cast(AsyncPollingMethod, AsyncARMPolling( + lro_delay, + + + **kwargs + )) # type: AsyncPollingMethod + elif polling is False: polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) else: polling_method = polling if cont_token: return AsyncLROPoller.from_continuation_token( @@ -519,18 +557,20 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}/services/{serviceName}'} # type: ignore + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}/services/{serviceName}"} # type: ignore + @distributed_trace_async async def list( self, resource_group_name: str, cluster_name: str, application_name: str, **kwargs: Any - ) -> "_models.ServiceResourceList": - """Gets the list of service resources created in the specified Service Fabric application resource. + ) -> _models.ServiceResourceList: + """Gets the list of service resources created in the specified Service Fabric application + resource. Gets all service resources created or in the process of being created in the Service Fabric application resource. @@ -546,39 +586,41 @@ async def list( :rtype: ~azure.mgmt.servicefabric.models.ServiceResourceList :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'applicationName': self._serialize.url("application_name", application_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ServiceResourceList] + + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_name=application_name, + api_version=api_version, + template_url=self.list.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = await self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ServiceResourceList', pipeline_response) @@ -587,4 +629,6 @@ async def list( return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}/services'} # type: ignore + + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}/services"} # type: ignore + diff --git a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/models/__init__.py b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/models/__init__.py index 8491cd577bf6..637dabad6fec 100644 --- a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/models/__init__.py +++ b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/models/__init__.py @@ -6,150 +6,78 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -try: - from ._models_py3 import ApplicationDeltaHealthPolicy - from ._models_py3 import ApplicationHealthPolicy - from ._models_py3 import ApplicationMetricDescription - from ._models_py3 import ApplicationResource - from ._models_py3 import ApplicationResourceList - from ._models_py3 import ApplicationResourceProperties - from ._models_py3 import ApplicationResourceUpdate - from ._models_py3 import ApplicationResourceUpdateProperties - from ._models_py3 import ApplicationTypeResource - from ._models_py3 import ApplicationTypeResourceList - from ._models_py3 import ApplicationTypeVersionResource - from ._models_py3 import ApplicationTypeVersionResourceList - from ._models_py3 import ApplicationTypeVersionsCleanupPolicy - from ._models_py3 import ApplicationUpgradePolicy - from ._models_py3 import ApplicationUserAssignedIdentity - from ._models_py3 import ArmApplicationHealthPolicy - from ._models_py3 import ArmRollingUpgradeMonitoringPolicy - from ._models_py3 import ArmServiceTypeHealthPolicy - from ._models_py3 import AvailableOperationDisplay - from ._models_py3 import AzureActiveDirectory - from ._models_py3 import CertificateDescription - from ._models_py3 import ClientCertificateCommonName - from ._models_py3 import ClientCertificateThumbprint - from ._models_py3 import Cluster - from ._models_py3 import ClusterCodeVersionsListResult - from ._models_py3 import ClusterCodeVersionsResult - from ._models_py3 import ClusterHealthPolicy - from ._models_py3 import ClusterListResult - from ._models_py3 import ClusterUpdateParameters - from ._models_py3 import ClusterUpgradeDeltaHealthPolicy - from ._models_py3 import ClusterUpgradePolicy - from ._models_py3 import ClusterVersionDetails - from ._models_py3 import DiagnosticsStorageAccountConfig - from ._models_py3 import EndpointRangeDescription - from ._models_py3 import ErrorModel - from ._models_py3 import ErrorModelError - from ._models_py3 import ManagedIdentity - from ._models_py3 import NamedPartitionSchemeDescription - from ._models_py3 import NodeTypeDescription - from ._models_py3 import Notification - from ._models_py3 import NotificationTarget - from ._models_py3 import OperationListResult - from ._models_py3 import OperationResult - from ._models_py3 import PartitionSchemeDescription - from ._models_py3 import ProxyResource - from ._models_py3 import Resource - from ._models_py3 import ServerCertificateCommonName - from ._models_py3 import ServerCertificateCommonNames - from ._models_py3 import ServiceCorrelationDescription - from ._models_py3 import ServiceLoadMetricDescription - from ._models_py3 import ServicePlacementPolicyDescription - from ._models_py3 import ServiceResource - from ._models_py3 import ServiceResourceList - from ._models_py3 import ServiceResourceProperties - from ._models_py3 import ServiceResourcePropertiesBase - from ._models_py3 import ServiceResourceUpdate - from ._models_py3 import ServiceResourceUpdateProperties - from ._models_py3 import ServiceTypeDeltaHealthPolicy - from ._models_py3 import ServiceTypeHealthPolicy - from ._models_py3 import SettingsParameterDescription - from ._models_py3 import SettingsSectionDescription - from ._models_py3 import SingletonPartitionSchemeDescription - from ._models_py3 import StatefulServiceProperties - from ._models_py3 import StatefulServiceUpdateProperties - from ._models_py3 import StatelessServiceProperties - from ._models_py3 import StatelessServiceUpdateProperties - from ._models_py3 import SystemData - from ._models_py3 import UniformInt64RangePartitionSchemeDescription - from ._models_py3 import UpgradableVersionPathResult - from ._models_py3 import UpgradableVersionsDescription - from ._models_py3 import UserAssignedIdentity -except (SyntaxError, ImportError): - from ._models import ApplicationDeltaHealthPolicy # type: ignore - from ._models import ApplicationHealthPolicy # type: ignore - from ._models import ApplicationMetricDescription # type: ignore - from ._models import ApplicationResource # type: ignore - from ._models import ApplicationResourceList # type: ignore - from ._models import ApplicationResourceProperties # type: ignore - from ._models import ApplicationResourceUpdate # type: ignore - from ._models import ApplicationResourceUpdateProperties # type: ignore - from ._models import ApplicationTypeResource # type: ignore - from ._models import ApplicationTypeResourceList # type: ignore - from ._models import ApplicationTypeVersionResource # type: ignore - from ._models import ApplicationTypeVersionResourceList # type: ignore - from ._models import ApplicationTypeVersionsCleanupPolicy # type: ignore - from ._models import ApplicationUpgradePolicy # type: ignore - from ._models import ApplicationUserAssignedIdentity # type: ignore - from ._models import ArmApplicationHealthPolicy # type: ignore - from ._models import ArmRollingUpgradeMonitoringPolicy # type: ignore - from ._models import ArmServiceTypeHealthPolicy # type: ignore - from ._models import AvailableOperationDisplay # type: ignore - from ._models import AzureActiveDirectory # type: ignore - from ._models import CertificateDescription # type: ignore - from ._models import ClientCertificateCommonName # type: ignore - from ._models import ClientCertificateThumbprint # type: ignore - from ._models import Cluster # type: ignore - from ._models import ClusterCodeVersionsListResult # type: ignore - from ._models import ClusterCodeVersionsResult # type: ignore - from ._models import ClusterHealthPolicy # type: ignore - from ._models import ClusterListResult # type: ignore - from ._models import ClusterUpdateParameters # type: ignore - from ._models import ClusterUpgradeDeltaHealthPolicy # type: ignore - from ._models import ClusterUpgradePolicy # type: ignore - from ._models import ClusterVersionDetails # type: ignore - from ._models import DiagnosticsStorageAccountConfig # type: ignore - from ._models import EndpointRangeDescription # type: ignore - from ._models import ErrorModel # type: ignore - from ._models import ErrorModelError # type: ignore - from ._models import ManagedIdentity # type: ignore - from ._models import NamedPartitionSchemeDescription # type: ignore - from ._models import NodeTypeDescription # type: ignore - from ._models import Notification # type: ignore - from ._models import NotificationTarget # type: ignore - from ._models import OperationListResult # type: ignore - from ._models import OperationResult # type: ignore - from ._models import PartitionSchemeDescription # type: ignore - from ._models import ProxyResource # type: ignore - from ._models import Resource # type: ignore - from ._models import ServerCertificateCommonName # type: ignore - from ._models import ServerCertificateCommonNames # type: ignore - from ._models import ServiceCorrelationDescription # type: ignore - from ._models import ServiceLoadMetricDescription # type: ignore - from ._models import ServicePlacementPolicyDescription # type: ignore - from ._models import ServiceResource # type: ignore - from ._models import ServiceResourceList # type: ignore - from ._models import ServiceResourceProperties # type: ignore - from ._models import ServiceResourcePropertiesBase # type: ignore - from ._models import ServiceResourceUpdate # type: ignore - from ._models import ServiceResourceUpdateProperties # type: ignore - from ._models import ServiceTypeDeltaHealthPolicy # type: ignore - from ._models import ServiceTypeHealthPolicy # type: ignore - from ._models import SettingsParameterDescription # type: ignore - from ._models import SettingsSectionDescription # type: ignore - from ._models import SingletonPartitionSchemeDescription # type: ignore - from ._models import StatefulServiceProperties # type: ignore - from ._models import StatefulServiceUpdateProperties # type: ignore - from ._models import StatelessServiceProperties # type: ignore - from ._models import StatelessServiceUpdateProperties # type: ignore - from ._models import SystemData # type: ignore - from ._models import UniformInt64RangePartitionSchemeDescription # type: ignore - from ._models import UpgradableVersionPathResult # type: ignore - from ._models import UpgradableVersionsDescription # type: ignore - from ._models import UserAssignedIdentity # type: ignore +from ._models_py3 import ApplicationDeltaHealthPolicy +from ._models_py3 import ApplicationHealthPolicy +from ._models_py3 import ApplicationMetricDescription +from ._models_py3 import ApplicationResource +from ._models_py3 import ApplicationResourceList +from ._models_py3 import ApplicationResourceProperties +from ._models_py3 import ApplicationResourceUpdate +from ._models_py3 import ApplicationResourceUpdateProperties +from ._models_py3 import ApplicationTypeResource +from ._models_py3 import ApplicationTypeResourceList +from ._models_py3 import ApplicationTypeVersionResource +from ._models_py3 import ApplicationTypeVersionResourceList +from ._models_py3 import ApplicationTypeVersionsCleanupPolicy +from ._models_py3 import ApplicationUpgradePolicy +from ._models_py3 import ApplicationUserAssignedIdentity +from ._models_py3 import ArmApplicationHealthPolicy +from ._models_py3 import ArmRollingUpgradeMonitoringPolicy +from ._models_py3 import ArmServiceTypeHealthPolicy +from ._models_py3 import AvailableOperationDisplay +from ._models_py3 import AzureActiveDirectory +from ._models_py3 import CertificateDescription +from ._models_py3 import ClientCertificateCommonName +from ._models_py3 import ClientCertificateThumbprint +from ._models_py3 import Cluster +from ._models_py3 import ClusterCodeVersionsListResult +from ._models_py3 import ClusterCodeVersionsResult +from ._models_py3 import ClusterHealthPolicy +from ._models_py3 import ClusterListResult +from ._models_py3 import ClusterUpdateParameters +from ._models_py3 import ClusterUpgradeDeltaHealthPolicy +from ._models_py3 import ClusterUpgradePolicy +from ._models_py3 import ClusterVersionDetails +from ._models_py3 import DiagnosticsStorageAccountConfig +from ._models_py3 import EndpointRangeDescription +from ._models_py3 import ErrorModel +from ._models_py3 import ErrorModelError +from ._models_py3 import ManagedIdentity +from ._models_py3 import NamedPartitionSchemeDescription +from ._models_py3 import NodeTypeDescription +from ._models_py3 import Notification +from ._models_py3 import NotificationTarget +from ._models_py3 import OperationListResult +from ._models_py3 import OperationResult +from ._models_py3 import PartitionSchemeDescription +from ._models_py3 import ProxyResource +from ._models_py3 import Resource +from ._models_py3 import ServerCertificateCommonName +from ._models_py3 import ServerCertificateCommonNames +from ._models_py3 import ServiceCorrelationDescription +from ._models_py3 import ServiceLoadMetricDescription +from ._models_py3 import ServicePlacementPolicyDescription +from ._models_py3 import ServiceResource +from ._models_py3 import ServiceResourceList +from ._models_py3 import ServiceResourceProperties +from ._models_py3 import ServiceResourcePropertiesBase +from ._models_py3 import ServiceResourceUpdate +from ._models_py3 import ServiceResourceUpdateProperties +from ._models_py3 import ServiceTypeDeltaHealthPolicy +from ._models_py3 import ServiceTypeHealthPolicy +from ._models_py3 import SettingsParameterDescription +from ._models_py3 import SettingsSectionDescription +from ._models_py3 import SingletonPartitionSchemeDescription +from ._models_py3 import StatefulServiceProperties +from ._models_py3 import StatefulServiceUpdateProperties +from ._models_py3 import StatelessServiceProperties +from ._models_py3 import StatelessServiceUpdateProperties +from ._models_py3 import SystemData +from ._models_py3 import UniformInt64RangePartitionSchemeDescription +from ._models_py3 import UpgradableVersionPathResult +from ._models_py3 import UpgradableVersionsDescription +from ._models_py3 import UserAssignedIdentity + from ._service_fabric_management_client_enums import ( AddOnFeatures, @@ -158,8 +86,8 @@ ClusterEnvironment, ClusterState, ClusterUpgradeCadence, + ClusterVersionsEnvironment, DurabilityLevel, - Enum14, ManagedIdentityType, MoveCost, NotificationCategory, @@ -178,7 +106,9 @@ UpgradeMode, VmssZonalUpgradeMode, ) - +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'ApplicationDeltaHealthPolicy', 'ApplicationHealthPolicy', @@ -257,8 +187,8 @@ 'ClusterEnvironment', 'ClusterState', 'ClusterUpgradeCadence', + 'ClusterVersionsEnvironment', 'DurabilityLevel', - 'Enum14', 'ManagedIdentityType', 'MoveCost', 'NotificationCategory', @@ -277,3 +207,5 @@ 'UpgradeMode', 'VmssZonalUpgradeMode', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/models/_models.py b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/models/_models.py deleted file mode 100644 index 7c24715734c0..000000000000 --- a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/models/_models.py +++ /dev/null @@ -1,3507 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.core.exceptions import HttpResponseError -import msrest.serialization - - -class ApplicationDeltaHealthPolicy(msrest.serialization.Model): - """Defines a delta health policy used to evaluate the health of an application or one of its child entities when upgrading the cluster. - - :param default_service_type_delta_health_policy: The delta health policy used by default to - evaluate the health of a service type when upgrading the cluster. - :type default_service_type_delta_health_policy: - ~azure.mgmt.servicefabric.models.ServiceTypeDeltaHealthPolicy - :param service_type_delta_health_policies: The map with service type delta health policy per - service type name. The map is empty by default. - :type service_type_delta_health_policies: dict[str, - ~azure.mgmt.servicefabric.models.ServiceTypeDeltaHealthPolicy] - """ - - _attribute_map = { - 'default_service_type_delta_health_policy': {'key': 'defaultServiceTypeDeltaHealthPolicy', 'type': 'ServiceTypeDeltaHealthPolicy'}, - 'service_type_delta_health_policies': {'key': 'serviceTypeDeltaHealthPolicies', 'type': '{ServiceTypeDeltaHealthPolicy}'}, - } - - def __init__( - self, - **kwargs - ): - super(ApplicationDeltaHealthPolicy, self).__init__(**kwargs) - self.default_service_type_delta_health_policy = kwargs.get('default_service_type_delta_health_policy', None) - self.service_type_delta_health_policies = kwargs.get('service_type_delta_health_policies', None) - - -class ApplicationHealthPolicy(msrest.serialization.Model): - """Defines a health policy used to evaluate the health of an application or one of its children entities. - - :param default_service_type_health_policy: The health policy used by default to evaluate the - health of a service type. - :type default_service_type_health_policy: - ~azure.mgmt.servicefabric.models.ServiceTypeHealthPolicy - :param service_type_health_policies: The map with service type health policy per service type - name. The map is empty by default. - :type service_type_health_policies: dict[str, - ~azure.mgmt.servicefabric.models.ServiceTypeHealthPolicy] - """ - - _attribute_map = { - 'default_service_type_health_policy': {'key': 'defaultServiceTypeHealthPolicy', 'type': 'ServiceTypeHealthPolicy'}, - 'service_type_health_policies': {'key': 'serviceTypeHealthPolicies', 'type': '{ServiceTypeHealthPolicy}'}, - } - - def __init__( - self, - **kwargs - ): - super(ApplicationHealthPolicy, self).__init__(**kwargs) - self.default_service_type_health_policy = kwargs.get('default_service_type_health_policy', None) - self.service_type_health_policies = kwargs.get('service_type_health_policies', None) - - -class ApplicationMetricDescription(msrest.serialization.Model): - """Describes capacity information for a custom resource balancing metric. This can be used to limit the total consumption of this metric by the services of this application. - - :param name: The name of the metric. - :type name: str - :param maximum_capacity: The maximum node capacity for Service Fabric application. - This is the maximum Load for an instance of this application on a single node. Even if the - capacity of node is greater than this value, Service Fabric will limit the total load of - services within the application on each node to this value. - If set to zero, capacity for this metric is unlimited on each node. - When creating a new application with application capacity defined, the product of MaximumNodes - and this value must always be smaller than or equal to TotalApplicationCapacity. - When updating existing application with application capacity, the product of MaximumNodes and - this value must always be smaller than or equal to TotalApplicationCapacity. - :type maximum_capacity: long - :param reservation_capacity: The node reservation capacity for Service Fabric application. - This is the amount of load which is reserved on nodes which have instances of this - application. - If MinimumNodes is specified, then the product of these values will be the capacity reserved - in the cluster for the application. - If set to zero, no capacity is reserved for this metric. - When setting application capacity or when updating application capacity; this value must be - smaller than or equal to MaximumCapacity for each metric. - :type reservation_capacity: long - :param total_application_capacity: The total metric capacity for Service Fabric application. - This is the total metric capacity for this application in the cluster. Service Fabric will try - to limit the sum of loads of services within the application to this value. - When creating a new application with application capacity defined, the product of MaximumNodes - and MaximumCapacity must always be smaller than or equal to this value. - :type total_application_capacity: long - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'maximum_capacity': {'key': 'maximumCapacity', 'type': 'long'}, - 'reservation_capacity': {'key': 'reservationCapacity', 'type': 'long'}, - 'total_application_capacity': {'key': 'totalApplicationCapacity', 'type': 'long'}, - } - - def __init__( - self, - **kwargs - ): - super(ApplicationMetricDescription, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.maximum_capacity = kwargs.get('maximum_capacity', None) - self.reservation_capacity = kwargs.get('reservation_capacity', None) - self.total_application_capacity = kwargs.get('total_application_capacity', None) - - -class ProxyResource(msrest.serialization.Model): - """The resource model definition for proxy-only resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Azure resource identifier. - :vartype id: str - :ivar name: Azure resource name. - :vartype name: str - :ivar type: Azure resource type. - :vartype type: str - :param location: It will be deprecated in New API, resource location depends on the parent - resource. - :type location: str - :param tags: A set of tags. Azure resource tags. - :type tags: dict[str, str] - :ivar etag: Azure resource etag. - :vartype etag: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.servicefabric.models.SystemData - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'etag': {'readonly': True}, - 'system_data': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - } - - def __init__( - self, - **kwargs - ): - super(ProxyResource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.location = kwargs.get('location', None) - self.tags = kwargs.get('tags', None) - self.etag = None - self.system_data = None - - -class ApplicationResource(ProxyResource): - """The application resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Azure resource identifier. - :vartype id: str - :ivar name: Azure resource name. - :vartype name: str - :ivar type: Azure resource type. - :vartype type: str - :param location: It will be deprecated in New API, resource location depends on the parent - resource. - :type location: str - :param tags: A set of tags. Azure resource tags. - :type tags: dict[str, str] - :ivar etag: Azure resource etag. - :vartype etag: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.servicefabric.models.SystemData - :param identity: Describes the managed identities for an Azure resource. - :type identity: ~azure.mgmt.servicefabric.models.ManagedIdentity - :param type_version: The version of the application type as defined in the application - manifest. - :type type_version: str - :param parameters: List of application parameters with overridden values from their default - values specified in the application manifest. - :type parameters: dict[str, str] - :param upgrade_policy: Describes the policy for a monitored application upgrade. - :type upgrade_policy: ~azure.mgmt.servicefabric.models.ApplicationUpgradePolicy - :param minimum_nodes: The minimum number of nodes where Service Fabric will reserve capacity - for this application. Note that this does not mean that the services of this application will - be placed on all of those nodes. If this property is set to zero, no capacity will be reserved. - The value of this property cannot be more than the value of the MaximumNodes property. - :type minimum_nodes: long - :param maximum_nodes: The maximum number of nodes where Service Fabric will reserve capacity - for this application. Note that this does not mean that the services of this application will - be placed on all of those nodes. By default, the value of this property is zero and it means - that the services can be placed on any node. - :type maximum_nodes: long - :param remove_application_capacity: Remove the current application capacity settings. - :type remove_application_capacity: bool - :param metrics: List of application capacity metric description. - :type metrics: list[~azure.mgmt.servicefabric.models.ApplicationMetricDescription] - :param managed_identities: List of user assigned identities for the application, each mapped to - a friendly name. - :type managed_identities: - list[~azure.mgmt.servicefabric.models.ApplicationUserAssignedIdentity] - :ivar provisioning_state: The current deployment or provisioning state, which only appears in - the response. - :vartype provisioning_state: str - :param type_name: The application type name as defined in the application manifest. - :type type_name: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'etag': {'readonly': True}, - 'system_data': {'readonly': True}, - 'minimum_nodes': {'minimum': 0}, - 'maximum_nodes': {'minimum': 0}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'identity': {'key': 'identity', 'type': 'ManagedIdentity'}, - 'type_version': {'key': 'properties.typeVersion', 'type': 'str'}, - 'parameters': {'key': 'properties.parameters', 'type': '{str}'}, - 'upgrade_policy': {'key': 'properties.upgradePolicy', 'type': 'ApplicationUpgradePolicy'}, - 'minimum_nodes': {'key': 'properties.minimumNodes', 'type': 'long'}, - 'maximum_nodes': {'key': 'properties.maximumNodes', 'type': 'long'}, - 'remove_application_capacity': {'key': 'properties.removeApplicationCapacity', 'type': 'bool'}, - 'metrics': {'key': 'properties.metrics', 'type': '[ApplicationMetricDescription]'}, - 'managed_identities': {'key': 'properties.managedIdentities', 'type': '[ApplicationUserAssignedIdentity]'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'type_name': {'key': 'properties.typeName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ApplicationResource, self).__init__(**kwargs) - self.identity = kwargs.get('identity', None) - self.type_version = kwargs.get('type_version', None) - self.parameters = kwargs.get('parameters', None) - self.upgrade_policy = kwargs.get('upgrade_policy', None) - self.minimum_nodes = kwargs.get('minimum_nodes', None) - self.maximum_nodes = kwargs.get('maximum_nodes', 0) - self.remove_application_capacity = kwargs.get('remove_application_capacity', None) - self.metrics = kwargs.get('metrics', None) - self.managed_identities = kwargs.get('managed_identities', None) - self.provisioning_state = None - self.type_name = kwargs.get('type_name', None) - - -class ApplicationResourceList(msrest.serialization.Model): - """The list of application resources. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param value: - :type value: list[~azure.mgmt.servicefabric.models.ApplicationResource] - :ivar next_link: URL to get the next set of application list results if there are any. - :vartype next_link: str - """ - - _validation = { - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ApplicationResource]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ApplicationResourceList, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = None - - -class ApplicationResourceUpdateProperties(msrest.serialization.Model): - """The application resource properties for patch operations. - - :param type_version: The version of the application type as defined in the application - manifest. - :type type_version: str - :param parameters: List of application parameters with overridden values from their default - values specified in the application manifest. - :type parameters: dict[str, str] - :param upgrade_policy: Describes the policy for a monitored application upgrade. - :type upgrade_policy: ~azure.mgmt.servicefabric.models.ApplicationUpgradePolicy - :param minimum_nodes: The minimum number of nodes where Service Fabric will reserve capacity - for this application. Note that this does not mean that the services of this application will - be placed on all of those nodes. If this property is set to zero, no capacity will be reserved. - The value of this property cannot be more than the value of the MaximumNodes property. - :type minimum_nodes: long - :param maximum_nodes: The maximum number of nodes where Service Fabric will reserve capacity - for this application. Note that this does not mean that the services of this application will - be placed on all of those nodes. By default, the value of this property is zero and it means - that the services can be placed on any node. - :type maximum_nodes: long - :param remove_application_capacity: Remove the current application capacity settings. - :type remove_application_capacity: bool - :param metrics: List of application capacity metric description. - :type metrics: list[~azure.mgmt.servicefabric.models.ApplicationMetricDescription] - :param managed_identities: List of user assigned identities for the application, each mapped to - a friendly name. - :type managed_identities: - list[~azure.mgmt.servicefabric.models.ApplicationUserAssignedIdentity] - """ - - _validation = { - 'minimum_nodes': {'minimum': 0}, - 'maximum_nodes': {'minimum': 0}, - } - - _attribute_map = { - 'type_version': {'key': 'typeVersion', 'type': 'str'}, - 'parameters': {'key': 'parameters', 'type': '{str}'}, - 'upgrade_policy': {'key': 'upgradePolicy', 'type': 'ApplicationUpgradePolicy'}, - 'minimum_nodes': {'key': 'minimumNodes', 'type': 'long'}, - 'maximum_nodes': {'key': 'maximumNodes', 'type': 'long'}, - 'remove_application_capacity': {'key': 'removeApplicationCapacity', 'type': 'bool'}, - 'metrics': {'key': 'metrics', 'type': '[ApplicationMetricDescription]'}, - 'managed_identities': {'key': 'managedIdentities', 'type': '[ApplicationUserAssignedIdentity]'}, - } - - def __init__( - self, - **kwargs - ): - super(ApplicationResourceUpdateProperties, self).__init__(**kwargs) - self.type_version = kwargs.get('type_version', None) - self.parameters = kwargs.get('parameters', None) - self.upgrade_policy = kwargs.get('upgrade_policy', None) - self.minimum_nodes = kwargs.get('minimum_nodes', None) - self.maximum_nodes = kwargs.get('maximum_nodes', 0) - self.remove_application_capacity = kwargs.get('remove_application_capacity', None) - self.metrics = kwargs.get('metrics', None) - self.managed_identities = kwargs.get('managed_identities', None) - - -class ApplicationResourceProperties(ApplicationResourceUpdateProperties): - """The application resource properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param type_version: The version of the application type as defined in the application - manifest. - :type type_version: str - :param parameters: List of application parameters with overridden values from their default - values specified in the application manifest. - :type parameters: dict[str, str] - :param upgrade_policy: Describes the policy for a monitored application upgrade. - :type upgrade_policy: ~azure.mgmt.servicefabric.models.ApplicationUpgradePolicy - :param minimum_nodes: The minimum number of nodes where Service Fabric will reserve capacity - for this application. Note that this does not mean that the services of this application will - be placed on all of those nodes. If this property is set to zero, no capacity will be reserved. - The value of this property cannot be more than the value of the MaximumNodes property. - :type minimum_nodes: long - :param maximum_nodes: The maximum number of nodes where Service Fabric will reserve capacity - for this application. Note that this does not mean that the services of this application will - be placed on all of those nodes. By default, the value of this property is zero and it means - that the services can be placed on any node. - :type maximum_nodes: long - :param remove_application_capacity: Remove the current application capacity settings. - :type remove_application_capacity: bool - :param metrics: List of application capacity metric description. - :type metrics: list[~azure.mgmt.servicefabric.models.ApplicationMetricDescription] - :param managed_identities: List of user assigned identities for the application, each mapped to - a friendly name. - :type managed_identities: - list[~azure.mgmt.servicefabric.models.ApplicationUserAssignedIdentity] - :ivar provisioning_state: The current deployment or provisioning state, which only appears in - the response. - :vartype provisioning_state: str - :param type_name: The application type name as defined in the application manifest. - :type type_name: str - """ - - _validation = { - 'minimum_nodes': {'minimum': 0}, - 'maximum_nodes': {'minimum': 0}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'type_version': {'key': 'typeVersion', 'type': 'str'}, - 'parameters': {'key': 'parameters', 'type': '{str}'}, - 'upgrade_policy': {'key': 'upgradePolicy', 'type': 'ApplicationUpgradePolicy'}, - 'minimum_nodes': {'key': 'minimumNodes', 'type': 'long'}, - 'maximum_nodes': {'key': 'maximumNodes', 'type': 'long'}, - 'remove_application_capacity': {'key': 'removeApplicationCapacity', 'type': 'bool'}, - 'metrics': {'key': 'metrics', 'type': '[ApplicationMetricDescription]'}, - 'managed_identities': {'key': 'managedIdentities', 'type': '[ApplicationUserAssignedIdentity]'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'type_name': {'key': 'typeName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ApplicationResourceProperties, self).__init__(**kwargs) - self.provisioning_state = None - self.type_name = kwargs.get('type_name', None) - - -class ApplicationResourceUpdate(ProxyResource): - """The application resource for patch operations. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Azure resource identifier. - :vartype id: str - :ivar name: Azure resource name. - :vartype name: str - :ivar type: Azure resource type. - :vartype type: str - :param location: It will be deprecated in New API, resource location depends on the parent - resource. - :type location: str - :param tags: A set of tags. Azure resource tags. - :type tags: dict[str, str] - :ivar etag: Azure resource etag. - :vartype etag: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.servicefabric.models.SystemData - :param type_version: The version of the application type as defined in the application - manifest. - :type type_version: str - :param parameters: List of application parameters with overridden values from their default - values specified in the application manifest. - :type parameters: dict[str, str] - :param upgrade_policy: Describes the policy for a monitored application upgrade. - :type upgrade_policy: ~azure.mgmt.servicefabric.models.ApplicationUpgradePolicy - :param minimum_nodes: The minimum number of nodes where Service Fabric will reserve capacity - for this application. Note that this does not mean that the services of this application will - be placed on all of those nodes. If this property is set to zero, no capacity will be reserved. - The value of this property cannot be more than the value of the MaximumNodes property. - :type minimum_nodes: long - :param maximum_nodes: The maximum number of nodes where Service Fabric will reserve capacity - for this application. Note that this does not mean that the services of this application will - be placed on all of those nodes. By default, the value of this property is zero and it means - that the services can be placed on any node. - :type maximum_nodes: long - :param remove_application_capacity: Remove the current application capacity settings. - :type remove_application_capacity: bool - :param metrics: List of application capacity metric description. - :type metrics: list[~azure.mgmt.servicefabric.models.ApplicationMetricDescription] - :param managed_identities: List of user assigned identities for the application, each mapped to - a friendly name. - :type managed_identities: - list[~azure.mgmt.servicefabric.models.ApplicationUserAssignedIdentity] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'etag': {'readonly': True}, - 'system_data': {'readonly': True}, - 'minimum_nodes': {'minimum': 0}, - 'maximum_nodes': {'minimum': 0}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'type_version': {'key': 'properties.typeVersion', 'type': 'str'}, - 'parameters': {'key': 'properties.parameters', 'type': '{str}'}, - 'upgrade_policy': {'key': 'properties.upgradePolicy', 'type': 'ApplicationUpgradePolicy'}, - 'minimum_nodes': {'key': 'properties.minimumNodes', 'type': 'long'}, - 'maximum_nodes': {'key': 'properties.maximumNodes', 'type': 'long'}, - 'remove_application_capacity': {'key': 'properties.removeApplicationCapacity', 'type': 'bool'}, - 'metrics': {'key': 'properties.metrics', 'type': '[ApplicationMetricDescription]'}, - 'managed_identities': {'key': 'properties.managedIdentities', 'type': '[ApplicationUserAssignedIdentity]'}, - } - - def __init__( - self, - **kwargs - ): - super(ApplicationResourceUpdate, self).__init__(**kwargs) - self.type_version = kwargs.get('type_version', None) - self.parameters = kwargs.get('parameters', None) - self.upgrade_policy = kwargs.get('upgrade_policy', None) - self.minimum_nodes = kwargs.get('minimum_nodes', None) - self.maximum_nodes = kwargs.get('maximum_nodes', 0) - self.remove_application_capacity = kwargs.get('remove_application_capacity', None) - self.metrics = kwargs.get('metrics', None) - self.managed_identities = kwargs.get('managed_identities', None) - - -class ApplicationTypeResource(ProxyResource): - """The application type name resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Azure resource identifier. - :vartype id: str - :ivar name: Azure resource name. - :vartype name: str - :ivar type: Azure resource type. - :vartype type: str - :param location: It will be deprecated in New API, resource location depends on the parent - resource. - :type location: str - :param tags: A set of tags. Azure resource tags. - :type tags: dict[str, str] - :ivar etag: Azure resource etag. - :vartype etag: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.servicefabric.models.SystemData - :ivar provisioning_state: The current deployment or provisioning state, which only appears in - the response. - :vartype provisioning_state: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'etag': {'readonly': True}, - 'system_data': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ApplicationTypeResource, self).__init__(**kwargs) - self.provisioning_state = None - - -class ApplicationTypeResourceList(msrest.serialization.Model): - """The list of application type names. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param value: - :type value: list[~azure.mgmt.servicefabric.models.ApplicationTypeResource] - :ivar next_link: URL to get the next set of application type list results if there are any. - :vartype next_link: str - """ - - _validation = { - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ApplicationTypeResource]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ApplicationTypeResourceList, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = None - - -class ApplicationTypeVersionResource(ProxyResource): - """An application type version resource for the specified application type name resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Azure resource identifier. - :vartype id: str - :ivar name: Azure resource name. - :vartype name: str - :ivar type: Azure resource type. - :vartype type: str - :param location: It will be deprecated in New API, resource location depends on the parent - resource. - :type location: str - :param tags: A set of tags. Azure resource tags. - :type tags: dict[str, str] - :ivar etag: Azure resource etag. - :vartype etag: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.servicefabric.models.SystemData - :ivar provisioning_state: The current deployment or provisioning state, which only appears in - the response. - :vartype provisioning_state: str - :param app_package_url: The URL to the application package. - :type app_package_url: str - :ivar default_parameter_list: List of application type parameters that can be overridden when - creating or updating the application. - :vartype default_parameter_list: dict[str, str] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'etag': {'readonly': True}, - 'system_data': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - 'default_parameter_list': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'app_package_url': {'key': 'properties.appPackageUrl', 'type': 'str'}, - 'default_parameter_list': {'key': 'properties.defaultParameterList', 'type': '{str}'}, - } - - def __init__( - self, - **kwargs - ): - super(ApplicationTypeVersionResource, self).__init__(**kwargs) - self.provisioning_state = None - self.app_package_url = kwargs.get('app_package_url', None) - self.default_parameter_list = None - - -class ApplicationTypeVersionResourceList(msrest.serialization.Model): - """The list of application type version resources for the specified application type name resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param value: - :type value: list[~azure.mgmt.servicefabric.models.ApplicationTypeVersionResource] - :ivar next_link: URL to get the next set of application type version list results if there are - any. - :vartype next_link: str - """ - - _validation = { - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ApplicationTypeVersionResource]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ApplicationTypeVersionResourceList, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = None - - -class ApplicationTypeVersionsCleanupPolicy(msrest.serialization.Model): - """ApplicationTypeVersionsCleanupPolicy. - - All required parameters must be populated in order to send to Azure. - - :param max_unused_versions_to_keep: Required. Number of unused versions per application type to - keep. - :type max_unused_versions_to_keep: long - """ - - _validation = { - 'max_unused_versions_to_keep': {'required': True, 'minimum': 0}, - } - - _attribute_map = { - 'max_unused_versions_to_keep': {'key': 'maxUnusedVersionsToKeep', 'type': 'long'}, - } - - def __init__( - self, - **kwargs - ): - super(ApplicationTypeVersionsCleanupPolicy, self).__init__(**kwargs) - self.max_unused_versions_to_keep = kwargs['max_unused_versions_to_keep'] - - -class ApplicationUpgradePolicy(msrest.serialization.Model): - """Describes the policy for a monitored application upgrade. - - :param upgrade_replica_set_check_timeout: The maximum amount of time to block processing of an - upgrade domain and prevent loss of availability when there are unexpected issues. When this - timeout expires, processing of the upgrade domain will proceed regardless of availability loss - issues. The timeout is reset at the start of each upgrade domain. Valid values are between 0 - and 42949672925 inclusive. (unsigned 32-bit integer). - :type upgrade_replica_set_check_timeout: str - :param force_restart: If true, then processes are forcefully restarted during upgrade even when - the code version has not changed (the upgrade only changes configuration or data). - :type force_restart: bool - :param rolling_upgrade_monitoring_policy: The policy used for monitoring the application - upgrade. - :type rolling_upgrade_monitoring_policy: - ~azure.mgmt.servicefabric.models.ArmRollingUpgradeMonitoringPolicy - :param application_health_policy: Defines a health policy used to evaluate the health of an - application or one of its children entities. - :type application_health_policy: ~azure.mgmt.servicefabric.models.ArmApplicationHealthPolicy - :param upgrade_mode: The mode used to monitor health during a rolling upgrade. The values are - UnmonitoredAuto, UnmonitoredManual, and Monitored. Possible values include: "Invalid", - "UnmonitoredAuto", "UnmonitoredManual", "Monitored". Default value: "Monitored". - :type upgrade_mode: str or ~azure.mgmt.servicefabric.models.RollingUpgradeMode - :param recreate_application: Determines whether the application should be recreated on update. - If value=true, the rest of the upgrade policy parameters are not allowed and it will result in - availability loss. - :type recreate_application: bool - """ - - _attribute_map = { - 'upgrade_replica_set_check_timeout': {'key': 'upgradeReplicaSetCheckTimeout', 'type': 'str'}, - 'force_restart': {'key': 'forceRestart', 'type': 'bool'}, - 'rolling_upgrade_monitoring_policy': {'key': 'rollingUpgradeMonitoringPolicy', 'type': 'ArmRollingUpgradeMonitoringPolicy'}, - 'application_health_policy': {'key': 'applicationHealthPolicy', 'type': 'ArmApplicationHealthPolicy'}, - 'upgrade_mode': {'key': 'upgradeMode', 'type': 'str'}, - 'recreate_application': {'key': 'recreateApplication', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(ApplicationUpgradePolicy, self).__init__(**kwargs) - self.upgrade_replica_set_check_timeout = kwargs.get('upgrade_replica_set_check_timeout', None) - self.force_restart = kwargs.get('force_restart', False) - self.rolling_upgrade_monitoring_policy = kwargs.get('rolling_upgrade_monitoring_policy', None) - self.application_health_policy = kwargs.get('application_health_policy', None) - self.upgrade_mode = kwargs.get('upgrade_mode', "Monitored") - self.recreate_application = kwargs.get('recreate_application', None) - - -class ApplicationUserAssignedIdentity(msrest.serialization.Model): - """ApplicationUserAssignedIdentity. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The friendly name of user assigned identity. - :type name: str - :param principal_id: Required. The principal id of user assigned identity. - :type principal_id: str - """ - - _validation = { - 'name': {'required': True}, - 'principal_id': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'principal_id': {'key': 'principalId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ApplicationUserAssignedIdentity, self).__init__(**kwargs) - self.name = kwargs['name'] - self.principal_id = kwargs['principal_id'] - - -class ArmApplicationHealthPolicy(msrest.serialization.Model): - """Defines a health policy used to evaluate the health of an application or one of its children entities. - - :param consider_warning_as_error: Indicates whether warnings are treated with the same severity - as errors. - :type consider_warning_as_error: bool - :param max_percent_unhealthy_deployed_applications: The maximum allowed percentage of unhealthy - deployed applications. Allowed values are Byte values from zero to 100. - The percentage represents the maximum tolerated percentage of deployed applications that can - be unhealthy before the application is considered in error. - This is calculated by dividing the number of unhealthy deployed applications over the number - of nodes where the application is currently deployed on in the cluster. - The computation rounds up to tolerate one failure on small numbers of nodes. Default - percentage is zero. - :type max_percent_unhealthy_deployed_applications: int - :param default_service_type_health_policy: The health policy used by default to evaluate the - health of a service type. - :type default_service_type_health_policy: - ~azure.mgmt.servicefabric.models.ArmServiceTypeHealthPolicy - :param service_type_health_policy_map: The map with service type health policy per service type - name. The map is empty by default. - :type service_type_health_policy_map: dict[str, - ~azure.mgmt.servicefabric.models.ArmServiceTypeHealthPolicy] - """ - - _attribute_map = { - 'consider_warning_as_error': {'key': 'considerWarningAsError', 'type': 'bool'}, - 'max_percent_unhealthy_deployed_applications': {'key': 'maxPercentUnhealthyDeployedApplications', 'type': 'int'}, - 'default_service_type_health_policy': {'key': 'defaultServiceTypeHealthPolicy', 'type': 'ArmServiceTypeHealthPolicy'}, - 'service_type_health_policy_map': {'key': 'serviceTypeHealthPolicyMap', 'type': '{ArmServiceTypeHealthPolicy}'}, - } - - def __init__( - self, - **kwargs - ): - super(ArmApplicationHealthPolicy, self).__init__(**kwargs) - self.consider_warning_as_error = kwargs.get('consider_warning_as_error', False) - self.max_percent_unhealthy_deployed_applications = kwargs.get('max_percent_unhealthy_deployed_applications', 0) - self.default_service_type_health_policy = kwargs.get('default_service_type_health_policy', None) - self.service_type_health_policy_map = kwargs.get('service_type_health_policy_map', None) - - -class ArmRollingUpgradeMonitoringPolicy(msrest.serialization.Model): - """The policy used for monitoring the application upgrade. - - :param failure_action: The activation Mode of the service package. Possible values include: - "Rollback", "Manual". - :type failure_action: str or ~azure.mgmt.servicefabric.models.ArmUpgradeFailureAction - :param health_check_wait_duration: The amount of time to wait after completing an upgrade - domain before applying health policies. It is first interpreted as a string representing an ISO - 8601 duration. If that fails, then it is interpreted as a number representing the total number - of milliseconds. - :type health_check_wait_duration: str - :param health_check_stable_duration: The amount of time that the application or cluster must - remain healthy before the upgrade proceeds to the next upgrade domain. It is first interpreted - as a string representing an ISO 8601 duration. If that fails, then it is interpreted as a - number representing the total number of milliseconds. - :type health_check_stable_duration: str - :param health_check_retry_timeout: The amount of time to retry health evaluation when the - application or cluster is unhealthy before FailureAction is executed. It is first interpreted - as a string representing an ISO 8601 duration. If that fails, then it is interpreted as a - number representing the total number of milliseconds. - :type health_check_retry_timeout: str - :param upgrade_timeout: The amount of time the overall upgrade has to complete before - FailureAction is executed. It is first interpreted as a string representing an ISO 8601 - duration. If that fails, then it is interpreted as a number representing the total number of - milliseconds. - :type upgrade_timeout: str - :param upgrade_domain_timeout: The amount of time each upgrade domain has to complete before - FailureAction is executed. It is first interpreted as a string representing an ISO 8601 - duration. If that fails, then it is interpreted as a number representing the total number of - milliseconds. - :type upgrade_domain_timeout: str - """ - - _attribute_map = { - 'failure_action': {'key': 'failureAction', 'type': 'str'}, - 'health_check_wait_duration': {'key': 'healthCheckWaitDuration', 'type': 'str'}, - 'health_check_stable_duration': {'key': 'healthCheckStableDuration', 'type': 'str'}, - 'health_check_retry_timeout': {'key': 'healthCheckRetryTimeout', 'type': 'str'}, - 'upgrade_timeout': {'key': 'upgradeTimeout', 'type': 'str'}, - 'upgrade_domain_timeout': {'key': 'upgradeDomainTimeout', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ArmRollingUpgradeMonitoringPolicy, self).__init__(**kwargs) - self.failure_action = kwargs.get('failure_action', None) - self.health_check_wait_duration = kwargs.get('health_check_wait_duration', "0") - self.health_check_stable_duration = kwargs.get('health_check_stable_duration', "PT0H2M0S") - self.health_check_retry_timeout = kwargs.get('health_check_retry_timeout', "PT0H10M0S") - self.upgrade_timeout = kwargs.get('upgrade_timeout', "P10675199DT02H48M05.4775807S") - self.upgrade_domain_timeout = kwargs.get('upgrade_domain_timeout', "P10675199DT02H48M05.4775807S") - - -class ArmServiceTypeHealthPolicy(msrest.serialization.Model): - """Represents the health policy used to evaluate the health of services belonging to a service type. - - :param max_percent_unhealthy_services: The maximum percentage of services allowed to be - unhealthy before your application is considered in error. - :type max_percent_unhealthy_services: int - :param max_percent_unhealthy_partitions_per_service: The maximum percentage of partitions per - service allowed to be unhealthy before your application is considered in error. - :type max_percent_unhealthy_partitions_per_service: int - :param max_percent_unhealthy_replicas_per_partition: The maximum percentage of replicas per - partition allowed to be unhealthy before your application is considered in error. - :type max_percent_unhealthy_replicas_per_partition: int - """ - - _validation = { - 'max_percent_unhealthy_services': {'maximum': 100, 'minimum': 0}, - 'max_percent_unhealthy_partitions_per_service': {'maximum': 100, 'minimum': 0}, - 'max_percent_unhealthy_replicas_per_partition': {'maximum': 100, 'minimum': 0}, - } - - _attribute_map = { - 'max_percent_unhealthy_services': {'key': 'maxPercentUnhealthyServices', 'type': 'int'}, - 'max_percent_unhealthy_partitions_per_service': {'key': 'maxPercentUnhealthyPartitionsPerService', 'type': 'int'}, - 'max_percent_unhealthy_replicas_per_partition': {'key': 'maxPercentUnhealthyReplicasPerPartition', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(ArmServiceTypeHealthPolicy, self).__init__(**kwargs) - self.max_percent_unhealthy_services = kwargs.get('max_percent_unhealthy_services', 0) - self.max_percent_unhealthy_partitions_per_service = kwargs.get('max_percent_unhealthy_partitions_per_service', 0) - self.max_percent_unhealthy_replicas_per_partition = kwargs.get('max_percent_unhealthy_replicas_per_partition', 0) - - -class AvailableOperationDisplay(msrest.serialization.Model): - """Operation supported by the Service Fabric resource provider. - - :param provider: The name of the provider. - :type provider: str - :param resource: The resource on which the operation is performed. - :type resource: str - :param operation: The operation that can be performed. - :type operation: str - :param description: Operation description. - :type description: str - """ - - _attribute_map = { - 'provider': {'key': 'provider', 'type': 'str'}, - 'resource': {'key': 'resource', 'type': 'str'}, - 'operation': {'key': 'operation', 'type': 'str'}, - 'description': {'key': 'description', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AvailableOperationDisplay, self).__init__(**kwargs) - self.provider = kwargs.get('provider', None) - self.resource = kwargs.get('resource', None) - self.operation = kwargs.get('operation', None) - self.description = kwargs.get('description', None) - - -class AzureActiveDirectory(msrest.serialization.Model): - """The settings to enable AAD authentication on the cluster. - - :param tenant_id: Azure active directory tenant id. - :type tenant_id: str - :param cluster_application: Azure active directory cluster application id. - :type cluster_application: str - :param client_application: Azure active directory client application id. - :type client_application: str - """ - - _attribute_map = { - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'cluster_application': {'key': 'clusterApplication', 'type': 'str'}, - 'client_application': {'key': 'clientApplication', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(AzureActiveDirectory, self).__init__(**kwargs) - self.tenant_id = kwargs.get('tenant_id', None) - self.cluster_application = kwargs.get('cluster_application', None) - self.client_application = kwargs.get('client_application', None) - - -class CertificateDescription(msrest.serialization.Model): - """Describes the certificate details. - - All required parameters must be populated in order to send to Azure. - - :param thumbprint: Required. Thumbprint of the primary certificate. - :type thumbprint: str - :param thumbprint_secondary: Thumbprint of the secondary certificate. - :type thumbprint_secondary: str - :param x509_store_name: The local certificate store location. Possible values include: - "AddressBook", "AuthRoot", "CertificateAuthority", "Disallowed", "My", "Root", "TrustedPeople", - "TrustedPublisher". - :type x509_store_name: str or ~azure.mgmt.servicefabric.models.StoreName - """ - - _validation = { - 'thumbprint': {'required': True}, - } - - _attribute_map = { - 'thumbprint': {'key': 'thumbprint', 'type': 'str'}, - 'thumbprint_secondary': {'key': 'thumbprintSecondary', 'type': 'str'}, - 'x509_store_name': {'key': 'x509StoreName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CertificateDescription, self).__init__(**kwargs) - self.thumbprint = kwargs['thumbprint'] - self.thumbprint_secondary = kwargs.get('thumbprint_secondary', None) - self.x509_store_name = kwargs.get('x509_store_name', None) - - -class ClientCertificateCommonName(msrest.serialization.Model): - """Describes the client certificate details using common name. - - All required parameters must be populated in order to send to Azure. - - :param is_admin: Required. Indicates if the client certificate has admin access to the cluster. - Non admin clients can perform only read only operations on the cluster. - :type is_admin: bool - :param certificate_common_name: Required. The common name of the client certificate. - :type certificate_common_name: str - :param certificate_issuer_thumbprint: Required. The issuer thumbprint of the client - certificate. - :type certificate_issuer_thumbprint: str - """ - - _validation = { - 'is_admin': {'required': True}, - 'certificate_common_name': {'required': True}, - 'certificate_issuer_thumbprint': {'required': True}, - } - - _attribute_map = { - 'is_admin': {'key': 'isAdmin', 'type': 'bool'}, - 'certificate_common_name': {'key': 'certificateCommonName', 'type': 'str'}, - 'certificate_issuer_thumbprint': {'key': 'certificateIssuerThumbprint', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ClientCertificateCommonName, self).__init__(**kwargs) - self.is_admin = kwargs['is_admin'] - self.certificate_common_name = kwargs['certificate_common_name'] - self.certificate_issuer_thumbprint = kwargs['certificate_issuer_thumbprint'] - - -class ClientCertificateThumbprint(msrest.serialization.Model): - """Describes the client certificate details using thumbprint. - - All required parameters must be populated in order to send to Azure. - - :param is_admin: Required. Indicates if the client certificate has admin access to the cluster. - Non admin clients can perform only read only operations on the cluster. - :type is_admin: bool - :param certificate_thumbprint: Required. The thumbprint of the client certificate. - :type certificate_thumbprint: str - """ - - _validation = { - 'is_admin': {'required': True}, - 'certificate_thumbprint': {'required': True}, - } - - _attribute_map = { - 'is_admin': {'key': 'isAdmin', 'type': 'bool'}, - 'certificate_thumbprint': {'key': 'certificateThumbprint', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ClientCertificateThumbprint, self).__init__(**kwargs) - self.is_admin = kwargs['is_admin'] - self.certificate_thumbprint = kwargs['certificate_thumbprint'] - - -class Resource(msrest.serialization.Model): - """The resource model definition. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Azure resource identifier. - :vartype id: str - :ivar name: Azure resource name. - :vartype name: str - :ivar type: Azure resource type. - :vartype type: str - :param location: Required. Azure resource location. - :type location: str - :param tags: A set of tags. Azure resource tags. - :type tags: dict[str, str] - :ivar etag: Azure resource etag. - :vartype etag: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.servicefabric.models.SystemData - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'etag': {'readonly': True}, - 'system_data': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - } - - def __init__( - self, - **kwargs - ): - super(Resource, self).__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.location = kwargs['location'] - self.tags = kwargs.get('tags', None) - self.etag = None - self.system_data = None - - -class Cluster(Resource): - """The cluster resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :ivar id: Azure resource identifier. - :vartype id: str - :ivar name: Azure resource name. - :vartype name: str - :ivar type: Azure resource type. - :vartype type: str - :param location: Required. Azure resource location. - :type location: str - :param tags: A set of tags. Azure resource tags. - :type tags: dict[str, str] - :ivar etag: Azure resource etag. - :vartype etag: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.servicefabric.models.SystemData - :param add_on_features: The list of add-on features to enable in the cluster. - :type add_on_features: list[str or ~azure.mgmt.servicefabric.models.AddOnFeatures] - :ivar available_cluster_versions: The Service Fabric runtime versions available for this - cluster. - :vartype available_cluster_versions: - list[~azure.mgmt.servicefabric.models.ClusterVersionDetails] - :param azure_active_directory: The AAD authentication settings of the cluster. - :type azure_active_directory: ~azure.mgmt.servicefabric.models.AzureActiveDirectory - :param certificate: The certificate to use for securing the cluster. The certificate provided - will be used for node to node security within the cluster, SSL certificate for cluster - management endpoint and default admin client. - :type certificate: ~azure.mgmt.servicefabric.models.CertificateDescription - :param certificate_common_names: Describes a list of server certificates referenced by common - name that are used to secure the cluster. - :type certificate_common_names: ~azure.mgmt.servicefabric.models.ServerCertificateCommonNames - :param client_certificate_common_names: The list of client certificates referenced by common - name that are allowed to manage the cluster. - :type client_certificate_common_names: - list[~azure.mgmt.servicefabric.models.ClientCertificateCommonName] - :param client_certificate_thumbprints: The list of client certificates referenced by thumbprint - that are allowed to manage the cluster. - :type client_certificate_thumbprints: - list[~azure.mgmt.servicefabric.models.ClientCertificateThumbprint] - :param cluster_code_version: The Service Fabric runtime version of the cluster. This property - can only by set the user when **upgradeMode** is set to 'Manual'. To get list of available - Service Fabric versions for new clusters use `ClusterVersion API <./ClusterVersion.md>`_. To - get the list of available version for existing clusters use **availableClusterVersions**. - :type cluster_code_version: str - :ivar cluster_endpoint: The Azure Resource Provider endpoint. A system service in the cluster - connects to this endpoint. - :vartype cluster_endpoint: str - :ivar cluster_id: A service generated unique identifier for the cluster resource. - :vartype cluster_id: str - :ivar cluster_state: The current state of the cluster. - - - * WaitingForNodes - Indicates that the cluster resource is created and the resource provider - is waiting for Service Fabric VM extension to boot up and report to it. - * Deploying - Indicates that the Service Fabric runtime is being installed on the VMs. Cluster - resource will be in this state until the cluster boots up and system services are up. - * BaselineUpgrade - Indicates that the cluster is upgrading to establishes the cluster - version. This upgrade is automatically initiated when the cluster boots up for the first time. - * UpdatingUserConfiguration - Indicates that the cluster is being upgraded with the user - provided configuration. - * UpdatingUserCertificate - Indicates that the cluster is being upgraded with the user - provided certificate. - * UpdatingInfrastructure - Indicates that the cluster is being upgraded with the latest - Service Fabric runtime version. This happens only when the **upgradeMode** is set to - 'Automatic'. - * EnforcingClusterVersion - Indicates that cluster is on a different version than expected and - the cluster is being upgraded to the expected version. - * UpgradeServiceUnreachable - Indicates that the system service in the cluster is no longer - polling the Resource Provider. Clusters in this state cannot be managed by the Resource - Provider. - * AutoScale - Indicates that the ReliabilityLevel of the cluster is being adjusted. - * Ready - Indicates that the cluster is in a stable state. Possible values include: - "WaitingForNodes", "Deploying", "BaselineUpgrade", "UpdatingUserConfiguration", - "UpdatingUserCertificate", "UpdatingInfrastructure", "EnforcingClusterVersion", - "UpgradeServiceUnreachable", "AutoScale", "Ready". - :vartype cluster_state: str or ~azure.mgmt.servicefabric.models.ClusterState - :param diagnostics_storage_account_config: The storage account information for storing Service - Fabric diagnostic logs. - :type diagnostics_storage_account_config: - ~azure.mgmt.servicefabric.models.DiagnosticsStorageAccountConfig - :param event_store_service_enabled: Indicates if the event store service is enabled. - :type event_store_service_enabled: bool - :param fabric_settings: The list of custom fabric settings to configure the cluster. - :type fabric_settings: list[~azure.mgmt.servicefabric.models.SettingsSectionDescription] - :param management_endpoint: The http management endpoint of the cluster. - :type management_endpoint: str - :param node_types: The list of node types in the cluster. - :type node_types: list[~azure.mgmt.servicefabric.models.NodeTypeDescription] - :ivar provisioning_state: The provisioning state of the cluster resource. Possible values - include: "Updating", "Succeeded", "Failed", "Canceled". - :vartype provisioning_state: str or ~azure.mgmt.servicefabric.models.ProvisioningState - :param reliability_level: The reliability level sets the replica set size of system services. - Learn about `ReliabilityLevel - `_. - - - * None - Run the System services with a target replica set count of 1. This should only be - used for test clusters. - * Bronze - Run the System services with a target replica set count of 3. This should only be - used for test clusters. - * Silver - Run the System services with a target replica set count of 5. - * Gold - Run the System services with a target replica set count of 7. - * Platinum - Run the System services with a target replica set count of 9. Possible values - include: "None", "Bronze", "Silver", "Gold", "Platinum". - :type reliability_level: str or ~azure.mgmt.servicefabric.models.ReliabilityLevel - :param reverse_proxy_certificate: The server certificate used by reverse proxy. - :type reverse_proxy_certificate: ~azure.mgmt.servicefabric.models.CertificateDescription - :param reverse_proxy_certificate_common_names: Describes a list of server certificates - referenced by common name that are used to secure the cluster. - :type reverse_proxy_certificate_common_names: - ~azure.mgmt.servicefabric.models.ServerCertificateCommonNames - :param upgrade_description: The policy to use when upgrading the cluster. - :type upgrade_description: ~azure.mgmt.servicefabric.models.ClusterUpgradePolicy - :param upgrade_mode: The upgrade mode of the cluster when new Service Fabric runtime version is - available. Possible values include: "Automatic", "Manual". Default value: "Automatic". - :type upgrade_mode: str or ~azure.mgmt.servicefabric.models.UpgradeMode - :param application_type_versions_cleanup_policy: The policy used to clean up unused versions. - :type application_type_versions_cleanup_policy: - ~azure.mgmt.servicefabric.models.ApplicationTypeVersionsCleanupPolicy - :param vm_image: The VM image VMSS has been configured with. Generic names such as Windows or - Linux can be used. - :type vm_image: str - :param sf_zonal_upgrade_mode: This property controls the logical grouping of VMs in upgrade - domains (UDs). This property can't be modified if a node type with multiple Availability Zones - is already present in the cluster. Possible values include: "Parallel", "Hierarchical". - :type sf_zonal_upgrade_mode: str or ~azure.mgmt.servicefabric.models.SfZonalUpgradeMode - :param vmss_zonal_upgrade_mode: This property defines the upgrade mode for the virtual machine - scale set, it is mandatory if a node type with multiple Availability Zones is added. Possible - values include: "Parallel", "Hierarchical". - :type vmss_zonal_upgrade_mode: str or ~azure.mgmt.servicefabric.models.VmssZonalUpgradeMode - :param infrastructure_service_manager: Indicates if infrastructure service manager is enabled. - :type infrastructure_service_manager: bool - :param upgrade_wave: Indicates when new cluster runtime version upgrades will be applied after - they are released. By default is Wave0. Only applies when **upgradeMode** is set to - 'Automatic'. Possible values include: "Wave0", "Wave1", "Wave2". - :type upgrade_wave: str or ~azure.mgmt.servicefabric.models.ClusterUpgradeCadence - :param upgrade_pause_start_timestamp_utc: Indicates the start date and time to pause automatic - runtime version upgrades on the cluster for an specific period of time on the cluster (UTC). - :type upgrade_pause_start_timestamp_utc: ~datetime.datetime - :param upgrade_pause_end_timestamp_utc: Indicates the end date and time to pause automatic - runtime version upgrades on the cluster for an specific period of time on the cluster (UTC). - :type upgrade_pause_end_timestamp_utc: ~datetime.datetime - :param wave_upgrade_paused: Boolean to pause automatic runtime version upgrades to the cluster. - :type wave_upgrade_paused: bool - :param notifications: Indicates a list of notification channels for cluster events. - :type notifications: list[~azure.mgmt.servicefabric.models.Notification] - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'location': {'required': True}, - 'etag': {'readonly': True}, - 'system_data': {'readonly': True}, - 'available_cluster_versions': {'readonly': True}, - 'cluster_endpoint': {'readonly': True}, - 'cluster_id': {'readonly': True}, - 'cluster_state': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'add_on_features': {'key': 'properties.addOnFeatures', 'type': '[str]'}, - 'available_cluster_versions': {'key': 'properties.availableClusterVersions', 'type': '[ClusterVersionDetails]'}, - 'azure_active_directory': {'key': 'properties.azureActiveDirectory', 'type': 'AzureActiveDirectory'}, - 'certificate': {'key': 'properties.certificate', 'type': 'CertificateDescription'}, - 'certificate_common_names': {'key': 'properties.certificateCommonNames', 'type': 'ServerCertificateCommonNames'}, - 'client_certificate_common_names': {'key': 'properties.clientCertificateCommonNames', 'type': '[ClientCertificateCommonName]'}, - 'client_certificate_thumbprints': {'key': 'properties.clientCertificateThumbprints', 'type': '[ClientCertificateThumbprint]'}, - 'cluster_code_version': {'key': 'properties.clusterCodeVersion', 'type': 'str'}, - 'cluster_endpoint': {'key': 'properties.clusterEndpoint', 'type': 'str'}, - 'cluster_id': {'key': 'properties.clusterId', 'type': 'str'}, - 'cluster_state': {'key': 'properties.clusterState', 'type': 'str'}, - 'diagnostics_storage_account_config': {'key': 'properties.diagnosticsStorageAccountConfig', 'type': 'DiagnosticsStorageAccountConfig'}, - 'event_store_service_enabled': {'key': 'properties.eventStoreServiceEnabled', 'type': 'bool'}, - 'fabric_settings': {'key': 'properties.fabricSettings', 'type': '[SettingsSectionDescription]'}, - 'management_endpoint': {'key': 'properties.managementEndpoint', 'type': 'str'}, - 'node_types': {'key': 'properties.nodeTypes', 'type': '[NodeTypeDescription]'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'reliability_level': {'key': 'properties.reliabilityLevel', 'type': 'str'}, - 'reverse_proxy_certificate': {'key': 'properties.reverseProxyCertificate', 'type': 'CertificateDescription'}, - 'reverse_proxy_certificate_common_names': {'key': 'properties.reverseProxyCertificateCommonNames', 'type': 'ServerCertificateCommonNames'}, - 'upgrade_description': {'key': 'properties.upgradeDescription', 'type': 'ClusterUpgradePolicy'}, - 'upgrade_mode': {'key': 'properties.upgradeMode', 'type': 'str'}, - 'application_type_versions_cleanup_policy': {'key': 'properties.applicationTypeVersionsCleanupPolicy', 'type': 'ApplicationTypeVersionsCleanupPolicy'}, - 'vm_image': {'key': 'properties.vmImage', 'type': 'str'}, - 'sf_zonal_upgrade_mode': {'key': 'properties.sfZonalUpgradeMode', 'type': 'str'}, - 'vmss_zonal_upgrade_mode': {'key': 'properties.vmssZonalUpgradeMode', 'type': 'str'}, - 'infrastructure_service_manager': {'key': 'properties.infrastructureServiceManager', 'type': 'bool'}, - 'upgrade_wave': {'key': 'properties.upgradeWave', 'type': 'str'}, - 'upgrade_pause_start_timestamp_utc': {'key': 'properties.upgradePauseStartTimestampUtc', 'type': 'iso-8601'}, - 'upgrade_pause_end_timestamp_utc': {'key': 'properties.upgradePauseEndTimestampUtc', 'type': 'iso-8601'}, - 'wave_upgrade_paused': {'key': 'properties.waveUpgradePaused', 'type': 'bool'}, - 'notifications': {'key': 'properties.notifications', 'type': '[Notification]'}, - } - - def __init__( - self, - **kwargs - ): - super(Cluster, self).__init__(**kwargs) - self.add_on_features = kwargs.get('add_on_features', None) - self.available_cluster_versions = None - self.azure_active_directory = kwargs.get('azure_active_directory', None) - self.certificate = kwargs.get('certificate', None) - self.certificate_common_names = kwargs.get('certificate_common_names', None) - self.client_certificate_common_names = kwargs.get('client_certificate_common_names', None) - self.client_certificate_thumbprints = kwargs.get('client_certificate_thumbprints', None) - self.cluster_code_version = kwargs.get('cluster_code_version', None) - self.cluster_endpoint = None - self.cluster_id = None - self.cluster_state = None - self.diagnostics_storage_account_config = kwargs.get('diagnostics_storage_account_config', None) - self.event_store_service_enabled = kwargs.get('event_store_service_enabled', None) - self.fabric_settings = kwargs.get('fabric_settings', None) - self.management_endpoint = kwargs.get('management_endpoint', None) - self.node_types = kwargs.get('node_types', None) - self.provisioning_state = None - self.reliability_level = kwargs.get('reliability_level', None) - self.reverse_proxy_certificate = kwargs.get('reverse_proxy_certificate', None) - self.reverse_proxy_certificate_common_names = kwargs.get('reverse_proxy_certificate_common_names', None) - self.upgrade_description = kwargs.get('upgrade_description', None) - self.upgrade_mode = kwargs.get('upgrade_mode', "Automatic") - self.application_type_versions_cleanup_policy = kwargs.get('application_type_versions_cleanup_policy', None) - self.vm_image = kwargs.get('vm_image', None) - self.sf_zonal_upgrade_mode = kwargs.get('sf_zonal_upgrade_mode', None) - self.vmss_zonal_upgrade_mode = kwargs.get('vmss_zonal_upgrade_mode', None) - self.infrastructure_service_manager = kwargs.get('infrastructure_service_manager', None) - self.upgrade_wave = kwargs.get('upgrade_wave', None) - self.upgrade_pause_start_timestamp_utc = kwargs.get('upgrade_pause_start_timestamp_utc', None) - self.upgrade_pause_end_timestamp_utc = kwargs.get('upgrade_pause_end_timestamp_utc', None) - self.wave_upgrade_paused = kwargs.get('wave_upgrade_paused', None) - self.notifications = kwargs.get('notifications', None) - - -class ClusterCodeVersionsListResult(msrest.serialization.Model): - """The list results of the Service Fabric runtime versions. - - :param value: - :type value: list[~azure.mgmt.servicefabric.models.ClusterCodeVersionsResult] - :param next_link: The URL to use for getting the next set of results. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ClusterCodeVersionsResult]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ClusterCodeVersionsListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class ClusterCodeVersionsResult(msrest.serialization.Model): - """The result of the Service Fabric runtime versions. - - :param id: The identification of the result. - :type id: str - :param name: The name of the result. - :type name: str - :param type: The result resource type. - :type type: str - :param code_version: The Service Fabric runtime version of the cluster. - :type code_version: str - :param support_expiry_utc: The date of expiry of support of the version. - :type support_expiry_utc: str - :param environment: Indicates if this version is for Windows or Linux operating system. - Possible values include: "Windows", "Linux". - :type environment: str or ~azure.mgmt.servicefabric.models.ClusterEnvironment - """ - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'code_version': {'key': 'properties.codeVersion', 'type': 'str'}, - 'support_expiry_utc': {'key': 'properties.supportExpiryUtc', 'type': 'str'}, - 'environment': {'key': 'properties.environment', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ClusterCodeVersionsResult, self).__init__(**kwargs) - self.id = kwargs.get('id', None) - self.name = kwargs.get('name', None) - self.type = kwargs.get('type', None) - self.code_version = kwargs.get('code_version', None) - self.support_expiry_utc = kwargs.get('support_expiry_utc', None) - self.environment = kwargs.get('environment', None) - - -class ClusterHealthPolicy(msrest.serialization.Model): - """Defines a health policy used to evaluate the health of the cluster or of a cluster node. - - :param max_percent_unhealthy_nodes: The maximum allowed percentage of unhealthy nodes before - reporting an error. For example, to allow 10% of nodes to be unhealthy, this value would be 10. - - The percentage represents the maximum tolerated percentage of nodes that can be unhealthy - before the cluster is considered in error. - If the percentage is respected but there is at least one unhealthy node, the health is - evaluated as Warning. - The percentage is calculated by dividing the number of unhealthy nodes over the total number - of nodes in the cluster. - The computation rounds up to tolerate one failure on small numbers of nodes. Default - percentage is zero. - - In large clusters, some nodes will always be down or out for repairs, so this percentage - should be configured to tolerate that. - :type max_percent_unhealthy_nodes: int - :param max_percent_unhealthy_applications: The maximum allowed percentage of unhealthy - applications before reporting an error. For example, to allow 10% of applications to be - unhealthy, this value would be 10. - - The percentage represents the maximum tolerated percentage of applications that can be - unhealthy before the cluster is considered in error. - If the percentage is respected but there is at least one unhealthy application, the health is - evaluated as Warning. - This is calculated by dividing the number of unhealthy applications over the total number of - application instances in the cluster, excluding applications of application types that are - included in the ApplicationTypeHealthPolicyMap. - The computation rounds up to tolerate one failure on small numbers of applications. Default - percentage is zero. - :type max_percent_unhealthy_applications: int - :param application_health_policies: Defines the application health policy map used to evaluate - the health of an application or one of its children entities. - :type application_health_policies: dict[str, - ~azure.mgmt.servicefabric.models.ApplicationHealthPolicy] - """ - - _validation = { - 'max_percent_unhealthy_nodes': {'maximum': 100, 'minimum': 0}, - 'max_percent_unhealthy_applications': {'maximum': 100, 'minimum': 0}, - } - - _attribute_map = { - 'max_percent_unhealthy_nodes': {'key': 'maxPercentUnhealthyNodes', 'type': 'int'}, - 'max_percent_unhealthy_applications': {'key': 'maxPercentUnhealthyApplications', 'type': 'int'}, - 'application_health_policies': {'key': 'applicationHealthPolicies', 'type': '{ApplicationHealthPolicy}'}, - } - - def __init__( - self, - **kwargs - ): - super(ClusterHealthPolicy, self).__init__(**kwargs) - self.max_percent_unhealthy_nodes = kwargs.get('max_percent_unhealthy_nodes', 0) - self.max_percent_unhealthy_applications = kwargs.get('max_percent_unhealthy_applications', 0) - self.application_health_policies = kwargs.get('application_health_policies', None) - - -class ClusterListResult(msrest.serialization.Model): - """Cluster list results. - - :param value: - :type value: list[~azure.mgmt.servicefabric.models.Cluster] - :param next_link: The URL to use for getting the next set of results. - :type next_link: str - """ - - _attribute_map = { - 'value': {'key': 'value', 'type': '[Cluster]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ClusterListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = kwargs.get('next_link', None) - - -class ClusterUpdateParameters(msrest.serialization.Model): - """Cluster update request. - - :param tags: A set of tags. Cluster update parameters. - :type tags: dict[str, str] - :param add_on_features: The list of add-on features to enable in the cluster. - :type add_on_features: list[str or ~azure.mgmt.servicefabric.models.AddOnFeatures] - :param certificate: The certificate to use for securing the cluster. The certificate provided - will be used for node to node security within the cluster, SSL certificate for cluster - management endpoint and default admin client. - :type certificate: ~azure.mgmt.servicefabric.models.CertificateDescription - :param certificate_common_names: Describes a list of server certificates referenced by common - name that are used to secure the cluster. - :type certificate_common_names: ~azure.mgmt.servicefabric.models.ServerCertificateCommonNames - :param client_certificate_common_names: The list of client certificates referenced by common - name that are allowed to manage the cluster. This will overwrite the existing list. - :type client_certificate_common_names: - list[~azure.mgmt.servicefabric.models.ClientCertificateCommonName] - :param client_certificate_thumbprints: The list of client certificates referenced by thumbprint - that are allowed to manage the cluster. This will overwrite the existing list. - :type client_certificate_thumbprints: - list[~azure.mgmt.servicefabric.models.ClientCertificateThumbprint] - :param cluster_code_version: The Service Fabric runtime version of the cluster. This property - can only by set the user when **upgradeMode** is set to 'Manual'. To get list of available - Service Fabric versions for new clusters use `ClusterVersion API <./ClusterVersion.md>`_. To - get the list of available version for existing clusters use **availableClusterVersions**. - :type cluster_code_version: str - :param event_store_service_enabled: Indicates if the event store service is enabled. - :type event_store_service_enabled: bool - :param fabric_settings: The list of custom fabric settings to configure the cluster. This will - overwrite the existing list. - :type fabric_settings: list[~azure.mgmt.servicefabric.models.SettingsSectionDescription] - :param node_types: The list of node types in the cluster. This will overwrite the existing - list. - :type node_types: list[~azure.mgmt.servicefabric.models.NodeTypeDescription] - :param reliability_level: The reliability level sets the replica set size of system services. - Learn about `ReliabilityLevel - `_. - - - * None - Run the System services with a target replica set count of 1. This should only be - used for test clusters. - * Bronze - Run the System services with a target replica set count of 3. This should only be - used for test clusters. - * Silver - Run the System services with a target replica set count of 5. - * Gold - Run the System services with a target replica set count of 7. - * Platinum - Run the System services with a target replica set count of 9. Possible values - include: "None", "Bronze", "Silver", "Gold", "Platinum". - :type reliability_level: str or ~azure.mgmt.servicefabric.models.ReliabilityLevel - :param reverse_proxy_certificate: The server certificate used by reverse proxy. - :type reverse_proxy_certificate: ~azure.mgmt.servicefabric.models.CertificateDescription - :param upgrade_description: The policy to use when upgrading the cluster. - :type upgrade_description: ~azure.mgmt.servicefabric.models.ClusterUpgradePolicy - :param application_type_versions_cleanup_policy: The policy used to clean up unused versions. - :type application_type_versions_cleanup_policy: - ~azure.mgmt.servicefabric.models.ApplicationTypeVersionsCleanupPolicy - :param upgrade_mode: The upgrade mode of the cluster when new Service Fabric runtime version is - available. Possible values include: "Automatic", "Manual". Default value: "Automatic". - :type upgrade_mode: str or ~azure.mgmt.servicefabric.models.UpgradeMode - :param sf_zonal_upgrade_mode: This property controls the logical grouping of VMs in upgrade - domains (UDs). This property can't be modified if a node type with multiple Availability Zones - is already present in the cluster. Possible values include: "Parallel", "Hierarchical". - :type sf_zonal_upgrade_mode: str or ~azure.mgmt.servicefabric.models.SfZonalUpgradeMode - :param vmss_zonal_upgrade_mode: This property defines the upgrade mode for the virtual machine - scale set, it is mandatory if a node type with multiple Availability Zones is added. Possible - values include: "Parallel", "Hierarchical". - :type vmss_zonal_upgrade_mode: str or ~azure.mgmt.servicefabric.models.VmssZonalUpgradeMode - :param infrastructure_service_manager: Indicates if infrastructure service manager is enabled. - :type infrastructure_service_manager: bool - :param upgrade_wave: Indicates when new cluster runtime version upgrades will be applied after - they are released. By default is Wave0. Only applies when **upgradeMode** is set to - 'Automatic'. Possible values include: "Wave0", "Wave1", "Wave2". - :type upgrade_wave: str or ~azure.mgmt.servicefabric.models.ClusterUpgradeCadence - :param upgrade_pause_start_timestamp_utc: The start timestamp to pause runtime version upgrades - on the cluster (UTC). - :type upgrade_pause_start_timestamp_utc: ~datetime.datetime - :param upgrade_pause_end_timestamp_utc: The end timestamp of pause runtime version upgrades on - the cluster (UTC). - :type upgrade_pause_end_timestamp_utc: ~datetime.datetime - :param wave_upgrade_paused: Boolean to pause automatic runtime version upgrades to the cluster. - :type wave_upgrade_paused: bool - :param notifications: Indicates a list of notification channels for cluster events. - :type notifications: list[~azure.mgmt.servicefabric.models.Notification] - """ - - _attribute_map = { - 'tags': {'key': 'tags', 'type': '{str}'}, - 'add_on_features': {'key': 'properties.addOnFeatures', 'type': '[str]'}, - 'certificate': {'key': 'properties.certificate', 'type': 'CertificateDescription'}, - 'certificate_common_names': {'key': 'properties.certificateCommonNames', 'type': 'ServerCertificateCommonNames'}, - 'client_certificate_common_names': {'key': 'properties.clientCertificateCommonNames', 'type': '[ClientCertificateCommonName]'}, - 'client_certificate_thumbprints': {'key': 'properties.clientCertificateThumbprints', 'type': '[ClientCertificateThumbprint]'}, - 'cluster_code_version': {'key': 'properties.clusterCodeVersion', 'type': 'str'}, - 'event_store_service_enabled': {'key': 'properties.eventStoreServiceEnabled', 'type': 'bool'}, - 'fabric_settings': {'key': 'properties.fabricSettings', 'type': '[SettingsSectionDescription]'}, - 'node_types': {'key': 'properties.nodeTypes', 'type': '[NodeTypeDescription]'}, - 'reliability_level': {'key': 'properties.reliabilityLevel', 'type': 'str'}, - 'reverse_proxy_certificate': {'key': 'properties.reverseProxyCertificate', 'type': 'CertificateDescription'}, - 'upgrade_description': {'key': 'properties.upgradeDescription', 'type': 'ClusterUpgradePolicy'}, - 'application_type_versions_cleanup_policy': {'key': 'properties.applicationTypeVersionsCleanupPolicy', 'type': 'ApplicationTypeVersionsCleanupPolicy'}, - 'upgrade_mode': {'key': 'properties.upgradeMode', 'type': 'str'}, - 'sf_zonal_upgrade_mode': {'key': 'properties.sfZonalUpgradeMode', 'type': 'str'}, - 'vmss_zonal_upgrade_mode': {'key': 'properties.vmssZonalUpgradeMode', 'type': 'str'}, - 'infrastructure_service_manager': {'key': 'properties.infrastructureServiceManager', 'type': 'bool'}, - 'upgrade_wave': {'key': 'properties.upgradeWave', 'type': 'str'}, - 'upgrade_pause_start_timestamp_utc': {'key': 'properties.upgradePauseStartTimestampUtc', 'type': 'iso-8601'}, - 'upgrade_pause_end_timestamp_utc': {'key': 'properties.upgradePauseEndTimestampUtc', 'type': 'iso-8601'}, - 'wave_upgrade_paused': {'key': 'properties.waveUpgradePaused', 'type': 'bool'}, - 'notifications': {'key': 'properties.notifications', 'type': '[Notification]'}, - } - - def __init__( - self, - **kwargs - ): - super(ClusterUpdateParameters, self).__init__(**kwargs) - self.tags = kwargs.get('tags', None) - self.add_on_features = kwargs.get('add_on_features', None) - self.certificate = kwargs.get('certificate', None) - self.certificate_common_names = kwargs.get('certificate_common_names', None) - self.client_certificate_common_names = kwargs.get('client_certificate_common_names', None) - self.client_certificate_thumbprints = kwargs.get('client_certificate_thumbprints', None) - self.cluster_code_version = kwargs.get('cluster_code_version', None) - self.event_store_service_enabled = kwargs.get('event_store_service_enabled', None) - self.fabric_settings = kwargs.get('fabric_settings', None) - self.node_types = kwargs.get('node_types', None) - self.reliability_level = kwargs.get('reliability_level', None) - self.reverse_proxy_certificate = kwargs.get('reverse_proxy_certificate', None) - self.upgrade_description = kwargs.get('upgrade_description', None) - self.application_type_versions_cleanup_policy = kwargs.get('application_type_versions_cleanup_policy', None) - self.upgrade_mode = kwargs.get('upgrade_mode', "Automatic") - self.sf_zonal_upgrade_mode = kwargs.get('sf_zonal_upgrade_mode', None) - self.vmss_zonal_upgrade_mode = kwargs.get('vmss_zonal_upgrade_mode', None) - self.infrastructure_service_manager = kwargs.get('infrastructure_service_manager', None) - self.upgrade_wave = kwargs.get('upgrade_wave', None) - self.upgrade_pause_start_timestamp_utc = kwargs.get('upgrade_pause_start_timestamp_utc', None) - self.upgrade_pause_end_timestamp_utc = kwargs.get('upgrade_pause_end_timestamp_utc', None) - self.wave_upgrade_paused = kwargs.get('wave_upgrade_paused', None) - self.notifications = kwargs.get('notifications', None) - - -class ClusterUpgradeDeltaHealthPolicy(msrest.serialization.Model): - """Describes the delta health policies for the cluster upgrade. - - All required parameters must be populated in order to send to Azure. - - :param max_percent_delta_unhealthy_nodes: Required. The maximum allowed percentage of nodes - health degradation allowed during cluster upgrades. - The delta is measured between the state of the nodes at the beginning of upgrade and the state - of the nodes at the time of the health evaluation. - The check is performed after every upgrade domain upgrade completion to make sure the global - state of the cluster is within tolerated limits. - :type max_percent_delta_unhealthy_nodes: int - :param max_percent_upgrade_domain_delta_unhealthy_nodes: Required. The maximum allowed - percentage of upgrade domain nodes health degradation allowed during cluster upgrades. - The delta is measured between the state of the upgrade domain nodes at the beginning of - upgrade and the state of the upgrade domain nodes at the time of the health evaluation. - The check is performed after every upgrade domain upgrade completion for all completed upgrade - domains to make sure the state of the upgrade domains is within tolerated limits. - :type max_percent_upgrade_domain_delta_unhealthy_nodes: int - :param max_percent_delta_unhealthy_applications: Required. The maximum allowed percentage of - applications health degradation allowed during cluster upgrades. - The delta is measured between the state of the applications at the beginning of upgrade and - the state of the applications at the time of the health evaluation. - The check is performed after every upgrade domain upgrade completion to make sure the global - state of the cluster is within tolerated limits. System services are not included in this. - :type max_percent_delta_unhealthy_applications: int - :param application_delta_health_policies: Defines the application delta health policy map used - to evaluate the health of an application or one of its child entities when upgrading the - cluster. - :type application_delta_health_policies: dict[str, - ~azure.mgmt.servicefabric.models.ApplicationDeltaHealthPolicy] - """ - - _validation = { - 'max_percent_delta_unhealthy_nodes': {'required': True, 'maximum': 100, 'minimum': 0}, - 'max_percent_upgrade_domain_delta_unhealthy_nodes': {'required': True, 'maximum': 100, 'minimum': 0}, - 'max_percent_delta_unhealthy_applications': {'required': True, 'maximum': 100, 'minimum': 0}, - } - - _attribute_map = { - 'max_percent_delta_unhealthy_nodes': {'key': 'maxPercentDeltaUnhealthyNodes', 'type': 'int'}, - 'max_percent_upgrade_domain_delta_unhealthy_nodes': {'key': 'maxPercentUpgradeDomainDeltaUnhealthyNodes', 'type': 'int'}, - 'max_percent_delta_unhealthy_applications': {'key': 'maxPercentDeltaUnhealthyApplications', 'type': 'int'}, - 'application_delta_health_policies': {'key': 'applicationDeltaHealthPolicies', 'type': '{ApplicationDeltaHealthPolicy}'}, - } - - def __init__( - self, - **kwargs - ): - super(ClusterUpgradeDeltaHealthPolicy, self).__init__(**kwargs) - self.max_percent_delta_unhealthy_nodes = kwargs['max_percent_delta_unhealthy_nodes'] - self.max_percent_upgrade_domain_delta_unhealthy_nodes = kwargs['max_percent_upgrade_domain_delta_unhealthy_nodes'] - self.max_percent_delta_unhealthy_applications = kwargs['max_percent_delta_unhealthy_applications'] - self.application_delta_health_policies = kwargs.get('application_delta_health_policies', None) - - -class ClusterUpgradePolicy(msrest.serialization.Model): - """Describes the policy used when upgrading the cluster. - - All required parameters must be populated in order to send to Azure. - - :param force_restart: If true, then processes are forcefully restarted during upgrade even when - the code version has not changed (the upgrade only changes configuration or data). - :type force_restart: bool - :param upgrade_replica_set_check_timeout: Required. The maximum amount of time to block - processing of an upgrade domain and prevent loss of availability when there are unexpected - issues. When this timeout expires, processing of the upgrade domain will proceed regardless of - availability loss issues. The timeout is reset at the start of each upgrade domain. The timeout - can be in either hh:mm:ss or in d.hh:mm:ss.ms format. - :type upgrade_replica_set_check_timeout: str - :param health_check_wait_duration: Required. The length of time to wait after completing an - upgrade domain before performing health checks. The duration can be in either hh:mm:ss or in - d.hh:mm:ss.ms format. - :type health_check_wait_duration: str - :param health_check_stable_duration: Required. The amount of time that the application or - cluster must remain healthy before the upgrade proceeds to the next upgrade domain. The - duration can be in either hh:mm:ss or in d.hh:mm:ss.ms format. - :type health_check_stable_duration: str - :param health_check_retry_timeout: Required. The amount of time to retry health evaluation when - the application or cluster is unhealthy before the upgrade rolls back. The timeout can be in - either hh:mm:ss or in d.hh:mm:ss.ms format. - :type health_check_retry_timeout: str - :param upgrade_timeout: Required. The amount of time the overall upgrade has to complete before - the upgrade rolls back. The timeout can be in either hh:mm:ss or in d.hh:mm:ss.ms format. - :type upgrade_timeout: str - :param upgrade_domain_timeout: Required. The amount of time each upgrade domain has to complete - before the upgrade rolls back. The timeout can be in either hh:mm:ss or in d.hh:mm:ss.ms - format. - :type upgrade_domain_timeout: str - :param health_policy: Required. The cluster health policy used when upgrading the cluster. - :type health_policy: ~azure.mgmt.servicefabric.models.ClusterHealthPolicy - :param delta_health_policy: The cluster delta health policy used when upgrading the cluster. - :type delta_health_policy: ~azure.mgmt.servicefabric.models.ClusterUpgradeDeltaHealthPolicy - """ - - _validation = { - 'upgrade_replica_set_check_timeout': {'required': True}, - 'health_check_wait_duration': {'required': True}, - 'health_check_stable_duration': {'required': True}, - 'health_check_retry_timeout': {'required': True}, - 'upgrade_timeout': {'required': True}, - 'upgrade_domain_timeout': {'required': True}, - 'health_policy': {'required': True}, - } - - _attribute_map = { - 'force_restart': {'key': 'forceRestart', 'type': 'bool'}, - 'upgrade_replica_set_check_timeout': {'key': 'upgradeReplicaSetCheckTimeout', 'type': 'str'}, - 'health_check_wait_duration': {'key': 'healthCheckWaitDuration', 'type': 'str'}, - 'health_check_stable_duration': {'key': 'healthCheckStableDuration', 'type': 'str'}, - 'health_check_retry_timeout': {'key': 'healthCheckRetryTimeout', 'type': 'str'}, - 'upgrade_timeout': {'key': 'upgradeTimeout', 'type': 'str'}, - 'upgrade_domain_timeout': {'key': 'upgradeDomainTimeout', 'type': 'str'}, - 'health_policy': {'key': 'healthPolicy', 'type': 'ClusterHealthPolicy'}, - 'delta_health_policy': {'key': 'deltaHealthPolicy', 'type': 'ClusterUpgradeDeltaHealthPolicy'}, - } - - def __init__( - self, - **kwargs - ): - super(ClusterUpgradePolicy, self).__init__(**kwargs) - self.force_restart = kwargs.get('force_restart', None) - self.upgrade_replica_set_check_timeout = kwargs['upgrade_replica_set_check_timeout'] - self.health_check_wait_duration = kwargs['health_check_wait_duration'] - self.health_check_stable_duration = kwargs['health_check_stable_duration'] - self.health_check_retry_timeout = kwargs['health_check_retry_timeout'] - self.upgrade_timeout = kwargs['upgrade_timeout'] - self.upgrade_domain_timeout = kwargs['upgrade_domain_timeout'] - self.health_policy = kwargs['health_policy'] - self.delta_health_policy = kwargs.get('delta_health_policy', None) - - -class ClusterVersionDetails(msrest.serialization.Model): - """The detail of the Service Fabric runtime version result. - - :param code_version: The Service Fabric runtime version of the cluster. - :type code_version: str - :param support_expiry_utc: The date of expiry of support of the version. - :type support_expiry_utc: str - :param environment: Indicates if this version is for Windows or Linux operating system. - Possible values include: "Windows", "Linux". - :type environment: str or ~azure.mgmt.servicefabric.models.ClusterEnvironment - """ - - _attribute_map = { - 'code_version': {'key': 'codeVersion', 'type': 'str'}, - 'support_expiry_utc': {'key': 'supportExpiryUtc', 'type': 'str'}, - 'environment': {'key': 'environment', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ClusterVersionDetails, self).__init__(**kwargs) - self.code_version = kwargs.get('code_version', None) - self.support_expiry_utc = kwargs.get('support_expiry_utc', None) - self.environment = kwargs.get('environment', None) - - -class DiagnosticsStorageAccountConfig(msrest.serialization.Model): - """The storage account information for storing Service Fabric diagnostic logs. - - All required parameters must be populated in order to send to Azure. - - :param storage_account_name: Required. The Azure storage account name. - :type storage_account_name: str - :param protected_account_key_name: Required. The protected diagnostics storage key name. - :type protected_account_key_name: str - :param protected_account_key_name2: The secondary protected diagnostics storage key name. If - one of the storage account keys is rotated the cluster will fallback to using the other. - :type protected_account_key_name2: str - :param blob_endpoint: Required. The blob endpoint of the azure storage account. - :type blob_endpoint: str - :param queue_endpoint: Required. The queue endpoint of the azure storage account. - :type queue_endpoint: str - :param table_endpoint: Required. The table endpoint of the azure storage account. - :type table_endpoint: str - """ - - _validation = { - 'storage_account_name': {'required': True}, - 'protected_account_key_name': {'required': True}, - 'blob_endpoint': {'required': True}, - 'queue_endpoint': {'required': True}, - 'table_endpoint': {'required': True}, - } - - _attribute_map = { - 'storage_account_name': {'key': 'storageAccountName', 'type': 'str'}, - 'protected_account_key_name': {'key': 'protectedAccountKeyName', 'type': 'str'}, - 'protected_account_key_name2': {'key': 'protectedAccountKeyName2', 'type': 'str'}, - 'blob_endpoint': {'key': 'blobEndpoint', 'type': 'str'}, - 'queue_endpoint': {'key': 'queueEndpoint', 'type': 'str'}, - 'table_endpoint': {'key': 'tableEndpoint', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(DiagnosticsStorageAccountConfig, self).__init__(**kwargs) - self.storage_account_name = kwargs['storage_account_name'] - self.protected_account_key_name = kwargs['protected_account_key_name'] - self.protected_account_key_name2 = kwargs.get('protected_account_key_name2', None) - self.blob_endpoint = kwargs['blob_endpoint'] - self.queue_endpoint = kwargs['queue_endpoint'] - self.table_endpoint = kwargs['table_endpoint'] - - -class EndpointRangeDescription(msrest.serialization.Model): - """Port range details. - - All required parameters must be populated in order to send to Azure. - - :param start_port: Required. Starting port of a range of ports. - :type start_port: int - :param end_port: Required. End port of a range of ports. - :type end_port: int - """ - - _validation = { - 'start_port': {'required': True}, - 'end_port': {'required': True}, - } - - _attribute_map = { - 'start_port': {'key': 'startPort', 'type': 'int'}, - 'end_port': {'key': 'endPort', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(EndpointRangeDescription, self).__init__(**kwargs) - self.start_port = kwargs['start_port'] - self.end_port = kwargs['end_port'] - - -class ErrorModel(msrest.serialization.Model): - """The structure of the error. - - :param error: The error details. - :type error: ~azure.mgmt.servicefabric.models.ErrorModelError - """ - - _attribute_map = { - 'error': {'key': 'error', 'type': 'ErrorModelError'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorModel, self).__init__(**kwargs) - self.error = kwargs.get('error', None) - - -class ErrorModelError(msrest.serialization.Model): - """The error details. - - :param code: The error code. - :type code: str - :param message: The error message. - :type message: str - """ - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ErrorModelError, self).__init__(**kwargs) - self.code = kwargs.get('code', None) - self.message = kwargs.get('message', None) - - -class ManagedIdentity(msrest.serialization.Model): - """Describes the managed identities for an Azure resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar principal_id: The principal id of the managed identity. This property will only be - provided for a system assigned identity. - :vartype principal_id: str - :ivar tenant_id: The tenant id of the managed identity. This property will only be provided for - a system assigned identity. - :vartype tenant_id: str - :param type: The type of managed identity for the resource. Possible values include: - "SystemAssigned", "UserAssigned", "SystemAssigned, UserAssigned", "None". - :type type: str or ~azure.mgmt.servicefabric.models.ManagedIdentityType - :param user_assigned_identities: The list of user identities associated with the resource. The - user identity dictionary key references will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. - :type user_assigned_identities: dict[str, - ~azure.mgmt.servicefabric.models.UserAssignedIdentity] - """ - - _validation = { - 'principal_id': {'readonly': True}, - 'tenant_id': {'readonly': True}, - } - - _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'tenant_id': {'key': 'tenantId', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '{UserAssignedIdentity}'}, - } - - def __init__( - self, - **kwargs - ): - super(ManagedIdentity, self).__init__(**kwargs) - self.principal_id = None - self.tenant_id = None - self.type = kwargs.get('type', None) - self.user_assigned_identities = kwargs.get('user_assigned_identities', None) - - -class PartitionSchemeDescription(msrest.serialization.Model): - """Describes how the service is partitioned. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: NamedPartitionSchemeDescription, SingletonPartitionSchemeDescription, UniformInt64RangePartitionSchemeDescription. - - All required parameters must be populated in order to send to Azure. - - :param partition_scheme: Required. Specifies how the service is partitioned.Constant filled by - server. Possible values include: "Invalid", "Singleton", "UniformInt64Range", "Named". - :type partition_scheme: str or ~azure.mgmt.servicefabric.models.PartitionScheme - """ - - _validation = { - 'partition_scheme': {'required': True}, - } - - _attribute_map = { - 'partition_scheme': {'key': 'partitionScheme', 'type': 'str'}, - } - - _subtype_map = { - 'partition_scheme': {'Named': 'NamedPartitionSchemeDescription', 'Singleton': 'SingletonPartitionSchemeDescription', 'UniformInt64Range': 'UniformInt64RangePartitionSchemeDescription'} - } - - def __init__( - self, - **kwargs - ): - super(PartitionSchemeDescription, self).__init__(**kwargs) - self.partition_scheme = None # type: Optional[str] - - -class NamedPartitionSchemeDescription(PartitionSchemeDescription): - """Describes the named partition scheme of the service. - - All required parameters must be populated in order to send to Azure. - - :param partition_scheme: Required. Specifies how the service is partitioned.Constant filled by - server. Possible values include: "Invalid", "Singleton", "UniformInt64Range", "Named". - :type partition_scheme: str or ~azure.mgmt.servicefabric.models.PartitionScheme - :param count: Required. The number of partitions. - :type count: int - :param names: Required. Array of size specified by the ‘count’ parameter, for the names of the - partitions. - :type names: list[str] - """ - - _validation = { - 'partition_scheme': {'required': True}, - 'count': {'required': True}, - 'names': {'required': True}, - } - - _attribute_map = { - 'partition_scheme': {'key': 'partitionScheme', 'type': 'str'}, - 'count': {'key': 'count', 'type': 'int'}, - 'names': {'key': 'names', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(NamedPartitionSchemeDescription, self).__init__(**kwargs) - self.partition_scheme = 'Named' # type: str - self.count = kwargs['count'] - self.names = kwargs['names'] - - -class NodeTypeDescription(msrest.serialization.Model): - """Describes a node type in the cluster, each node type represents sub set of nodes in the cluster. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The name of the node type. - :type name: str - :param placement_properties: The placement tags applied to nodes in the node type, which can be - used to indicate where certain services (workload) should run. - :type placement_properties: dict[str, str] - :param capacities: The capacity tags applied to the nodes in the node type, the cluster - resource manager uses these tags to understand how much resource a node has. - :type capacities: dict[str, str] - :param client_connection_endpoint_port: Required. The TCP cluster management endpoint port. - :type client_connection_endpoint_port: int - :param http_gateway_endpoint_port: Required. The HTTP cluster management endpoint port. - :type http_gateway_endpoint_port: int - :param durability_level: The durability level of the node type. Learn about `DurabilityLevel - `_. - - - * Bronze - No privileges. This is the default. - * Silver - The infrastructure jobs can be paused for a duration of 10 minutes per UD. - * Gold - The infrastructure jobs can be paused for a duration of 2 hours per UD. Gold - durability can be enabled only on full node VM skus like D15_V2, G5 etc. Possible values - include: "Bronze", "Silver", "Gold". - :type durability_level: str or ~azure.mgmt.servicefabric.models.DurabilityLevel - :param application_ports: The range of ports from which cluster assigned port to Service Fabric - applications. - :type application_ports: ~azure.mgmt.servicefabric.models.EndpointRangeDescription - :param ephemeral_ports: The range of ephemeral ports that nodes in this node type should be - configured with. - :type ephemeral_ports: ~azure.mgmt.servicefabric.models.EndpointRangeDescription - :param is_primary: Required. The node type on which system services will run. Only one node - type should be marked as primary. Primary node type cannot be deleted or changed for existing - clusters. - :type is_primary: bool - :param vm_instance_count: Required. VMInstanceCount should be 1 to n, where n indicates the - number of VM instances corresponding to this nodeType. VMInstanceCount = 0 can be done only in - these scenarios: NodeType is a secondary nodeType. Durability = Bronze or Durability >= Bronze - and InfrastructureServiceManager = true. If VMInstanceCount = 0, implies the VMs for this - nodeType will not be used for the initial cluster size computation. - :type vm_instance_count: int - :param reverse_proxy_endpoint_port: The endpoint used by reverse proxy. - :type reverse_proxy_endpoint_port: int - :param is_stateless: Indicates if the node type can only host Stateless workloads. - :type is_stateless: bool - :param multiple_availability_zones: Indicates if the node type is enabled to support multiple - zones. - :type multiple_availability_zones: bool - """ - - _validation = { - 'name': {'required': True}, - 'client_connection_endpoint_port': {'required': True}, - 'http_gateway_endpoint_port': {'required': True}, - 'is_primary': {'required': True}, - 'vm_instance_count': {'required': True, 'maximum': 2147483647, 'minimum': 0}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'placement_properties': {'key': 'placementProperties', 'type': '{str}'}, - 'capacities': {'key': 'capacities', 'type': '{str}'}, - 'client_connection_endpoint_port': {'key': 'clientConnectionEndpointPort', 'type': 'int'}, - 'http_gateway_endpoint_port': {'key': 'httpGatewayEndpointPort', 'type': 'int'}, - 'durability_level': {'key': 'durabilityLevel', 'type': 'str'}, - 'application_ports': {'key': 'applicationPorts', 'type': 'EndpointRangeDescription'}, - 'ephemeral_ports': {'key': 'ephemeralPorts', 'type': 'EndpointRangeDescription'}, - 'is_primary': {'key': 'isPrimary', 'type': 'bool'}, - 'vm_instance_count': {'key': 'vmInstanceCount', 'type': 'int'}, - 'reverse_proxy_endpoint_port': {'key': 'reverseProxyEndpointPort', 'type': 'int'}, - 'is_stateless': {'key': 'isStateless', 'type': 'bool'}, - 'multiple_availability_zones': {'key': 'multipleAvailabilityZones', 'type': 'bool'}, - } - - def __init__( - self, - **kwargs - ): - super(NodeTypeDescription, self).__init__(**kwargs) - self.name = kwargs['name'] - self.placement_properties = kwargs.get('placement_properties', None) - self.capacities = kwargs.get('capacities', None) - self.client_connection_endpoint_port = kwargs['client_connection_endpoint_port'] - self.http_gateway_endpoint_port = kwargs['http_gateway_endpoint_port'] - self.durability_level = kwargs.get('durability_level', None) - self.application_ports = kwargs.get('application_ports', None) - self.ephemeral_ports = kwargs.get('ephemeral_ports', None) - self.is_primary = kwargs['is_primary'] - self.vm_instance_count = kwargs['vm_instance_count'] - self.reverse_proxy_endpoint_port = kwargs.get('reverse_proxy_endpoint_port', None) - self.is_stateless = kwargs.get('is_stateless', None) - self.multiple_availability_zones = kwargs.get('multiple_availability_zones', None) - - -class Notification(msrest.serialization.Model): - """Describes the notification channel for cluster events. - - All required parameters must be populated in order to send to Azure. - - :param is_enabled: Required. Indicates if the notification is enabled. - :type is_enabled: bool - :param notification_category: Required. The category of notification. Possible values include: - "WaveProgress". - :type notification_category: str or ~azure.mgmt.servicefabric.models.NotificationCategory - :param notification_level: Required. The level of notification. Possible values include: - "Critical", "All". - :type notification_level: str or ~azure.mgmt.servicefabric.models.NotificationLevel - :param notification_targets: Required. List of targets that subscribe to the notification. - :type notification_targets: list[~azure.mgmt.servicefabric.models.NotificationTarget] - """ - - _validation = { - 'is_enabled': {'required': True}, - 'notification_category': {'required': True}, - 'notification_level': {'required': True}, - 'notification_targets': {'required': True}, - } - - _attribute_map = { - 'is_enabled': {'key': 'isEnabled', 'type': 'bool'}, - 'notification_category': {'key': 'notificationCategory', 'type': 'str'}, - 'notification_level': {'key': 'notificationLevel', 'type': 'str'}, - 'notification_targets': {'key': 'notificationTargets', 'type': '[NotificationTarget]'}, - } - - def __init__( - self, - **kwargs - ): - super(Notification, self).__init__(**kwargs) - self.is_enabled = kwargs['is_enabled'] - self.notification_category = kwargs['notification_category'] - self.notification_level = kwargs['notification_level'] - self.notification_targets = kwargs['notification_targets'] - - -class NotificationTarget(msrest.serialization.Model): - """Describes the notification target properties. - - All required parameters must be populated in order to send to Azure. - - :param notification_channel: Required. The notification channel indicates the type of receivers - subscribed to the notification, either user or subscription. Possible values include: - "EmailUser", "EmailSubscription". - :type notification_channel: str or ~azure.mgmt.servicefabric.models.NotificationChannel - :param receivers: Required. List of targets that subscribe to the notification. - :type receivers: list[str] - """ - - _validation = { - 'notification_channel': {'required': True}, - 'receivers': {'required': True}, - } - - _attribute_map = { - 'notification_channel': {'key': 'notificationChannel', 'type': 'str'}, - 'receivers': {'key': 'receivers', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(NotificationTarget, self).__init__(**kwargs) - self.notification_channel = kwargs['notification_channel'] - self.receivers = kwargs['receivers'] - - -class OperationListResult(msrest.serialization.Model): - """Describes the result of the request to list Service Fabric resource provider operations. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param value: List of operations supported by the Service Fabric resource provider. - :type value: list[~azure.mgmt.servicefabric.models.OperationResult] - :ivar next_link: URL to get the next set of operation list results if there are any. - :vartype next_link: str - """ - - _validation = { - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[OperationResult]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationListResult, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = None - - -class OperationResult(msrest.serialization.Model): - """Available operation list result. - - :param name: The name of the operation. - :type name: str - :param is_data_action: Indicates whether the operation is a data action. - :type is_data_action: bool - :param display: The object that represents the operation. - :type display: ~azure.mgmt.servicefabric.models.AvailableOperationDisplay - :param origin: Origin result. - :type origin: str - :param next_link: The URL to use for getting the next set of results. - :type next_link: str - """ - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'is_data_action': {'key': 'isDataAction', 'type': 'bool'}, - 'display': {'key': 'display', 'type': 'AvailableOperationDisplay'}, - 'origin': {'key': 'origin', 'type': 'str'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(OperationResult, self).__init__(**kwargs) - self.name = kwargs.get('name', None) - self.is_data_action = kwargs.get('is_data_action', None) - self.display = kwargs.get('display', None) - self.origin = kwargs.get('origin', None) - self.next_link = kwargs.get('next_link', None) - - -class ServerCertificateCommonName(msrest.serialization.Model): - """Describes the server certificate details using common name. - - All required parameters must be populated in order to send to Azure. - - :param certificate_common_name: Required. The common name of the server certificate. - :type certificate_common_name: str - :param certificate_issuer_thumbprint: Required. The issuer thumbprint of the server - certificate. - :type certificate_issuer_thumbprint: str - """ - - _validation = { - 'certificate_common_name': {'required': True}, - 'certificate_issuer_thumbprint': {'required': True}, - } - - _attribute_map = { - 'certificate_common_name': {'key': 'certificateCommonName', 'type': 'str'}, - 'certificate_issuer_thumbprint': {'key': 'certificateIssuerThumbprint', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ServerCertificateCommonName, self).__init__(**kwargs) - self.certificate_common_name = kwargs['certificate_common_name'] - self.certificate_issuer_thumbprint = kwargs['certificate_issuer_thumbprint'] - - -class ServerCertificateCommonNames(msrest.serialization.Model): - """Describes a list of server certificates referenced by common name that are used to secure the cluster. - - :param common_names: The list of server certificates referenced by common name that are used to - secure the cluster. - :type common_names: list[~azure.mgmt.servicefabric.models.ServerCertificateCommonName] - :param x509_store_name: The local certificate store location. Possible values include: - "AddressBook", "AuthRoot", "CertificateAuthority", "Disallowed", "My", "Root", "TrustedPeople", - "TrustedPublisher". - :type x509_store_name: str or ~azure.mgmt.servicefabric.models.StoreName - """ - - _attribute_map = { - 'common_names': {'key': 'commonNames', 'type': '[ServerCertificateCommonName]'}, - 'x509_store_name': {'key': 'x509StoreName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ServerCertificateCommonNames, self).__init__(**kwargs) - self.common_names = kwargs.get('common_names', None) - self.x509_store_name = kwargs.get('x509_store_name', None) - - -class ServiceCorrelationDescription(msrest.serialization.Model): - """Creates a particular correlation between services. - - All required parameters must be populated in order to send to Azure. - - :param scheme: Required. The ServiceCorrelationScheme which describes the relationship between - this service and the service specified via ServiceName. Possible values include: "Invalid", - "Affinity", "AlignedAffinity", "NonAlignedAffinity". - :type scheme: str or ~azure.mgmt.servicefabric.models.ServiceCorrelationScheme - :param service_name: Required. The name of the service that the correlation relationship is - established with. - :type service_name: str - """ - - _validation = { - 'scheme': {'required': True}, - 'service_name': {'required': True}, - } - - _attribute_map = { - 'scheme': {'key': 'scheme', 'type': 'str'}, - 'service_name': {'key': 'serviceName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ServiceCorrelationDescription, self).__init__(**kwargs) - self.scheme = kwargs['scheme'] - self.service_name = kwargs['service_name'] - - -class ServiceLoadMetricDescription(msrest.serialization.Model): - """Specifies a metric to load balance a service during runtime. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The name of the metric. If the service chooses to report load during - runtime, the load metric name should match the name that is specified in Name exactly. Note - that metric names are case sensitive. - :type name: str - :param weight: The service load metric relative weight, compared to other metrics configured - for this service, as a number. Possible values include: "Zero", "Low", "Medium", "High". - :type weight: str or ~azure.mgmt.servicefabric.models.ServiceLoadMetricWeight - :param primary_default_load: Used only for Stateful services. The default amount of load, as a - number, that this service creates for this metric when it is a Primary replica. - :type primary_default_load: int - :param secondary_default_load: Used only for Stateful services. The default amount of load, as - a number, that this service creates for this metric when it is a Secondary replica. - :type secondary_default_load: int - :param default_load: Used only for Stateless services. The default amount of load, as a number, - that this service creates for this metric. - :type default_load: int - """ - - _validation = { - 'name': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'weight': {'key': 'weight', 'type': 'str'}, - 'primary_default_load': {'key': 'primaryDefaultLoad', 'type': 'int'}, - 'secondary_default_load': {'key': 'secondaryDefaultLoad', 'type': 'int'}, - 'default_load': {'key': 'defaultLoad', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(ServiceLoadMetricDescription, self).__init__(**kwargs) - self.name = kwargs['name'] - self.weight = kwargs.get('weight', None) - self.primary_default_load = kwargs.get('primary_default_load', None) - self.secondary_default_load = kwargs.get('secondary_default_load', None) - self.default_load = kwargs.get('default_load', None) - - -class ServicePlacementPolicyDescription(msrest.serialization.Model): - """Describes the policy to be used for placement of a Service Fabric service. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: . - - All required parameters must be populated in order to send to Azure. - - :param type: Required. The type of placement policy for a service fabric service. Following are - the possible values.Constant filled by server. Possible values include: "Invalid", - "InvalidDomain", "RequiredDomain", "PreferredPrimaryDomain", "RequiredDomainDistribution", - "NonPartiallyPlaceService". - :type type: str or ~azure.mgmt.servicefabric.models.ServicePlacementPolicyType - """ - - _validation = { - 'type': {'required': True}, - } - - _attribute_map = { - 'type': {'key': 'type', 'type': 'str'}, - } - - _subtype_map = { - 'type': {} - } - - def __init__( - self, - **kwargs - ): - super(ServicePlacementPolicyDescription, self).__init__(**kwargs) - self.type = None # type: Optional[str] - - -class ServiceResource(ProxyResource): - """The service resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Azure resource identifier. - :vartype id: str - :ivar name: Azure resource name. - :vartype name: str - :ivar type: Azure resource type. - :vartype type: str - :param location: It will be deprecated in New API, resource location depends on the parent - resource. - :type location: str - :param tags: A set of tags. Azure resource tags. - :type tags: dict[str, str] - :ivar etag: Azure resource etag. - :vartype etag: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.servicefabric.models.SystemData - :param placement_constraints: The placement constraints as a string. Placement constraints are - boolean expressions on node properties and allow for restricting a service to particular nodes - based on the service requirements. For example, to place a service on nodes where NodeType is - blue specify the following: "NodeColor == blue)". - :type placement_constraints: str - :param correlation_scheme: A list that describes the correlation of the service with other - services. - :type correlation_scheme: list[~azure.mgmt.servicefabric.models.ServiceCorrelationDescription] - :param service_load_metrics: The service load metrics is given as an array of - ServiceLoadMetricDescription objects. - :type service_load_metrics: list[~azure.mgmt.servicefabric.models.ServiceLoadMetricDescription] - :param service_placement_policies: A list that describes the correlation of the service with - other services. - :type service_placement_policies: - list[~azure.mgmt.servicefabric.models.ServicePlacementPolicyDescription] - :param default_move_cost: Specifies the move cost for the service. Possible values include: - "Zero", "Low", "Medium", "High". - :type default_move_cost: str or ~azure.mgmt.servicefabric.models.MoveCost - :ivar provisioning_state: The current deployment or provisioning state, which only appears in - the response. - :vartype provisioning_state: str - :param service_kind: The kind of service (Stateless or Stateful).Constant filled by server. - Possible values include: "Invalid", "Stateless", "Stateful". - :type service_kind: str or ~azure.mgmt.servicefabric.models.ServiceKind - :param service_type_name: The name of the service type. - :type service_type_name: str - :param partition_description: Describes how the service is partitioned. - :type partition_description: ~azure.mgmt.servicefabric.models.PartitionSchemeDescription - :param service_package_activation_mode: The activation Mode of the service package. Possible - values include: "SharedProcess", "ExclusiveProcess". - :type service_package_activation_mode: str or - ~azure.mgmt.servicefabric.models.ArmServicePackageActivationMode - :param service_dns_name: Dns name used for the service. If this is specified, then the service - can be accessed via its DNS name instead of service name. - :type service_dns_name: str - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'etag': {'readonly': True}, - 'system_data': {'readonly': True}, - 'provisioning_state': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'placement_constraints': {'key': 'properties.placementConstraints', 'type': 'str'}, - 'correlation_scheme': {'key': 'properties.correlationScheme', 'type': '[ServiceCorrelationDescription]'}, - 'service_load_metrics': {'key': 'properties.serviceLoadMetrics', 'type': '[ServiceLoadMetricDescription]'}, - 'service_placement_policies': {'key': 'properties.servicePlacementPolicies', 'type': '[ServicePlacementPolicyDescription]'}, - 'default_move_cost': {'key': 'properties.defaultMoveCost', 'type': 'str'}, - 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, - 'service_kind': {'key': 'properties.serviceKind', 'type': 'str'}, - 'service_type_name': {'key': 'properties.serviceTypeName', 'type': 'str'}, - 'partition_description': {'key': 'properties.partitionDescription', 'type': 'PartitionSchemeDescription'}, - 'service_package_activation_mode': {'key': 'properties.servicePackageActivationMode', 'type': 'str'}, - 'service_dns_name': {'key': 'properties.serviceDnsName', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ServiceResource, self).__init__(**kwargs) - self.placement_constraints = kwargs.get('placement_constraints', None) - self.correlation_scheme = kwargs.get('correlation_scheme', None) - self.service_load_metrics = kwargs.get('service_load_metrics', None) - self.service_placement_policies = kwargs.get('service_placement_policies', None) - self.default_move_cost = kwargs.get('default_move_cost', None) - self.provisioning_state = None - self.service_kind = None # type: Optional[str] - self.service_type_name = kwargs.get('service_type_name', None) - self.partition_description = kwargs.get('partition_description', None) - self.service_package_activation_mode = kwargs.get('service_package_activation_mode', None) - self.service_dns_name = kwargs.get('service_dns_name', None) - - -class ServiceResourceList(msrest.serialization.Model): - """The list of service resources. - - Variables are only populated by the server, and will be ignored when sending a request. - - :param value: - :type value: list[~azure.mgmt.servicefabric.models.ServiceResource] - :ivar next_link: URL to get the next set of service list results if there are any. - :vartype next_link: str - """ - - _validation = { - 'next_link': {'readonly': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': '[ServiceResource]'}, - 'next_link': {'key': 'nextLink', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ServiceResourceList, self).__init__(**kwargs) - self.value = kwargs.get('value', None) - self.next_link = None - - -class ServiceResourcePropertiesBase(msrest.serialization.Model): - """The common service resource properties. - - :param placement_constraints: The placement constraints as a string. Placement constraints are - boolean expressions on node properties and allow for restricting a service to particular nodes - based on the service requirements. For example, to place a service on nodes where NodeType is - blue specify the following: "NodeColor == blue)". - :type placement_constraints: str - :param correlation_scheme: A list that describes the correlation of the service with other - services. - :type correlation_scheme: list[~azure.mgmt.servicefabric.models.ServiceCorrelationDescription] - :param service_load_metrics: The service load metrics is given as an array of - ServiceLoadMetricDescription objects. - :type service_load_metrics: list[~azure.mgmt.servicefabric.models.ServiceLoadMetricDescription] - :param service_placement_policies: A list that describes the correlation of the service with - other services. - :type service_placement_policies: - list[~azure.mgmt.servicefabric.models.ServicePlacementPolicyDescription] - :param default_move_cost: Specifies the move cost for the service. Possible values include: - "Zero", "Low", "Medium", "High". - :type default_move_cost: str or ~azure.mgmt.servicefabric.models.MoveCost - """ - - _attribute_map = { - 'placement_constraints': {'key': 'placementConstraints', 'type': 'str'}, - 'correlation_scheme': {'key': 'correlationScheme', 'type': '[ServiceCorrelationDescription]'}, - 'service_load_metrics': {'key': 'serviceLoadMetrics', 'type': '[ServiceLoadMetricDescription]'}, - 'service_placement_policies': {'key': 'servicePlacementPolicies', 'type': '[ServicePlacementPolicyDescription]'}, - 'default_move_cost': {'key': 'defaultMoveCost', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ServiceResourcePropertiesBase, self).__init__(**kwargs) - self.placement_constraints = kwargs.get('placement_constraints', None) - self.correlation_scheme = kwargs.get('correlation_scheme', None) - self.service_load_metrics = kwargs.get('service_load_metrics', None) - self.service_placement_policies = kwargs.get('service_placement_policies', None) - self.default_move_cost = kwargs.get('default_move_cost', None) - - -class ServiceResourceProperties(ServiceResourcePropertiesBase): - """The service resource properties. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: StatefulServiceProperties, StatelessServiceProperties. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param placement_constraints: The placement constraints as a string. Placement constraints are - boolean expressions on node properties and allow for restricting a service to particular nodes - based on the service requirements. For example, to place a service on nodes where NodeType is - blue specify the following: "NodeColor == blue)". - :type placement_constraints: str - :param correlation_scheme: A list that describes the correlation of the service with other - services. - :type correlation_scheme: list[~azure.mgmt.servicefabric.models.ServiceCorrelationDescription] - :param service_load_metrics: The service load metrics is given as an array of - ServiceLoadMetricDescription objects. - :type service_load_metrics: list[~azure.mgmt.servicefabric.models.ServiceLoadMetricDescription] - :param service_placement_policies: A list that describes the correlation of the service with - other services. - :type service_placement_policies: - list[~azure.mgmt.servicefabric.models.ServicePlacementPolicyDescription] - :param default_move_cost: Specifies the move cost for the service. Possible values include: - "Zero", "Low", "Medium", "High". - :type default_move_cost: str or ~azure.mgmt.servicefabric.models.MoveCost - :ivar provisioning_state: The current deployment or provisioning state, which only appears in - the response. - :vartype provisioning_state: str - :param service_kind: Required. The kind of service (Stateless or Stateful).Constant filled by - server. Possible values include: "Invalid", "Stateless", "Stateful". - :type service_kind: str or ~azure.mgmt.servicefabric.models.ServiceKind - :param service_type_name: The name of the service type. - :type service_type_name: str - :param partition_description: Describes how the service is partitioned. - :type partition_description: ~azure.mgmt.servicefabric.models.PartitionSchemeDescription - :param service_package_activation_mode: The activation Mode of the service package. Possible - values include: "SharedProcess", "ExclusiveProcess". - :type service_package_activation_mode: str or - ~azure.mgmt.servicefabric.models.ArmServicePackageActivationMode - :param service_dns_name: Dns name used for the service. If this is specified, then the service - can be accessed via its DNS name instead of service name. - :type service_dns_name: str - """ - - _validation = { - 'provisioning_state': {'readonly': True}, - 'service_kind': {'required': True}, - } - - _attribute_map = { - 'placement_constraints': {'key': 'placementConstraints', 'type': 'str'}, - 'correlation_scheme': {'key': 'correlationScheme', 'type': '[ServiceCorrelationDescription]'}, - 'service_load_metrics': {'key': 'serviceLoadMetrics', 'type': '[ServiceLoadMetricDescription]'}, - 'service_placement_policies': {'key': 'servicePlacementPolicies', 'type': '[ServicePlacementPolicyDescription]'}, - 'default_move_cost': {'key': 'defaultMoveCost', 'type': 'str'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'service_kind': {'key': 'serviceKind', 'type': 'str'}, - 'service_type_name': {'key': 'serviceTypeName', 'type': 'str'}, - 'partition_description': {'key': 'partitionDescription', 'type': 'PartitionSchemeDescription'}, - 'service_package_activation_mode': {'key': 'servicePackageActivationMode', 'type': 'str'}, - 'service_dns_name': {'key': 'serviceDnsName', 'type': 'str'}, - } - - _subtype_map = { - 'service_kind': {'Stateful': 'StatefulServiceProperties', 'Stateless': 'StatelessServiceProperties'} - } - - def __init__( - self, - **kwargs - ): - super(ServiceResourceProperties, self).__init__(**kwargs) - self.provisioning_state = None - self.service_kind = 'ServiceResourceProperties' # type: str - self.service_type_name = kwargs.get('service_type_name', None) - self.partition_description = kwargs.get('partition_description', None) - self.service_package_activation_mode = kwargs.get('service_package_activation_mode', None) - self.service_dns_name = kwargs.get('service_dns_name', None) - - -class ServiceResourceUpdate(ProxyResource): - """The service resource for patch operations. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Azure resource identifier. - :vartype id: str - :ivar name: Azure resource name. - :vartype name: str - :ivar type: Azure resource type. - :vartype type: str - :param location: It will be deprecated in New API, resource location depends on the parent - resource. - :type location: str - :param tags: A set of tags. Azure resource tags. - :type tags: dict[str, str] - :ivar etag: Azure resource etag. - :vartype etag: str - :ivar system_data: Metadata pertaining to creation and last modification of the resource. - :vartype system_data: ~azure.mgmt.servicefabric.models.SystemData - :param placement_constraints: The placement constraints as a string. Placement constraints are - boolean expressions on node properties and allow for restricting a service to particular nodes - based on the service requirements. For example, to place a service on nodes where NodeType is - blue specify the following: "NodeColor == blue)". - :type placement_constraints: str - :param correlation_scheme: A list that describes the correlation of the service with other - services. - :type correlation_scheme: list[~azure.mgmt.servicefabric.models.ServiceCorrelationDescription] - :param service_load_metrics: The service load metrics is given as an array of - ServiceLoadMetricDescription objects. - :type service_load_metrics: list[~azure.mgmt.servicefabric.models.ServiceLoadMetricDescription] - :param service_placement_policies: A list that describes the correlation of the service with - other services. - :type service_placement_policies: - list[~azure.mgmt.servicefabric.models.ServicePlacementPolicyDescription] - :param default_move_cost: Specifies the move cost for the service. Possible values include: - "Zero", "Low", "Medium", "High". - :type default_move_cost: str or ~azure.mgmt.servicefabric.models.MoveCost - :param service_kind: The kind of service (Stateless or Stateful).Constant filled by server. - Possible values include: "Invalid", "Stateless", "Stateful". - :type service_kind: str or ~azure.mgmt.servicefabric.models.ServiceKind - """ - - _validation = { - 'id': {'readonly': True}, - 'name': {'readonly': True}, - 'type': {'readonly': True}, - 'etag': {'readonly': True}, - 'system_data': {'readonly': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - 'name': {'key': 'name', 'type': 'str'}, - 'type': {'key': 'type', 'type': 'str'}, - 'location': {'key': 'location', 'type': 'str'}, - 'tags': {'key': 'tags', 'type': '{str}'}, - 'etag': {'key': 'etag', 'type': 'str'}, - 'system_data': {'key': 'systemData', 'type': 'SystemData'}, - 'placement_constraints': {'key': 'properties.placementConstraints', 'type': 'str'}, - 'correlation_scheme': {'key': 'properties.correlationScheme', 'type': '[ServiceCorrelationDescription]'}, - 'service_load_metrics': {'key': 'properties.serviceLoadMetrics', 'type': '[ServiceLoadMetricDescription]'}, - 'service_placement_policies': {'key': 'properties.servicePlacementPolicies', 'type': '[ServicePlacementPolicyDescription]'}, - 'default_move_cost': {'key': 'properties.defaultMoveCost', 'type': 'str'}, - 'service_kind': {'key': 'properties.serviceKind', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(ServiceResourceUpdate, self).__init__(**kwargs) - self.placement_constraints = kwargs.get('placement_constraints', None) - self.correlation_scheme = kwargs.get('correlation_scheme', None) - self.service_load_metrics = kwargs.get('service_load_metrics', None) - self.service_placement_policies = kwargs.get('service_placement_policies', None) - self.default_move_cost = kwargs.get('default_move_cost', None) - self.service_kind = None # type: Optional[str] - - -class ServiceResourceUpdateProperties(ServiceResourcePropertiesBase): - """The service resource properties for patch operations. - - You probably want to use the sub-classes and not this class directly. Known - sub-classes are: StatefulServiceUpdateProperties, StatelessServiceUpdateProperties. - - All required parameters must be populated in order to send to Azure. - - :param placement_constraints: The placement constraints as a string. Placement constraints are - boolean expressions on node properties and allow for restricting a service to particular nodes - based on the service requirements. For example, to place a service on nodes where NodeType is - blue specify the following: "NodeColor == blue)". - :type placement_constraints: str - :param correlation_scheme: A list that describes the correlation of the service with other - services. - :type correlation_scheme: list[~azure.mgmt.servicefabric.models.ServiceCorrelationDescription] - :param service_load_metrics: The service load metrics is given as an array of - ServiceLoadMetricDescription objects. - :type service_load_metrics: list[~azure.mgmt.servicefabric.models.ServiceLoadMetricDescription] - :param service_placement_policies: A list that describes the correlation of the service with - other services. - :type service_placement_policies: - list[~azure.mgmt.servicefabric.models.ServicePlacementPolicyDescription] - :param default_move_cost: Specifies the move cost for the service. Possible values include: - "Zero", "Low", "Medium", "High". - :type default_move_cost: str or ~azure.mgmt.servicefabric.models.MoveCost - :param service_kind: Required. The kind of service (Stateless or Stateful).Constant filled by - server. Possible values include: "Invalid", "Stateless", "Stateful". - :type service_kind: str or ~azure.mgmt.servicefabric.models.ServiceKind - """ - - _validation = { - 'service_kind': {'required': True}, - } - - _attribute_map = { - 'placement_constraints': {'key': 'placementConstraints', 'type': 'str'}, - 'correlation_scheme': {'key': 'correlationScheme', 'type': '[ServiceCorrelationDescription]'}, - 'service_load_metrics': {'key': 'serviceLoadMetrics', 'type': '[ServiceLoadMetricDescription]'}, - 'service_placement_policies': {'key': 'servicePlacementPolicies', 'type': '[ServicePlacementPolicyDescription]'}, - 'default_move_cost': {'key': 'defaultMoveCost', 'type': 'str'}, - 'service_kind': {'key': 'serviceKind', 'type': 'str'}, - } - - _subtype_map = { - 'service_kind': {'Stateful': 'StatefulServiceUpdateProperties', 'Stateless': 'StatelessServiceUpdateProperties'} - } - - def __init__( - self, - **kwargs - ): - super(ServiceResourceUpdateProperties, self).__init__(**kwargs) - self.service_kind = 'ServiceResourceUpdateProperties' # type: str - - -class ServiceTypeDeltaHealthPolicy(msrest.serialization.Model): - """Represents the delta health policy used to evaluate the health of services belonging to a service type when upgrading the cluster. - - :param max_percent_delta_unhealthy_services: The maximum allowed percentage of services health - degradation allowed during cluster upgrades. - The delta is measured between the state of the services at the beginning of upgrade and the - state of the services at the time of the health evaluation. - The check is performed after every upgrade domain upgrade completion to make sure the global - state of the cluster is within tolerated limits. - :type max_percent_delta_unhealthy_services: int - """ - - _validation = { - 'max_percent_delta_unhealthy_services': {'maximum': 100, 'minimum': 0}, - } - - _attribute_map = { - 'max_percent_delta_unhealthy_services': {'key': 'maxPercentDeltaUnhealthyServices', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(ServiceTypeDeltaHealthPolicy, self).__init__(**kwargs) - self.max_percent_delta_unhealthy_services = kwargs.get('max_percent_delta_unhealthy_services', 0) - - -class ServiceTypeHealthPolicy(msrest.serialization.Model): - """Represents the health policy used to evaluate the health of services belonging to a service type. - - :param max_percent_unhealthy_services: The maximum percentage of services allowed to be - unhealthy before your application is considered in error. - :type max_percent_unhealthy_services: int - """ - - _validation = { - 'max_percent_unhealthy_services': {'maximum': 100, 'minimum': 0}, - } - - _attribute_map = { - 'max_percent_unhealthy_services': {'key': 'maxPercentUnhealthyServices', 'type': 'int'}, - } - - def __init__( - self, - **kwargs - ): - super(ServiceTypeHealthPolicy, self).__init__(**kwargs) - self.max_percent_unhealthy_services = kwargs.get('max_percent_unhealthy_services', 0) - - -class SettingsParameterDescription(msrest.serialization.Model): - """Describes a parameter in fabric settings of the cluster. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The parameter name of fabric setting. - :type name: str - :param value: Required. The parameter value of fabric setting. - :type value: str - """ - - _validation = { - 'name': {'required': True}, - 'value': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'value': {'key': 'value', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SettingsParameterDescription, self).__init__(**kwargs) - self.name = kwargs['name'] - self.value = kwargs['value'] - - -class SettingsSectionDescription(msrest.serialization.Model): - """Describes a section in the fabric settings of the cluster. - - All required parameters must be populated in order to send to Azure. - - :param name: Required. The section name of the fabric settings. - :type name: str - :param parameters: Required. The collection of parameters in the section. - :type parameters: list[~azure.mgmt.servicefabric.models.SettingsParameterDescription] - """ - - _validation = { - 'name': {'required': True}, - 'parameters': {'required': True}, - } - - _attribute_map = { - 'name': {'key': 'name', 'type': 'str'}, - 'parameters': {'key': 'parameters', 'type': '[SettingsParameterDescription]'}, - } - - def __init__( - self, - **kwargs - ): - super(SettingsSectionDescription, self).__init__(**kwargs) - self.name = kwargs['name'] - self.parameters = kwargs['parameters'] - - -class SingletonPartitionSchemeDescription(PartitionSchemeDescription): - """SingletonPartitionSchemeDescription. - - All required parameters must be populated in order to send to Azure. - - :param partition_scheme: Required. Specifies how the service is partitioned.Constant filled by - server. Possible values include: "Invalid", "Singleton", "UniformInt64Range", "Named". - :type partition_scheme: str or ~azure.mgmt.servicefabric.models.PartitionScheme - """ - - _validation = { - 'partition_scheme': {'required': True}, - } - - _attribute_map = { - 'partition_scheme': {'key': 'partitionScheme', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(SingletonPartitionSchemeDescription, self).__init__(**kwargs) - self.partition_scheme = 'Singleton' # type: str - - -class StatefulServiceProperties(ServiceResourceProperties): - """The properties of a stateful service resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param placement_constraints: The placement constraints as a string. Placement constraints are - boolean expressions on node properties and allow for restricting a service to particular nodes - based on the service requirements. For example, to place a service on nodes where NodeType is - blue specify the following: "NodeColor == blue)". - :type placement_constraints: str - :param correlation_scheme: A list that describes the correlation of the service with other - services. - :type correlation_scheme: list[~azure.mgmt.servicefabric.models.ServiceCorrelationDescription] - :param service_load_metrics: The service load metrics is given as an array of - ServiceLoadMetricDescription objects. - :type service_load_metrics: list[~azure.mgmt.servicefabric.models.ServiceLoadMetricDescription] - :param service_placement_policies: A list that describes the correlation of the service with - other services. - :type service_placement_policies: - list[~azure.mgmt.servicefabric.models.ServicePlacementPolicyDescription] - :param default_move_cost: Specifies the move cost for the service. Possible values include: - "Zero", "Low", "Medium", "High". - :type default_move_cost: str or ~azure.mgmt.servicefabric.models.MoveCost - :ivar provisioning_state: The current deployment or provisioning state, which only appears in - the response. - :vartype provisioning_state: str - :param service_kind: Required. The kind of service (Stateless or Stateful).Constant filled by - server. Possible values include: "Invalid", "Stateless", "Stateful". - :type service_kind: str or ~azure.mgmt.servicefabric.models.ServiceKind - :param service_type_name: The name of the service type. - :type service_type_name: str - :param partition_description: Describes how the service is partitioned. - :type partition_description: ~azure.mgmt.servicefabric.models.PartitionSchemeDescription - :param service_package_activation_mode: The activation Mode of the service package. Possible - values include: "SharedProcess", "ExclusiveProcess". - :type service_package_activation_mode: str or - ~azure.mgmt.servicefabric.models.ArmServicePackageActivationMode - :param service_dns_name: Dns name used for the service. If this is specified, then the service - can be accessed via its DNS name instead of service name. - :type service_dns_name: str - :param has_persisted_state: A flag indicating whether this is a persistent service which stores - states on the local disk. If it is then the value of this property is true, if not it is false. - :type has_persisted_state: bool - :param target_replica_set_size: The target replica set size as a number. - :type target_replica_set_size: int - :param min_replica_set_size: The minimum replica set size as a number. - :type min_replica_set_size: int - :param replica_restart_wait_duration: The duration between when a replica goes down and when a - new replica is created, represented in ISO 8601 format (hh:mm:ss.s). - :type replica_restart_wait_duration: ~datetime.datetime - :param quorum_loss_wait_duration: The maximum duration for which a partition is allowed to be - in a state of quorum loss, represented in ISO 8601 format (hh:mm:ss.s). - :type quorum_loss_wait_duration: ~datetime.datetime - :param stand_by_replica_keep_duration: The definition on how long StandBy replicas should be - maintained before being removed, represented in ISO 8601 format (hh:mm:ss.s). - :type stand_by_replica_keep_duration: ~datetime.datetime - """ - - _validation = { - 'provisioning_state': {'readonly': True}, - 'service_kind': {'required': True}, - 'target_replica_set_size': {'minimum': 1}, - 'min_replica_set_size': {'minimum': 1}, - } - - _attribute_map = { - 'placement_constraints': {'key': 'placementConstraints', 'type': 'str'}, - 'correlation_scheme': {'key': 'correlationScheme', 'type': '[ServiceCorrelationDescription]'}, - 'service_load_metrics': {'key': 'serviceLoadMetrics', 'type': '[ServiceLoadMetricDescription]'}, - 'service_placement_policies': {'key': 'servicePlacementPolicies', 'type': '[ServicePlacementPolicyDescription]'}, - 'default_move_cost': {'key': 'defaultMoveCost', 'type': 'str'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'service_kind': {'key': 'serviceKind', 'type': 'str'}, - 'service_type_name': {'key': 'serviceTypeName', 'type': 'str'}, - 'partition_description': {'key': 'partitionDescription', 'type': 'PartitionSchemeDescription'}, - 'service_package_activation_mode': {'key': 'servicePackageActivationMode', 'type': 'str'}, - 'service_dns_name': {'key': 'serviceDnsName', 'type': 'str'}, - 'has_persisted_state': {'key': 'hasPersistedState', 'type': 'bool'}, - 'target_replica_set_size': {'key': 'targetReplicaSetSize', 'type': 'int'}, - 'min_replica_set_size': {'key': 'minReplicaSetSize', 'type': 'int'}, - 'replica_restart_wait_duration': {'key': 'replicaRestartWaitDuration', 'type': 'iso-8601'}, - 'quorum_loss_wait_duration': {'key': 'quorumLossWaitDuration', 'type': 'iso-8601'}, - 'stand_by_replica_keep_duration': {'key': 'standByReplicaKeepDuration', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(StatefulServiceProperties, self).__init__(**kwargs) - self.service_kind = 'Stateful' # type: str - self.has_persisted_state = kwargs.get('has_persisted_state', None) - self.target_replica_set_size = kwargs.get('target_replica_set_size', None) - self.min_replica_set_size = kwargs.get('min_replica_set_size', None) - self.replica_restart_wait_duration = kwargs.get('replica_restart_wait_duration', None) - self.quorum_loss_wait_duration = kwargs.get('quorum_loss_wait_duration', None) - self.stand_by_replica_keep_duration = kwargs.get('stand_by_replica_keep_duration', None) - - -class StatefulServiceUpdateProperties(ServiceResourceUpdateProperties): - """The properties of a stateful service resource for patch operations. - - All required parameters must be populated in order to send to Azure. - - :param placement_constraints: The placement constraints as a string. Placement constraints are - boolean expressions on node properties and allow for restricting a service to particular nodes - based on the service requirements. For example, to place a service on nodes where NodeType is - blue specify the following: "NodeColor == blue)". - :type placement_constraints: str - :param correlation_scheme: A list that describes the correlation of the service with other - services. - :type correlation_scheme: list[~azure.mgmt.servicefabric.models.ServiceCorrelationDescription] - :param service_load_metrics: The service load metrics is given as an array of - ServiceLoadMetricDescription objects. - :type service_load_metrics: list[~azure.mgmt.servicefabric.models.ServiceLoadMetricDescription] - :param service_placement_policies: A list that describes the correlation of the service with - other services. - :type service_placement_policies: - list[~azure.mgmt.servicefabric.models.ServicePlacementPolicyDescription] - :param default_move_cost: Specifies the move cost for the service. Possible values include: - "Zero", "Low", "Medium", "High". - :type default_move_cost: str or ~azure.mgmt.servicefabric.models.MoveCost - :param service_kind: Required. The kind of service (Stateless or Stateful).Constant filled by - server. Possible values include: "Invalid", "Stateless", "Stateful". - :type service_kind: str or ~azure.mgmt.servicefabric.models.ServiceKind - :param target_replica_set_size: The target replica set size as a number. - :type target_replica_set_size: int - :param min_replica_set_size: The minimum replica set size as a number. - :type min_replica_set_size: int - :param replica_restart_wait_duration: The duration between when a replica goes down and when a - new replica is created, represented in ISO 8601 format (hh:mm:ss.s). - :type replica_restart_wait_duration: ~datetime.datetime - :param quorum_loss_wait_duration: The maximum duration for which a partition is allowed to be - in a state of quorum loss, represented in ISO 8601 format (hh:mm:ss.s). - :type quorum_loss_wait_duration: ~datetime.datetime - :param stand_by_replica_keep_duration: The definition on how long StandBy replicas should be - maintained before being removed, represented in ISO 8601 format (hh:mm:ss.s). - :type stand_by_replica_keep_duration: ~datetime.datetime - """ - - _validation = { - 'service_kind': {'required': True}, - 'target_replica_set_size': {'minimum': 1}, - 'min_replica_set_size': {'minimum': 1}, - } - - _attribute_map = { - 'placement_constraints': {'key': 'placementConstraints', 'type': 'str'}, - 'correlation_scheme': {'key': 'correlationScheme', 'type': '[ServiceCorrelationDescription]'}, - 'service_load_metrics': {'key': 'serviceLoadMetrics', 'type': '[ServiceLoadMetricDescription]'}, - 'service_placement_policies': {'key': 'servicePlacementPolicies', 'type': '[ServicePlacementPolicyDescription]'}, - 'default_move_cost': {'key': 'defaultMoveCost', 'type': 'str'}, - 'service_kind': {'key': 'serviceKind', 'type': 'str'}, - 'target_replica_set_size': {'key': 'targetReplicaSetSize', 'type': 'int'}, - 'min_replica_set_size': {'key': 'minReplicaSetSize', 'type': 'int'}, - 'replica_restart_wait_duration': {'key': 'replicaRestartWaitDuration', 'type': 'iso-8601'}, - 'quorum_loss_wait_duration': {'key': 'quorumLossWaitDuration', 'type': 'iso-8601'}, - 'stand_by_replica_keep_duration': {'key': 'standByReplicaKeepDuration', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(StatefulServiceUpdateProperties, self).__init__(**kwargs) - self.service_kind = 'Stateful' # type: str - self.target_replica_set_size = kwargs.get('target_replica_set_size', None) - self.min_replica_set_size = kwargs.get('min_replica_set_size', None) - self.replica_restart_wait_duration = kwargs.get('replica_restart_wait_duration', None) - self.quorum_loss_wait_duration = kwargs.get('quorum_loss_wait_duration', None) - self.stand_by_replica_keep_duration = kwargs.get('stand_by_replica_keep_duration', None) - - -class StatelessServiceProperties(ServiceResourceProperties): - """The properties of a stateless service resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param placement_constraints: The placement constraints as a string. Placement constraints are - boolean expressions on node properties and allow for restricting a service to particular nodes - based on the service requirements. For example, to place a service on nodes where NodeType is - blue specify the following: "NodeColor == blue)". - :type placement_constraints: str - :param correlation_scheme: A list that describes the correlation of the service with other - services. - :type correlation_scheme: list[~azure.mgmt.servicefabric.models.ServiceCorrelationDescription] - :param service_load_metrics: The service load metrics is given as an array of - ServiceLoadMetricDescription objects. - :type service_load_metrics: list[~azure.mgmt.servicefabric.models.ServiceLoadMetricDescription] - :param service_placement_policies: A list that describes the correlation of the service with - other services. - :type service_placement_policies: - list[~azure.mgmt.servicefabric.models.ServicePlacementPolicyDescription] - :param default_move_cost: Specifies the move cost for the service. Possible values include: - "Zero", "Low", "Medium", "High". - :type default_move_cost: str or ~azure.mgmt.servicefabric.models.MoveCost - :ivar provisioning_state: The current deployment or provisioning state, which only appears in - the response. - :vartype provisioning_state: str - :param service_kind: Required. The kind of service (Stateless or Stateful).Constant filled by - server. Possible values include: "Invalid", "Stateless", "Stateful". - :type service_kind: str or ~azure.mgmt.servicefabric.models.ServiceKind - :param service_type_name: The name of the service type. - :type service_type_name: str - :param partition_description: Describes how the service is partitioned. - :type partition_description: ~azure.mgmt.servicefabric.models.PartitionSchemeDescription - :param service_package_activation_mode: The activation Mode of the service package. Possible - values include: "SharedProcess", "ExclusiveProcess". - :type service_package_activation_mode: str or - ~azure.mgmt.servicefabric.models.ArmServicePackageActivationMode - :param service_dns_name: Dns name used for the service. If this is specified, then the service - can be accessed via its DNS name instead of service name. - :type service_dns_name: str - :param instance_count: The instance count. - :type instance_count: int - :param instance_close_delay_duration: Delay duration for RequestDrain feature to ensures that - the endpoint advertised by the stateless instance is removed before the delay starts prior to - closing the instance. This delay enables existing requests to drain gracefully before the - instance actually goes down - (https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-application-upgrade-advanced#avoid-connection-drops-during-stateless-service-planned-downtime-preview). - It is first interpreted as a string representing an ISO 8601 duration. If that fails, then it - is interpreted as a number representing the total number of milliseconds. - :type instance_close_delay_duration: str - """ - - _validation = { - 'provisioning_state': {'readonly': True}, - 'service_kind': {'required': True}, - 'instance_count': {'minimum': -1}, - } - - _attribute_map = { - 'placement_constraints': {'key': 'placementConstraints', 'type': 'str'}, - 'correlation_scheme': {'key': 'correlationScheme', 'type': '[ServiceCorrelationDescription]'}, - 'service_load_metrics': {'key': 'serviceLoadMetrics', 'type': '[ServiceLoadMetricDescription]'}, - 'service_placement_policies': {'key': 'servicePlacementPolicies', 'type': '[ServicePlacementPolicyDescription]'}, - 'default_move_cost': {'key': 'defaultMoveCost', 'type': 'str'}, - 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, - 'service_kind': {'key': 'serviceKind', 'type': 'str'}, - 'service_type_name': {'key': 'serviceTypeName', 'type': 'str'}, - 'partition_description': {'key': 'partitionDescription', 'type': 'PartitionSchemeDescription'}, - 'service_package_activation_mode': {'key': 'servicePackageActivationMode', 'type': 'str'}, - 'service_dns_name': {'key': 'serviceDnsName', 'type': 'str'}, - 'instance_count': {'key': 'instanceCount', 'type': 'int'}, - 'instance_close_delay_duration': {'key': 'instanceCloseDelayDuration', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(StatelessServiceProperties, self).__init__(**kwargs) - self.service_kind = 'Stateless' # type: str - self.instance_count = kwargs.get('instance_count', None) - self.instance_close_delay_duration = kwargs.get('instance_close_delay_duration', None) - - -class StatelessServiceUpdateProperties(ServiceResourceUpdateProperties): - """The properties of a stateless service resource for patch operations. - - All required parameters must be populated in order to send to Azure. - - :param placement_constraints: The placement constraints as a string. Placement constraints are - boolean expressions on node properties and allow for restricting a service to particular nodes - based on the service requirements. For example, to place a service on nodes where NodeType is - blue specify the following: "NodeColor == blue)". - :type placement_constraints: str - :param correlation_scheme: A list that describes the correlation of the service with other - services. - :type correlation_scheme: list[~azure.mgmt.servicefabric.models.ServiceCorrelationDescription] - :param service_load_metrics: The service load metrics is given as an array of - ServiceLoadMetricDescription objects. - :type service_load_metrics: list[~azure.mgmt.servicefabric.models.ServiceLoadMetricDescription] - :param service_placement_policies: A list that describes the correlation of the service with - other services. - :type service_placement_policies: - list[~azure.mgmt.servicefabric.models.ServicePlacementPolicyDescription] - :param default_move_cost: Specifies the move cost for the service. Possible values include: - "Zero", "Low", "Medium", "High". - :type default_move_cost: str or ~azure.mgmt.servicefabric.models.MoveCost - :param service_kind: Required. The kind of service (Stateless or Stateful).Constant filled by - server. Possible values include: "Invalid", "Stateless", "Stateful". - :type service_kind: str or ~azure.mgmt.servicefabric.models.ServiceKind - :param instance_count: The instance count. - :type instance_count: int - :param instance_close_delay_duration: Delay duration for RequestDrain feature to ensures that - the endpoint advertised by the stateless instance is removed before the delay starts prior to - closing the instance. This delay enables existing requests to drain gracefully before the - instance actually goes down - (https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-application-upgrade-advanced#avoid-connection-drops-during-stateless-service-planned-downtime-preview). - It is first interpreted as a string representing an ISO 8601 duration. If that fails, then it - is interpreted as a number representing the total number of milliseconds. - :type instance_close_delay_duration: str - """ - - _validation = { - 'service_kind': {'required': True}, - 'instance_count': {'minimum': -1}, - } - - _attribute_map = { - 'placement_constraints': {'key': 'placementConstraints', 'type': 'str'}, - 'correlation_scheme': {'key': 'correlationScheme', 'type': '[ServiceCorrelationDescription]'}, - 'service_load_metrics': {'key': 'serviceLoadMetrics', 'type': '[ServiceLoadMetricDescription]'}, - 'service_placement_policies': {'key': 'servicePlacementPolicies', 'type': '[ServicePlacementPolicyDescription]'}, - 'default_move_cost': {'key': 'defaultMoveCost', 'type': 'str'}, - 'service_kind': {'key': 'serviceKind', 'type': 'str'}, - 'instance_count': {'key': 'instanceCount', 'type': 'int'}, - 'instance_close_delay_duration': {'key': 'instanceCloseDelayDuration', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(StatelessServiceUpdateProperties, self).__init__(**kwargs) - self.service_kind = 'Stateless' # type: str - self.instance_count = kwargs.get('instance_count', None) - self.instance_close_delay_duration = kwargs.get('instance_close_delay_duration', None) - - -class SystemData(msrest.serialization.Model): - """Metadata pertaining to creation and last modification of the resource. - - :param created_by: The identity that created the resource. - :type created_by: str - :param created_by_type: The type of identity that created the resource. - :type created_by_type: str - :param created_at: The timestamp of resource creation (UTC). - :type created_at: ~datetime.datetime - :param last_modified_by: The identity that last modified the resource. - :type last_modified_by: str - :param last_modified_by_type: The type of identity that last modified the resource. - :type last_modified_by_type: str - :param last_modified_at: The timestamp of resource last modification (UTC). - :type last_modified_at: ~datetime.datetime - """ - - _attribute_map = { - 'created_by': {'key': 'createdBy', 'type': 'str'}, - 'created_by_type': {'key': 'createdByType', 'type': 'str'}, - 'created_at': {'key': 'createdAt', 'type': 'iso-8601'}, - 'last_modified_by': {'key': 'lastModifiedBy', 'type': 'str'}, - 'last_modified_by_type': {'key': 'lastModifiedByType', 'type': 'str'}, - 'last_modified_at': {'key': 'lastModifiedAt', 'type': 'iso-8601'}, - } - - def __init__( - self, - **kwargs - ): - super(SystemData, self).__init__(**kwargs) - self.created_by = kwargs.get('created_by', None) - self.created_by_type = kwargs.get('created_by_type', None) - self.created_at = kwargs.get('created_at', None) - self.last_modified_by = kwargs.get('last_modified_by', None) - self.last_modified_by_type = kwargs.get('last_modified_by_type', None) - self.last_modified_at = kwargs.get('last_modified_at', None) - - -class UniformInt64RangePartitionSchemeDescription(PartitionSchemeDescription): - """Describes a partitioning scheme where an integer range is allocated evenly across a number of partitions. - - All required parameters must be populated in order to send to Azure. - - :param partition_scheme: Required. Specifies how the service is partitioned.Constant filled by - server. Possible values include: "Invalid", "Singleton", "UniformInt64Range", "Named". - :type partition_scheme: str or ~azure.mgmt.servicefabric.models.PartitionScheme - :param count: Required. The number of partitions. - :type count: int - :param low_key: Required. String indicating the lower bound of the partition key range that - should be split between the partition ‘count’. - :type low_key: str - :param high_key: Required. String indicating the upper bound of the partition key range that - should be split between the partition ‘count’. - :type high_key: str - """ - - _validation = { - 'partition_scheme': {'required': True}, - 'count': {'required': True}, - 'low_key': {'required': True}, - 'high_key': {'required': True}, - } - - _attribute_map = { - 'partition_scheme': {'key': 'partitionScheme', 'type': 'str'}, - 'count': {'key': 'count', 'type': 'int'}, - 'low_key': {'key': 'lowKey', 'type': 'str'}, - 'high_key': {'key': 'highKey', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UniformInt64RangePartitionSchemeDescription, self).__init__(**kwargs) - self.partition_scheme = 'UniformInt64Range' # type: str - self.count = kwargs['count'] - self.low_key = kwargs['low_key'] - self.high_key = kwargs['high_key'] - - -class UpgradableVersionPathResult(msrest.serialization.Model): - """The list of intermediate cluster code versions for an upgrade or downgrade. Or minimum and maximum upgradable version if no target was given. - - :param supported_path: - :type supported_path: list[str] - """ - - _attribute_map = { - 'supported_path': {'key': 'supportedPath', 'type': '[str]'}, - } - - def __init__( - self, - **kwargs - ): - super(UpgradableVersionPathResult, self).__init__(**kwargs) - self.supported_path = kwargs.get('supported_path', None) - - -class UpgradableVersionsDescription(msrest.serialization.Model): - """UpgradableVersionsDescription. - - All required parameters must be populated in order to send to Azure. - - :param target_version: Required. The target code version. - :type target_version: str - """ - - _validation = { - 'target_version': {'required': True}, - } - - _attribute_map = { - 'target_version': {'key': 'targetVersion', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UpgradableVersionsDescription, self).__init__(**kwargs) - self.target_version = kwargs['target_version'] - - -class UserAssignedIdentity(msrest.serialization.Model): - """UserAssignedIdentity. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar principal_id: The principal id of user assigned identity. - :vartype principal_id: str - :ivar client_id: The client id of user assigned identity. - :vartype client_id: str - """ - - _validation = { - 'principal_id': {'readonly': True}, - 'client_id': {'readonly': True}, - } - - _attribute_map = { - 'principal_id': {'key': 'principalId', 'type': 'str'}, - 'client_id': {'key': 'clientId', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(UserAssignedIdentity, self).__init__(**kwargs) - self.principal_id = None - self.client_id = None diff --git a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/models/_models_py3.py b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/models/_models_py3.py index 66fddb483ccd..290d60b522ab 100644 --- a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/models/_models_py3.py +++ b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/models/_models_py3.py @@ -7,24 +7,26 @@ # -------------------------------------------------------------------------- import datetime -from typing import Dict, List, Optional, Union +from typing import Dict, List, Optional, TYPE_CHECKING, Union from azure.core.exceptions import HttpResponseError import msrest.serialization -from ._service_fabric_management_client_enums import * +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + import __init__ as _models class ApplicationDeltaHealthPolicy(msrest.serialization.Model): """Defines a delta health policy used to evaluate the health of an application or one of its child entities when upgrading the cluster. - :param default_service_type_delta_health_policy: The delta health policy used by default to + :ivar default_service_type_delta_health_policy: The delta health policy used by default to evaluate the health of a service type when upgrading the cluster. - :type default_service_type_delta_health_policy: + :vartype default_service_type_delta_health_policy: ~azure.mgmt.servicefabric.models.ServiceTypeDeltaHealthPolicy - :param service_type_delta_health_policies: The map with service type delta health policy per + :ivar service_type_delta_health_policies: The map with service type delta health policy per service type name. The map is empty by default. - :type service_type_delta_health_policies: dict[str, + :vartype service_type_delta_health_policies: dict[str, ~azure.mgmt.servicefabric.models.ServiceTypeDeltaHealthPolicy] """ @@ -36,10 +38,20 @@ class ApplicationDeltaHealthPolicy(msrest.serialization.Model): def __init__( self, *, - default_service_type_delta_health_policy: Optional["ServiceTypeDeltaHealthPolicy"] = None, - service_type_delta_health_policies: Optional[Dict[str, "ServiceTypeDeltaHealthPolicy"]] = None, + default_service_type_delta_health_policy: Optional["_models.ServiceTypeDeltaHealthPolicy"] = None, + service_type_delta_health_policies: Optional[Dict[str, "_models.ServiceTypeDeltaHealthPolicy"]] = None, **kwargs ): + """ + :keyword default_service_type_delta_health_policy: The delta health policy used by default to + evaluate the health of a service type when upgrading the cluster. + :paramtype default_service_type_delta_health_policy: + ~azure.mgmt.servicefabric.models.ServiceTypeDeltaHealthPolicy + :keyword service_type_delta_health_policies: The map with service type delta health policy per + service type name. The map is empty by default. + :paramtype service_type_delta_health_policies: dict[str, + ~azure.mgmt.servicefabric.models.ServiceTypeDeltaHealthPolicy] + """ super(ApplicationDeltaHealthPolicy, self).__init__(**kwargs) self.default_service_type_delta_health_policy = default_service_type_delta_health_policy self.service_type_delta_health_policies = service_type_delta_health_policies @@ -48,13 +60,13 @@ def __init__( class ApplicationHealthPolicy(msrest.serialization.Model): """Defines a health policy used to evaluate the health of an application or one of its children entities. - :param default_service_type_health_policy: The health policy used by default to evaluate the + :ivar default_service_type_health_policy: The health policy used by default to evaluate the health of a service type. - :type default_service_type_health_policy: + :vartype default_service_type_health_policy: ~azure.mgmt.servicefabric.models.ServiceTypeHealthPolicy - :param service_type_health_policies: The map with service type health policy per service type + :ivar service_type_health_policies: The map with service type health policy per service type name. The map is empty by default. - :type service_type_health_policies: dict[str, + :vartype service_type_health_policies: dict[str, ~azure.mgmt.servicefabric.models.ServiceTypeHealthPolicy] """ @@ -66,10 +78,20 @@ class ApplicationHealthPolicy(msrest.serialization.Model): def __init__( self, *, - default_service_type_health_policy: Optional["ServiceTypeHealthPolicy"] = None, - service_type_health_policies: Optional[Dict[str, "ServiceTypeHealthPolicy"]] = None, + default_service_type_health_policy: Optional["_models.ServiceTypeHealthPolicy"] = None, + service_type_health_policies: Optional[Dict[str, "_models.ServiceTypeHealthPolicy"]] = None, **kwargs ): + """ + :keyword default_service_type_health_policy: The health policy used by default to evaluate the + health of a service type. + :paramtype default_service_type_health_policy: + ~azure.mgmt.servicefabric.models.ServiceTypeHealthPolicy + :keyword service_type_health_policies: The map with service type health policy per service type + name. The map is empty by default. + :paramtype service_type_health_policies: dict[str, + ~azure.mgmt.servicefabric.models.ServiceTypeHealthPolicy] + """ super(ApplicationHealthPolicy, self).__init__(**kwargs) self.default_service_type_health_policy = default_service_type_health_policy self.service_type_health_policies = service_type_health_policies @@ -78,9 +100,9 @@ def __init__( class ApplicationMetricDescription(msrest.serialization.Model): """Describes capacity information for a custom resource balancing metric. This can be used to limit the total consumption of this metric by the services of this application. - :param name: The name of the metric. - :type name: str - :param maximum_capacity: The maximum node capacity for Service Fabric application. + :ivar name: The name of the metric. + :vartype name: str + :ivar maximum_capacity: The maximum node capacity for Service Fabric application. This is the maximum Load for an instance of this application on a single node. Even if the capacity of node is greater than this value, Service Fabric will limit the total load of services within the application on each node to this value. @@ -89,8 +111,8 @@ class ApplicationMetricDescription(msrest.serialization.Model): and this value must always be smaller than or equal to TotalApplicationCapacity. When updating existing application with application capacity, the product of MaximumNodes and this value must always be smaller than or equal to TotalApplicationCapacity. - :type maximum_capacity: long - :param reservation_capacity: The node reservation capacity for Service Fabric application. + :vartype maximum_capacity: long + :ivar reservation_capacity: The node reservation capacity for Service Fabric application. This is the amount of load which is reserved on nodes which have instances of this application. If MinimumNodes is specified, then the product of these values will be the capacity reserved @@ -98,13 +120,13 @@ class ApplicationMetricDescription(msrest.serialization.Model): If set to zero, no capacity is reserved for this metric. When setting application capacity or when updating application capacity; this value must be smaller than or equal to MaximumCapacity for each metric. - :type reservation_capacity: long - :param total_application_capacity: The total metric capacity for Service Fabric application. + :vartype reservation_capacity: long + :ivar total_application_capacity: The total metric capacity for Service Fabric application. This is the total metric capacity for this application in the cluster. Service Fabric will try to limit the sum of loads of services within the application to this value. When creating a new application with application capacity defined, the product of MaximumNodes and MaximumCapacity must always be smaller than or equal to this value. - :type total_application_capacity: long + :vartype total_application_capacity: long """ _attribute_map = { @@ -123,6 +145,35 @@ def __init__( total_application_capacity: Optional[int] = None, **kwargs ): + """ + :keyword name: The name of the metric. + :paramtype name: str + :keyword maximum_capacity: The maximum node capacity for Service Fabric application. + This is the maximum Load for an instance of this application on a single node. Even if the + capacity of node is greater than this value, Service Fabric will limit the total load of + services within the application on each node to this value. + If set to zero, capacity for this metric is unlimited on each node. + When creating a new application with application capacity defined, the product of MaximumNodes + and this value must always be smaller than or equal to TotalApplicationCapacity. + When updating existing application with application capacity, the product of MaximumNodes and + this value must always be smaller than or equal to TotalApplicationCapacity. + :paramtype maximum_capacity: long + :keyword reservation_capacity: The node reservation capacity for Service Fabric application. + This is the amount of load which is reserved on nodes which have instances of this + application. + If MinimumNodes is specified, then the product of these values will be the capacity reserved + in the cluster for the application. + If set to zero, no capacity is reserved for this metric. + When setting application capacity or when updating application capacity; this value must be + smaller than or equal to MaximumCapacity for each metric. + :paramtype reservation_capacity: long + :keyword total_application_capacity: The total metric capacity for Service Fabric application. + This is the total metric capacity for this application in the cluster. Service Fabric will try + to limit the sum of loads of services within the application to this value. + When creating a new application with application capacity defined, the product of MaximumNodes + and MaximumCapacity must always be smaller than or equal to this value. + :paramtype total_application_capacity: long + """ super(ApplicationMetricDescription, self).__init__(**kwargs) self.name = name self.maximum_capacity = maximum_capacity @@ -141,11 +192,11 @@ class ProxyResource(msrest.serialization.Model): :vartype name: str :ivar type: Azure resource type. :vartype type: str - :param location: It will be deprecated in New API, resource location depends on the parent + :ivar location: It will be deprecated in New API, resource location depends on the parent resource. - :type location: str - :param tags: A set of tags. Azure resource tags. - :type tags: dict[str, str] + :vartype location: str + :ivar tags: A set of tags. Azure resource tags. + :vartype tags: dict[str, str] :ivar etag: Azure resource etag. :vartype etag: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. @@ -177,6 +228,13 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword location: It will be deprecated in New API, resource location depends on the parent + resource. + :paramtype location: str + :keyword tags: A set of tags. Azure resource tags. + :paramtype tags: dict[str, str] + """ super(ProxyResource, self).__init__(**kwargs) self.id = None self.name = None @@ -198,48 +256,47 @@ class ApplicationResource(ProxyResource): :vartype name: str :ivar type: Azure resource type. :vartype type: str - :param location: It will be deprecated in New API, resource location depends on the parent + :ivar location: It will be deprecated in New API, resource location depends on the parent resource. - :type location: str - :param tags: A set of tags. Azure resource tags. - :type tags: dict[str, str] + :vartype location: str + :ivar tags: A set of tags. Azure resource tags. + :vartype tags: dict[str, str] :ivar etag: Azure resource etag. :vartype etag: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.servicefabric.models.SystemData - :param identity: Describes the managed identities for an Azure resource. - :type identity: ~azure.mgmt.servicefabric.models.ManagedIdentity - :param type_version: The version of the application type as defined in the application - manifest. - :type type_version: str - :param parameters: List of application parameters with overridden values from their default + :ivar identity: Describes the managed identities for an Azure resource. + :vartype identity: ~azure.mgmt.servicefabric.models.ManagedIdentity + :ivar type_version: The version of the application type as defined in the application manifest. + :vartype type_version: str + :ivar parameters: List of application parameters with overridden values from their default values specified in the application manifest. - :type parameters: dict[str, str] - :param upgrade_policy: Describes the policy for a monitored application upgrade. - :type upgrade_policy: ~azure.mgmt.servicefabric.models.ApplicationUpgradePolicy - :param minimum_nodes: The minimum number of nodes where Service Fabric will reserve capacity - for this application. Note that this does not mean that the services of this application will - be placed on all of those nodes. If this property is set to zero, no capacity will be reserved. + :vartype parameters: dict[str, str] + :ivar upgrade_policy: Describes the policy for a monitored application upgrade. + :vartype upgrade_policy: ~azure.mgmt.servicefabric.models.ApplicationUpgradePolicy + :ivar minimum_nodes: The minimum number of nodes where Service Fabric will reserve capacity for + this application. Note that this does not mean that the services of this application will be + placed on all of those nodes. If this property is set to zero, no capacity will be reserved. The value of this property cannot be more than the value of the MaximumNodes property. - :type minimum_nodes: long - :param maximum_nodes: The maximum number of nodes where Service Fabric will reserve capacity - for this application. Note that this does not mean that the services of this application will - be placed on all of those nodes. By default, the value of this property is zero and it means - that the services can be placed on any node. - :type maximum_nodes: long - :param remove_application_capacity: Remove the current application capacity settings. - :type remove_application_capacity: bool - :param metrics: List of application capacity metric description. - :type metrics: list[~azure.mgmt.servicefabric.models.ApplicationMetricDescription] - :param managed_identities: List of user assigned identities for the application, each mapped to + :vartype minimum_nodes: long + :ivar maximum_nodes: The maximum number of nodes where Service Fabric will reserve capacity for + this application. Note that this does not mean that the services of this application will be + placed on all of those nodes. By default, the value of this property is zero and it means that + the services can be placed on any node. + :vartype maximum_nodes: long + :ivar remove_application_capacity: Remove the current application capacity settings. + :vartype remove_application_capacity: bool + :ivar metrics: List of application capacity metric description. + :vartype metrics: list[~azure.mgmt.servicefabric.models.ApplicationMetricDescription] + :ivar managed_identities: List of user assigned identities for the application, each mapped to a friendly name. - :type managed_identities: + :vartype managed_identities: list[~azure.mgmt.servicefabric.models.ApplicationUserAssignedIdentity] :ivar provisioning_state: The current deployment or provisioning state, which only appears in the response. :vartype provisioning_state: str - :param type_name: The application type name as defined in the application manifest. - :type type_name: str + :ivar type_name: The application type name as defined in the application manifest. + :vartype type_name: str """ _validation = { @@ -279,18 +336,55 @@ def __init__( *, location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, - identity: Optional["ManagedIdentity"] = None, + identity: Optional["_models.ManagedIdentity"] = None, type_version: Optional[str] = None, parameters: Optional[Dict[str, str]] = None, - upgrade_policy: Optional["ApplicationUpgradePolicy"] = None, + upgrade_policy: Optional["_models.ApplicationUpgradePolicy"] = None, minimum_nodes: Optional[int] = None, maximum_nodes: Optional[int] = 0, remove_application_capacity: Optional[bool] = None, - metrics: Optional[List["ApplicationMetricDescription"]] = None, - managed_identities: Optional[List["ApplicationUserAssignedIdentity"]] = None, + metrics: Optional[List["_models.ApplicationMetricDescription"]] = None, + managed_identities: Optional[List["_models.ApplicationUserAssignedIdentity"]] = None, type_name: Optional[str] = None, **kwargs ): + """ + :keyword location: It will be deprecated in New API, resource location depends on the parent + resource. + :paramtype location: str + :keyword tags: A set of tags. Azure resource tags. + :paramtype tags: dict[str, str] + :keyword identity: Describes the managed identities for an Azure resource. + :paramtype identity: ~azure.mgmt.servicefabric.models.ManagedIdentity + :keyword type_version: The version of the application type as defined in the application + manifest. + :paramtype type_version: str + :keyword parameters: List of application parameters with overridden values from their default + values specified in the application manifest. + :paramtype parameters: dict[str, str] + :keyword upgrade_policy: Describes the policy for a monitored application upgrade. + :paramtype upgrade_policy: ~azure.mgmt.servicefabric.models.ApplicationUpgradePolicy + :keyword minimum_nodes: The minimum number of nodes where Service Fabric will reserve capacity + for this application. Note that this does not mean that the services of this application will + be placed on all of those nodes. If this property is set to zero, no capacity will be reserved. + The value of this property cannot be more than the value of the MaximumNodes property. + :paramtype minimum_nodes: long + :keyword maximum_nodes: The maximum number of nodes where Service Fabric will reserve capacity + for this application. Note that this does not mean that the services of this application will + be placed on all of those nodes. By default, the value of this property is zero and it means + that the services can be placed on any node. + :paramtype maximum_nodes: long + :keyword remove_application_capacity: Remove the current application capacity settings. + :paramtype remove_application_capacity: bool + :keyword metrics: List of application capacity metric description. + :paramtype metrics: list[~azure.mgmt.servicefabric.models.ApplicationMetricDescription] + :keyword managed_identities: List of user assigned identities for the application, each mapped + to a friendly name. + :paramtype managed_identities: + list[~azure.mgmt.servicefabric.models.ApplicationUserAssignedIdentity] + :keyword type_name: The application type name as defined in the application manifest. + :paramtype type_name: str + """ super(ApplicationResource, self).__init__(location=location, tags=tags, **kwargs) self.identity = identity self.type_version = type_version @@ -310,8 +404,8 @@ class ApplicationResourceList(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param value: - :type value: list[~azure.mgmt.servicefabric.models.ApplicationResource] + :ivar value: + :vartype value: list[~azure.mgmt.servicefabric.models.ApplicationResource] :ivar next_link: URL to get the next set of application list results if there are any. :vartype next_link: str """ @@ -328,9 +422,13 @@ class ApplicationResourceList(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["ApplicationResource"]] = None, + value: Optional[List["_models.ApplicationResource"]] = None, **kwargs ): + """ + :keyword value: + :paramtype value: list[~azure.mgmt.servicefabric.models.ApplicationResource] + """ super(ApplicationResourceList, self).__init__(**kwargs) self.value = value self.next_link = None @@ -339,31 +437,30 @@ def __init__( class ApplicationResourceUpdateProperties(msrest.serialization.Model): """The application resource properties for patch operations. - :param type_version: The version of the application type as defined in the application - manifest. - :type type_version: str - :param parameters: List of application parameters with overridden values from their default + :ivar type_version: The version of the application type as defined in the application manifest. + :vartype type_version: str + :ivar parameters: List of application parameters with overridden values from their default values specified in the application manifest. - :type parameters: dict[str, str] - :param upgrade_policy: Describes the policy for a monitored application upgrade. - :type upgrade_policy: ~azure.mgmt.servicefabric.models.ApplicationUpgradePolicy - :param minimum_nodes: The minimum number of nodes where Service Fabric will reserve capacity - for this application. Note that this does not mean that the services of this application will - be placed on all of those nodes. If this property is set to zero, no capacity will be reserved. + :vartype parameters: dict[str, str] + :ivar upgrade_policy: Describes the policy for a monitored application upgrade. + :vartype upgrade_policy: ~azure.mgmt.servicefabric.models.ApplicationUpgradePolicy + :ivar minimum_nodes: The minimum number of nodes where Service Fabric will reserve capacity for + this application. Note that this does not mean that the services of this application will be + placed on all of those nodes. If this property is set to zero, no capacity will be reserved. The value of this property cannot be more than the value of the MaximumNodes property. - :type minimum_nodes: long - :param maximum_nodes: The maximum number of nodes where Service Fabric will reserve capacity - for this application. Note that this does not mean that the services of this application will - be placed on all of those nodes. By default, the value of this property is zero and it means - that the services can be placed on any node. - :type maximum_nodes: long - :param remove_application_capacity: Remove the current application capacity settings. - :type remove_application_capacity: bool - :param metrics: List of application capacity metric description. - :type metrics: list[~azure.mgmt.servicefabric.models.ApplicationMetricDescription] - :param managed_identities: List of user assigned identities for the application, each mapped to + :vartype minimum_nodes: long + :ivar maximum_nodes: The maximum number of nodes where Service Fabric will reserve capacity for + this application. Note that this does not mean that the services of this application will be + placed on all of those nodes. By default, the value of this property is zero and it means that + the services can be placed on any node. + :vartype maximum_nodes: long + :ivar remove_application_capacity: Remove the current application capacity settings. + :vartype remove_application_capacity: bool + :ivar metrics: List of application capacity metric description. + :vartype metrics: list[~azure.mgmt.servicefabric.models.ApplicationMetricDescription] + :ivar managed_identities: List of user assigned identities for the application, each mapped to a friendly name. - :type managed_identities: + :vartype managed_identities: list[~azure.mgmt.servicefabric.models.ApplicationUserAssignedIdentity] """ @@ -388,14 +485,42 @@ def __init__( *, type_version: Optional[str] = None, parameters: Optional[Dict[str, str]] = None, - upgrade_policy: Optional["ApplicationUpgradePolicy"] = None, + upgrade_policy: Optional["_models.ApplicationUpgradePolicy"] = None, minimum_nodes: Optional[int] = None, maximum_nodes: Optional[int] = 0, remove_application_capacity: Optional[bool] = None, - metrics: Optional[List["ApplicationMetricDescription"]] = None, - managed_identities: Optional[List["ApplicationUserAssignedIdentity"]] = None, + metrics: Optional[List["_models.ApplicationMetricDescription"]] = None, + managed_identities: Optional[List["_models.ApplicationUserAssignedIdentity"]] = None, **kwargs ): + """ + :keyword type_version: The version of the application type as defined in the application + manifest. + :paramtype type_version: str + :keyword parameters: List of application parameters with overridden values from their default + values specified in the application manifest. + :paramtype parameters: dict[str, str] + :keyword upgrade_policy: Describes the policy for a monitored application upgrade. + :paramtype upgrade_policy: ~azure.mgmt.servicefabric.models.ApplicationUpgradePolicy + :keyword minimum_nodes: The minimum number of nodes where Service Fabric will reserve capacity + for this application. Note that this does not mean that the services of this application will + be placed on all of those nodes. If this property is set to zero, no capacity will be reserved. + The value of this property cannot be more than the value of the MaximumNodes property. + :paramtype minimum_nodes: long + :keyword maximum_nodes: The maximum number of nodes where Service Fabric will reserve capacity + for this application. Note that this does not mean that the services of this application will + be placed on all of those nodes. By default, the value of this property is zero and it means + that the services can be placed on any node. + :paramtype maximum_nodes: long + :keyword remove_application_capacity: Remove the current application capacity settings. + :paramtype remove_application_capacity: bool + :keyword metrics: List of application capacity metric description. + :paramtype metrics: list[~azure.mgmt.servicefabric.models.ApplicationMetricDescription] + :keyword managed_identities: List of user assigned identities for the application, each mapped + to a friendly name. + :paramtype managed_identities: + list[~azure.mgmt.servicefabric.models.ApplicationUserAssignedIdentity] + """ super(ApplicationResourceUpdateProperties, self).__init__(**kwargs) self.type_version = type_version self.parameters = parameters @@ -412,37 +537,36 @@ class ApplicationResourceProperties(ApplicationResourceUpdateProperties): Variables are only populated by the server, and will be ignored when sending a request. - :param type_version: The version of the application type as defined in the application - manifest. - :type type_version: str - :param parameters: List of application parameters with overridden values from their default + :ivar type_version: The version of the application type as defined in the application manifest. + :vartype type_version: str + :ivar parameters: List of application parameters with overridden values from their default values specified in the application manifest. - :type parameters: dict[str, str] - :param upgrade_policy: Describes the policy for a monitored application upgrade. - :type upgrade_policy: ~azure.mgmt.servicefabric.models.ApplicationUpgradePolicy - :param minimum_nodes: The minimum number of nodes where Service Fabric will reserve capacity - for this application. Note that this does not mean that the services of this application will - be placed on all of those nodes. If this property is set to zero, no capacity will be reserved. + :vartype parameters: dict[str, str] + :ivar upgrade_policy: Describes the policy for a monitored application upgrade. + :vartype upgrade_policy: ~azure.mgmt.servicefabric.models.ApplicationUpgradePolicy + :ivar minimum_nodes: The minimum number of nodes where Service Fabric will reserve capacity for + this application. Note that this does not mean that the services of this application will be + placed on all of those nodes. If this property is set to zero, no capacity will be reserved. The value of this property cannot be more than the value of the MaximumNodes property. - :type minimum_nodes: long - :param maximum_nodes: The maximum number of nodes where Service Fabric will reserve capacity - for this application. Note that this does not mean that the services of this application will - be placed on all of those nodes. By default, the value of this property is zero and it means - that the services can be placed on any node. - :type maximum_nodes: long - :param remove_application_capacity: Remove the current application capacity settings. - :type remove_application_capacity: bool - :param metrics: List of application capacity metric description. - :type metrics: list[~azure.mgmt.servicefabric.models.ApplicationMetricDescription] - :param managed_identities: List of user assigned identities for the application, each mapped to + :vartype minimum_nodes: long + :ivar maximum_nodes: The maximum number of nodes where Service Fabric will reserve capacity for + this application. Note that this does not mean that the services of this application will be + placed on all of those nodes. By default, the value of this property is zero and it means that + the services can be placed on any node. + :vartype maximum_nodes: long + :ivar remove_application_capacity: Remove the current application capacity settings. + :vartype remove_application_capacity: bool + :ivar metrics: List of application capacity metric description. + :vartype metrics: list[~azure.mgmt.servicefabric.models.ApplicationMetricDescription] + :ivar managed_identities: List of user assigned identities for the application, each mapped to a friendly name. - :type managed_identities: + :vartype managed_identities: list[~azure.mgmt.servicefabric.models.ApplicationUserAssignedIdentity] :ivar provisioning_state: The current deployment or provisioning state, which only appears in the response. :vartype provisioning_state: str - :param type_name: The application type name as defined in the application manifest. - :type type_name: str + :ivar type_name: The application type name as defined in the application manifest. + :vartype type_name: str """ _validation = { @@ -469,15 +593,45 @@ def __init__( *, type_version: Optional[str] = None, parameters: Optional[Dict[str, str]] = None, - upgrade_policy: Optional["ApplicationUpgradePolicy"] = None, + upgrade_policy: Optional["_models.ApplicationUpgradePolicy"] = None, minimum_nodes: Optional[int] = None, maximum_nodes: Optional[int] = 0, remove_application_capacity: Optional[bool] = None, - metrics: Optional[List["ApplicationMetricDescription"]] = None, - managed_identities: Optional[List["ApplicationUserAssignedIdentity"]] = None, + metrics: Optional[List["_models.ApplicationMetricDescription"]] = None, + managed_identities: Optional[List["_models.ApplicationUserAssignedIdentity"]] = None, type_name: Optional[str] = None, **kwargs ): + """ + :keyword type_version: The version of the application type as defined in the application + manifest. + :paramtype type_version: str + :keyword parameters: List of application parameters with overridden values from their default + values specified in the application manifest. + :paramtype parameters: dict[str, str] + :keyword upgrade_policy: Describes the policy for a monitored application upgrade. + :paramtype upgrade_policy: ~azure.mgmt.servicefabric.models.ApplicationUpgradePolicy + :keyword minimum_nodes: The minimum number of nodes where Service Fabric will reserve capacity + for this application. Note that this does not mean that the services of this application will + be placed on all of those nodes. If this property is set to zero, no capacity will be reserved. + The value of this property cannot be more than the value of the MaximumNodes property. + :paramtype minimum_nodes: long + :keyword maximum_nodes: The maximum number of nodes where Service Fabric will reserve capacity + for this application. Note that this does not mean that the services of this application will + be placed on all of those nodes. By default, the value of this property is zero and it means + that the services can be placed on any node. + :paramtype maximum_nodes: long + :keyword remove_application_capacity: Remove the current application capacity settings. + :paramtype remove_application_capacity: bool + :keyword metrics: List of application capacity metric description. + :paramtype metrics: list[~azure.mgmt.servicefabric.models.ApplicationMetricDescription] + :keyword managed_identities: List of user assigned identities for the application, each mapped + to a friendly name. + :paramtype managed_identities: + list[~azure.mgmt.servicefabric.models.ApplicationUserAssignedIdentity] + :keyword type_name: The application type name as defined in the application manifest. + :paramtype type_name: str + """ super(ApplicationResourceProperties, self).__init__(type_version=type_version, parameters=parameters, upgrade_policy=upgrade_policy, minimum_nodes=minimum_nodes, maximum_nodes=maximum_nodes, remove_application_capacity=remove_application_capacity, metrics=metrics, managed_identities=managed_identities, **kwargs) self.provisioning_state = None self.type_name = type_name @@ -494,40 +648,39 @@ class ApplicationResourceUpdate(ProxyResource): :vartype name: str :ivar type: Azure resource type. :vartype type: str - :param location: It will be deprecated in New API, resource location depends on the parent + :ivar location: It will be deprecated in New API, resource location depends on the parent resource. - :type location: str - :param tags: A set of tags. Azure resource tags. - :type tags: dict[str, str] + :vartype location: str + :ivar tags: A set of tags. Azure resource tags. + :vartype tags: dict[str, str] :ivar etag: Azure resource etag. :vartype etag: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.servicefabric.models.SystemData - :param type_version: The version of the application type as defined in the application - manifest. - :type type_version: str - :param parameters: List of application parameters with overridden values from their default + :ivar type_version: The version of the application type as defined in the application manifest. + :vartype type_version: str + :ivar parameters: List of application parameters with overridden values from their default values specified in the application manifest. - :type parameters: dict[str, str] - :param upgrade_policy: Describes the policy for a monitored application upgrade. - :type upgrade_policy: ~azure.mgmt.servicefabric.models.ApplicationUpgradePolicy - :param minimum_nodes: The minimum number of nodes where Service Fabric will reserve capacity - for this application. Note that this does not mean that the services of this application will - be placed on all of those nodes. If this property is set to zero, no capacity will be reserved. + :vartype parameters: dict[str, str] + :ivar upgrade_policy: Describes the policy for a monitored application upgrade. + :vartype upgrade_policy: ~azure.mgmt.servicefabric.models.ApplicationUpgradePolicy + :ivar minimum_nodes: The minimum number of nodes where Service Fabric will reserve capacity for + this application. Note that this does not mean that the services of this application will be + placed on all of those nodes. If this property is set to zero, no capacity will be reserved. The value of this property cannot be more than the value of the MaximumNodes property. - :type minimum_nodes: long - :param maximum_nodes: The maximum number of nodes where Service Fabric will reserve capacity - for this application. Note that this does not mean that the services of this application will - be placed on all of those nodes. By default, the value of this property is zero and it means - that the services can be placed on any node. - :type maximum_nodes: long - :param remove_application_capacity: Remove the current application capacity settings. - :type remove_application_capacity: bool - :param metrics: List of application capacity metric description. - :type metrics: list[~azure.mgmt.servicefabric.models.ApplicationMetricDescription] - :param managed_identities: List of user assigned identities for the application, each mapped to + :vartype minimum_nodes: long + :ivar maximum_nodes: The maximum number of nodes where Service Fabric will reserve capacity for + this application. Note that this does not mean that the services of this application will be + placed on all of those nodes. By default, the value of this property is zero and it means that + the services can be placed on any node. + :vartype maximum_nodes: long + :ivar remove_application_capacity: Remove the current application capacity settings. + :vartype remove_application_capacity: bool + :ivar metrics: List of application capacity metric description. + :vartype metrics: list[~azure.mgmt.servicefabric.models.ApplicationMetricDescription] + :ivar managed_identities: List of user assigned identities for the application, each mapped to a friendly name. - :type managed_identities: + :vartype managed_identities: list[~azure.mgmt.servicefabric.models.ApplicationUserAssignedIdentity] """ @@ -566,14 +719,47 @@ def __init__( tags: Optional[Dict[str, str]] = None, type_version: Optional[str] = None, parameters: Optional[Dict[str, str]] = None, - upgrade_policy: Optional["ApplicationUpgradePolicy"] = None, + upgrade_policy: Optional["_models.ApplicationUpgradePolicy"] = None, minimum_nodes: Optional[int] = None, maximum_nodes: Optional[int] = 0, remove_application_capacity: Optional[bool] = None, - metrics: Optional[List["ApplicationMetricDescription"]] = None, - managed_identities: Optional[List["ApplicationUserAssignedIdentity"]] = None, + metrics: Optional[List["_models.ApplicationMetricDescription"]] = None, + managed_identities: Optional[List["_models.ApplicationUserAssignedIdentity"]] = None, **kwargs ): + """ + :keyword location: It will be deprecated in New API, resource location depends on the parent + resource. + :paramtype location: str + :keyword tags: A set of tags. Azure resource tags. + :paramtype tags: dict[str, str] + :keyword type_version: The version of the application type as defined in the application + manifest. + :paramtype type_version: str + :keyword parameters: List of application parameters with overridden values from their default + values specified in the application manifest. + :paramtype parameters: dict[str, str] + :keyword upgrade_policy: Describes the policy for a monitored application upgrade. + :paramtype upgrade_policy: ~azure.mgmt.servicefabric.models.ApplicationUpgradePolicy + :keyword minimum_nodes: The minimum number of nodes where Service Fabric will reserve capacity + for this application. Note that this does not mean that the services of this application will + be placed on all of those nodes. If this property is set to zero, no capacity will be reserved. + The value of this property cannot be more than the value of the MaximumNodes property. + :paramtype minimum_nodes: long + :keyword maximum_nodes: The maximum number of nodes where Service Fabric will reserve capacity + for this application. Note that this does not mean that the services of this application will + be placed on all of those nodes. By default, the value of this property is zero and it means + that the services can be placed on any node. + :paramtype maximum_nodes: long + :keyword remove_application_capacity: Remove the current application capacity settings. + :paramtype remove_application_capacity: bool + :keyword metrics: List of application capacity metric description. + :paramtype metrics: list[~azure.mgmt.servicefabric.models.ApplicationMetricDescription] + :keyword managed_identities: List of user assigned identities for the application, each mapped + to a friendly name. + :paramtype managed_identities: + list[~azure.mgmt.servicefabric.models.ApplicationUserAssignedIdentity] + """ super(ApplicationResourceUpdate, self).__init__(location=location, tags=tags, **kwargs) self.type_version = type_version self.parameters = parameters @@ -596,11 +782,11 @@ class ApplicationTypeResource(ProxyResource): :vartype name: str :ivar type: Azure resource type. :vartype type: str - :param location: It will be deprecated in New API, resource location depends on the parent + :ivar location: It will be deprecated in New API, resource location depends on the parent resource. - :type location: str - :param tags: A set of tags. Azure resource tags. - :type tags: dict[str, str] + :vartype location: str + :ivar tags: A set of tags. Azure resource tags. + :vartype tags: dict[str, str] :ivar etag: Azure resource etag. :vartype etag: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. @@ -637,6 +823,13 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword location: It will be deprecated in New API, resource location depends on the parent + resource. + :paramtype location: str + :keyword tags: A set of tags. Azure resource tags. + :paramtype tags: dict[str, str] + """ super(ApplicationTypeResource, self).__init__(location=location, tags=tags, **kwargs) self.provisioning_state = None @@ -646,8 +839,8 @@ class ApplicationTypeResourceList(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param value: - :type value: list[~azure.mgmt.servicefabric.models.ApplicationTypeResource] + :ivar value: + :vartype value: list[~azure.mgmt.servicefabric.models.ApplicationTypeResource] :ivar next_link: URL to get the next set of application type list results if there are any. :vartype next_link: str """ @@ -664,9 +857,13 @@ class ApplicationTypeResourceList(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["ApplicationTypeResource"]] = None, + value: Optional[List["_models.ApplicationTypeResource"]] = None, **kwargs ): + """ + :keyword value: + :paramtype value: list[~azure.mgmt.servicefabric.models.ApplicationTypeResource] + """ super(ApplicationTypeResourceList, self).__init__(**kwargs) self.value = value self.next_link = None @@ -683,11 +880,11 @@ class ApplicationTypeVersionResource(ProxyResource): :vartype name: str :ivar type: Azure resource type. :vartype type: str - :param location: It will be deprecated in New API, resource location depends on the parent + :ivar location: It will be deprecated in New API, resource location depends on the parent resource. - :type location: str - :param tags: A set of tags. Azure resource tags. - :type tags: dict[str, str] + :vartype location: str + :ivar tags: A set of tags. Azure resource tags. + :vartype tags: dict[str, str] :ivar etag: Azure resource etag. :vartype etag: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. @@ -695,8 +892,8 @@ class ApplicationTypeVersionResource(ProxyResource): :ivar provisioning_state: The current deployment or provisioning state, which only appears in the response. :vartype provisioning_state: str - :param app_package_url: The URL to the application package. - :type app_package_url: str + :ivar app_package_url: The URL to the application package. + :vartype app_package_url: str :ivar default_parameter_list: List of application type parameters that can be overridden when creating or updating the application. :vartype default_parameter_list: dict[str, str] @@ -733,6 +930,15 @@ def __init__( app_package_url: Optional[str] = None, **kwargs ): + """ + :keyword location: It will be deprecated in New API, resource location depends on the parent + resource. + :paramtype location: str + :keyword tags: A set of tags. Azure resource tags. + :paramtype tags: dict[str, str] + :keyword app_package_url: The URL to the application package. + :paramtype app_package_url: str + """ super(ApplicationTypeVersionResource, self).__init__(location=location, tags=tags, **kwargs) self.provisioning_state = None self.app_package_url = app_package_url @@ -744,8 +950,8 @@ class ApplicationTypeVersionResourceList(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param value: - :type value: list[~azure.mgmt.servicefabric.models.ApplicationTypeVersionResource] + :ivar value: + :vartype value: list[~azure.mgmt.servicefabric.models.ApplicationTypeVersionResource] :ivar next_link: URL to get the next set of application type version list results if there are any. :vartype next_link: str @@ -763,9 +969,13 @@ class ApplicationTypeVersionResourceList(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["ApplicationTypeVersionResource"]] = None, + value: Optional[List["_models.ApplicationTypeVersionResource"]] = None, **kwargs ): + """ + :keyword value: + :paramtype value: list[~azure.mgmt.servicefabric.models.ApplicationTypeVersionResource] + """ super(ApplicationTypeVersionResourceList, self).__init__(**kwargs) self.value = value self.next_link = None @@ -776,9 +986,9 @@ class ApplicationTypeVersionsCleanupPolicy(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param max_unused_versions_to_keep: Required. Number of unused versions per application type to + :ivar max_unused_versions_to_keep: Required. Number of unused versions per application type to keep. - :type max_unused_versions_to_keep: long + :vartype max_unused_versions_to_keep: long """ _validation = { @@ -795,6 +1005,11 @@ def __init__( max_unused_versions_to_keep: int, **kwargs ): + """ + :keyword max_unused_versions_to_keep: Required. Number of unused versions per application type + to keep. + :paramtype max_unused_versions_to_keep: long + """ super(ApplicationTypeVersionsCleanupPolicy, self).__init__(**kwargs) self.max_unused_versions_to_keep = max_unused_versions_to_keep @@ -802,30 +1017,30 @@ def __init__( class ApplicationUpgradePolicy(msrest.serialization.Model): """Describes the policy for a monitored application upgrade. - :param upgrade_replica_set_check_timeout: The maximum amount of time to block processing of an + :ivar upgrade_replica_set_check_timeout: The maximum amount of time to block processing of an upgrade domain and prevent loss of availability when there are unexpected issues. When this timeout expires, processing of the upgrade domain will proceed regardless of availability loss issues. The timeout is reset at the start of each upgrade domain. Valid values are between 0 and 42949672925 inclusive. (unsigned 32-bit integer). - :type upgrade_replica_set_check_timeout: str - :param force_restart: If true, then processes are forcefully restarted during upgrade even when + :vartype upgrade_replica_set_check_timeout: str + :ivar force_restart: If true, then processes are forcefully restarted during upgrade even when the code version has not changed (the upgrade only changes configuration or data). - :type force_restart: bool - :param rolling_upgrade_monitoring_policy: The policy used for monitoring the application + :vartype force_restart: bool + :ivar rolling_upgrade_monitoring_policy: The policy used for monitoring the application upgrade. - :type rolling_upgrade_monitoring_policy: + :vartype rolling_upgrade_monitoring_policy: ~azure.mgmt.servicefabric.models.ArmRollingUpgradeMonitoringPolicy - :param application_health_policy: Defines a health policy used to evaluate the health of an + :ivar application_health_policy: Defines a health policy used to evaluate the health of an application or one of its children entities. - :type application_health_policy: ~azure.mgmt.servicefabric.models.ArmApplicationHealthPolicy - :param upgrade_mode: The mode used to monitor health during a rolling upgrade. The values are - UnmonitoredAuto, UnmonitoredManual, and Monitored. Possible values include: "Invalid", + :vartype application_health_policy: ~azure.mgmt.servicefabric.models.ArmApplicationHealthPolicy + :ivar upgrade_mode: The mode used to monitor health during a rolling upgrade. The values are + UnmonitoredAuto, UnmonitoredManual, and Monitored. Known values are: "Invalid", "UnmonitoredAuto", "UnmonitoredManual", "Monitored". Default value: "Monitored". - :type upgrade_mode: str or ~azure.mgmt.servicefabric.models.RollingUpgradeMode - :param recreate_application: Determines whether the application should be recreated on update. + :vartype upgrade_mode: str or ~azure.mgmt.servicefabric.models.RollingUpgradeMode + :ivar recreate_application: Determines whether the application should be recreated on update. If value=true, the rest of the upgrade policy parameters are not allowed and it will result in availability loss. - :type recreate_application: bool + :vartype recreate_application: bool """ _attribute_map = { @@ -842,12 +1057,39 @@ def __init__( *, upgrade_replica_set_check_timeout: Optional[str] = None, force_restart: Optional[bool] = False, - rolling_upgrade_monitoring_policy: Optional["ArmRollingUpgradeMonitoringPolicy"] = None, - application_health_policy: Optional["ArmApplicationHealthPolicy"] = None, - upgrade_mode: Optional[Union[str, "RollingUpgradeMode"]] = "Monitored", + rolling_upgrade_monitoring_policy: Optional["_models.ArmRollingUpgradeMonitoringPolicy"] = None, + application_health_policy: Optional["_models.ArmApplicationHealthPolicy"] = None, + upgrade_mode: Optional[Union[str, "_models.RollingUpgradeMode"]] = "Monitored", recreate_application: Optional[bool] = None, **kwargs ): + """ + :keyword upgrade_replica_set_check_timeout: The maximum amount of time to block processing of + an upgrade domain and prevent loss of availability when there are unexpected issues. When this + timeout expires, processing of the upgrade domain will proceed regardless of availability loss + issues. The timeout is reset at the start of each upgrade domain. Valid values are between 0 + and 42949672925 inclusive. (unsigned 32-bit integer). + :paramtype upgrade_replica_set_check_timeout: str + :keyword force_restart: If true, then processes are forcefully restarted during upgrade even + when the code version has not changed (the upgrade only changes configuration or data). + :paramtype force_restart: bool + :keyword rolling_upgrade_monitoring_policy: The policy used for monitoring the application + upgrade. + :paramtype rolling_upgrade_monitoring_policy: + ~azure.mgmt.servicefabric.models.ArmRollingUpgradeMonitoringPolicy + :keyword application_health_policy: Defines a health policy used to evaluate the health of an + application or one of its children entities. + :paramtype application_health_policy: + ~azure.mgmt.servicefabric.models.ArmApplicationHealthPolicy + :keyword upgrade_mode: The mode used to monitor health during a rolling upgrade. The values are + UnmonitoredAuto, UnmonitoredManual, and Monitored. Known values are: "Invalid", + "UnmonitoredAuto", "UnmonitoredManual", "Monitored". Default value: "Monitored". + :paramtype upgrade_mode: str or ~azure.mgmt.servicefabric.models.RollingUpgradeMode + :keyword recreate_application: Determines whether the application should be recreated on + update. If value=true, the rest of the upgrade policy parameters are not allowed and it will + result in availability loss. + :paramtype recreate_application: bool + """ super(ApplicationUpgradePolicy, self).__init__(**kwargs) self.upgrade_replica_set_check_timeout = upgrade_replica_set_check_timeout self.force_restart = force_restart @@ -862,10 +1104,10 @@ class ApplicationUserAssignedIdentity(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The friendly name of user assigned identity. - :type name: str - :param principal_id: Required. The principal id of user assigned identity. - :type principal_id: str + :ivar name: Required. The friendly name of user assigned identity. + :vartype name: str + :ivar principal_id: Required. The principal id of user assigned identity. + :vartype principal_id: str """ _validation = { @@ -885,6 +1127,12 @@ def __init__( principal_id: str, **kwargs ): + """ + :keyword name: Required. The friendly name of user assigned identity. + :paramtype name: str + :keyword principal_id: Required. The principal id of user assigned identity. + :paramtype principal_id: str + """ super(ApplicationUserAssignedIdentity, self).__init__(**kwargs) self.name = name self.principal_id = principal_id @@ -893,10 +1141,10 @@ def __init__( class ArmApplicationHealthPolicy(msrest.serialization.Model): """Defines a health policy used to evaluate the health of an application or one of its children entities. - :param consider_warning_as_error: Indicates whether warnings are treated with the same severity + :ivar consider_warning_as_error: Indicates whether warnings are treated with the same severity as errors. - :type consider_warning_as_error: bool - :param max_percent_unhealthy_deployed_applications: The maximum allowed percentage of unhealthy + :vartype consider_warning_as_error: bool + :ivar max_percent_unhealthy_deployed_applications: The maximum allowed percentage of unhealthy deployed applications. Allowed values are Byte values from zero to 100. The percentage represents the maximum tolerated percentage of deployed applications that can be unhealthy before the application is considered in error. @@ -904,14 +1152,14 @@ class ArmApplicationHealthPolicy(msrest.serialization.Model): of nodes where the application is currently deployed on in the cluster. The computation rounds up to tolerate one failure on small numbers of nodes. Default percentage is zero. - :type max_percent_unhealthy_deployed_applications: int - :param default_service_type_health_policy: The health policy used by default to evaluate the + :vartype max_percent_unhealthy_deployed_applications: int + :ivar default_service_type_health_policy: The health policy used by default to evaluate the health of a service type. - :type default_service_type_health_policy: + :vartype default_service_type_health_policy: ~azure.mgmt.servicefabric.models.ArmServiceTypeHealthPolicy - :param service_type_health_policy_map: The map with service type health policy per service type + :ivar service_type_health_policy_map: The map with service type health policy per service type name. The map is empty by default. - :type service_type_health_policy_map: dict[str, + :vartype service_type_health_policy_map: dict[str, ~azure.mgmt.servicefabric.models.ArmServiceTypeHealthPolicy] """ @@ -927,10 +1175,32 @@ def __init__( *, consider_warning_as_error: Optional[bool] = False, max_percent_unhealthy_deployed_applications: Optional[int] = 0, - default_service_type_health_policy: Optional["ArmServiceTypeHealthPolicy"] = None, - service_type_health_policy_map: Optional[Dict[str, "ArmServiceTypeHealthPolicy"]] = None, + default_service_type_health_policy: Optional["_models.ArmServiceTypeHealthPolicy"] = None, + service_type_health_policy_map: Optional[Dict[str, "_models.ArmServiceTypeHealthPolicy"]] = None, **kwargs ): + """ + :keyword consider_warning_as_error: Indicates whether warnings are treated with the same + severity as errors. + :paramtype consider_warning_as_error: bool + :keyword max_percent_unhealthy_deployed_applications: The maximum allowed percentage of + unhealthy deployed applications. Allowed values are Byte values from zero to 100. + The percentage represents the maximum tolerated percentage of deployed applications that can + be unhealthy before the application is considered in error. + This is calculated by dividing the number of unhealthy deployed applications over the number + of nodes where the application is currently deployed on in the cluster. + The computation rounds up to tolerate one failure on small numbers of nodes. Default + percentage is zero. + :paramtype max_percent_unhealthy_deployed_applications: int + :keyword default_service_type_health_policy: The health policy used by default to evaluate the + health of a service type. + :paramtype default_service_type_health_policy: + ~azure.mgmt.servicefabric.models.ArmServiceTypeHealthPolicy + :keyword service_type_health_policy_map: The map with service type health policy per service + type name. The map is empty by default. + :paramtype service_type_health_policy_map: dict[str, + ~azure.mgmt.servicefabric.models.ArmServiceTypeHealthPolicy] + """ super(ArmApplicationHealthPolicy, self).__init__(**kwargs) self.consider_warning_as_error = consider_warning_as_error self.max_percent_unhealthy_deployed_applications = max_percent_unhealthy_deployed_applications @@ -941,34 +1211,34 @@ def __init__( class ArmRollingUpgradeMonitoringPolicy(msrest.serialization.Model): """The policy used for monitoring the application upgrade. - :param failure_action: The activation Mode of the service package. Possible values include: - "Rollback", "Manual". - :type failure_action: str or ~azure.mgmt.servicefabric.models.ArmUpgradeFailureAction - :param health_check_wait_duration: The amount of time to wait after completing an upgrade - domain before applying health policies. It is first interpreted as a string representing an ISO - 8601 duration. If that fails, then it is interpreted as a number representing the total number - of milliseconds. - :type health_check_wait_duration: str - :param health_check_stable_duration: The amount of time that the application or cluster must + :ivar failure_action: The activation Mode of the service package. Known values are: "Rollback", + "Manual". + :vartype failure_action: str or ~azure.mgmt.servicefabric.models.ArmUpgradeFailureAction + :ivar health_check_wait_duration: The amount of time to wait after completing an upgrade domain + before applying health policies. It is first interpreted as a string representing an ISO 8601 + duration. If that fails, then it is interpreted as a number representing the total number of + milliseconds. + :vartype health_check_wait_duration: str + :ivar health_check_stable_duration: The amount of time that the application or cluster must remain healthy before the upgrade proceeds to the next upgrade domain. It is first interpreted as a string representing an ISO 8601 duration. If that fails, then it is interpreted as a number representing the total number of milliseconds. - :type health_check_stable_duration: str - :param health_check_retry_timeout: The amount of time to retry health evaluation when the + :vartype health_check_stable_duration: str + :ivar health_check_retry_timeout: The amount of time to retry health evaluation when the application or cluster is unhealthy before FailureAction is executed. It is first interpreted as a string representing an ISO 8601 duration. If that fails, then it is interpreted as a number representing the total number of milliseconds. - :type health_check_retry_timeout: str - :param upgrade_timeout: The amount of time the overall upgrade has to complete before + :vartype health_check_retry_timeout: str + :ivar upgrade_timeout: The amount of time the overall upgrade has to complete before FailureAction is executed. It is first interpreted as a string representing an ISO 8601 duration. If that fails, then it is interpreted as a number representing the total number of milliseconds. - :type upgrade_timeout: str - :param upgrade_domain_timeout: The amount of time each upgrade domain has to complete before + :vartype upgrade_timeout: str + :ivar upgrade_domain_timeout: The amount of time each upgrade domain has to complete before FailureAction is executed. It is first interpreted as a string representing an ISO 8601 duration. If that fails, then it is interpreted as a number representing the total number of milliseconds. - :type upgrade_domain_timeout: str + :vartype upgrade_domain_timeout: str """ _attribute_map = { @@ -983,7 +1253,7 @@ class ArmRollingUpgradeMonitoringPolicy(msrest.serialization.Model): def __init__( self, *, - failure_action: Optional[Union[str, "ArmUpgradeFailureAction"]] = None, + failure_action: Optional[Union[str, "_models.ArmUpgradeFailureAction"]] = None, health_check_wait_duration: Optional[str] = "0", health_check_stable_duration: Optional[str] = "PT0H2M0S", health_check_retry_timeout: Optional[str] = "PT0H10M0S", @@ -991,6 +1261,36 @@ def __init__( upgrade_domain_timeout: Optional[str] = "P10675199DT02H48M05.4775807S", **kwargs ): + """ + :keyword failure_action: The activation Mode of the service package. Known values are: + "Rollback", "Manual". + :paramtype failure_action: str or ~azure.mgmt.servicefabric.models.ArmUpgradeFailureAction + :keyword health_check_wait_duration: The amount of time to wait after completing an upgrade + domain before applying health policies. It is first interpreted as a string representing an ISO + 8601 duration. If that fails, then it is interpreted as a number representing the total number + of milliseconds. + :paramtype health_check_wait_duration: str + :keyword health_check_stable_duration: The amount of time that the application or cluster must + remain healthy before the upgrade proceeds to the next upgrade domain. It is first interpreted + as a string representing an ISO 8601 duration. If that fails, then it is interpreted as a + number representing the total number of milliseconds. + :paramtype health_check_stable_duration: str + :keyword health_check_retry_timeout: The amount of time to retry health evaluation when the + application or cluster is unhealthy before FailureAction is executed. It is first interpreted + as a string representing an ISO 8601 duration. If that fails, then it is interpreted as a + number representing the total number of milliseconds. + :paramtype health_check_retry_timeout: str + :keyword upgrade_timeout: The amount of time the overall upgrade has to complete before + FailureAction is executed. It is first interpreted as a string representing an ISO 8601 + duration. If that fails, then it is interpreted as a number representing the total number of + milliseconds. + :paramtype upgrade_timeout: str + :keyword upgrade_domain_timeout: The amount of time each upgrade domain has to complete before + FailureAction is executed. It is first interpreted as a string representing an ISO 8601 + duration. If that fails, then it is interpreted as a number representing the total number of + milliseconds. + :paramtype upgrade_domain_timeout: str + """ super(ArmRollingUpgradeMonitoringPolicy, self).__init__(**kwargs) self.failure_action = failure_action self.health_check_wait_duration = health_check_wait_duration @@ -1003,15 +1303,15 @@ def __init__( class ArmServiceTypeHealthPolicy(msrest.serialization.Model): """Represents the health policy used to evaluate the health of services belonging to a service type. - :param max_percent_unhealthy_services: The maximum percentage of services allowed to be + :ivar max_percent_unhealthy_services: The maximum percentage of services allowed to be unhealthy before your application is considered in error. - :type max_percent_unhealthy_services: int - :param max_percent_unhealthy_partitions_per_service: The maximum percentage of partitions per + :vartype max_percent_unhealthy_services: int + :ivar max_percent_unhealthy_partitions_per_service: The maximum percentage of partitions per service allowed to be unhealthy before your application is considered in error. - :type max_percent_unhealthy_partitions_per_service: int - :param max_percent_unhealthy_replicas_per_partition: The maximum percentage of replicas per + :vartype max_percent_unhealthy_partitions_per_service: int + :ivar max_percent_unhealthy_replicas_per_partition: The maximum percentage of replicas per partition allowed to be unhealthy before your application is considered in error. - :type max_percent_unhealthy_replicas_per_partition: int + :vartype max_percent_unhealthy_replicas_per_partition: int """ _validation = { @@ -1034,6 +1334,17 @@ def __init__( max_percent_unhealthy_replicas_per_partition: Optional[int] = 0, **kwargs ): + """ + :keyword max_percent_unhealthy_services: The maximum percentage of services allowed to be + unhealthy before your application is considered in error. + :paramtype max_percent_unhealthy_services: int + :keyword max_percent_unhealthy_partitions_per_service: The maximum percentage of partitions per + service allowed to be unhealthy before your application is considered in error. + :paramtype max_percent_unhealthy_partitions_per_service: int + :keyword max_percent_unhealthy_replicas_per_partition: The maximum percentage of replicas per + partition allowed to be unhealthy before your application is considered in error. + :paramtype max_percent_unhealthy_replicas_per_partition: int + """ super(ArmServiceTypeHealthPolicy, self).__init__(**kwargs) self.max_percent_unhealthy_services = max_percent_unhealthy_services self.max_percent_unhealthy_partitions_per_service = max_percent_unhealthy_partitions_per_service @@ -1043,14 +1354,14 @@ def __init__( class AvailableOperationDisplay(msrest.serialization.Model): """Operation supported by the Service Fabric resource provider. - :param provider: The name of the provider. - :type provider: str - :param resource: The resource on which the operation is performed. - :type resource: str - :param operation: The operation that can be performed. - :type operation: str - :param description: Operation description. - :type description: str + :ivar provider: The name of the provider. + :vartype provider: str + :ivar resource: The resource on which the operation is performed. + :vartype resource: str + :ivar operation: The operation that can be performed. + :vartype operation: str + :ivar description: Operation description. + :vartype description: str """ _attribute_map = { @@ -1069,6 +1380,16 @@ def __init__( description: Optional[str] = None, **kwargs ): + """ + :keyword provider: The name of the provider. + :paramtype provider: str + :keyword resource: The resource on which the operation is performed. + :paramtype resource: str + :keyword operation: The operation that can be performed. + :paramtype operation: str + :keyword description: Operation description. + :paramtype description: str + """ super(AvailableOperationDisplay, self).__init__(**kwargs) self.provider = provider self.resource = resource @@ -1079,12 +1400,12 @@ def __init__( class AzureActiveDirectory(msrest.serialization.Model): """The settings to enable AAD authentication on the cluster. - :param tenant_id: Azure active directory tenant id. - :type tenant_id: str - :param cluster_application: Azure active directory cluster application id. - :type cluster_application: str - :param client_application: Azure active directory client application id. - :type client_application: str + :ivar tenant_id: Azure active directory tenant id. + :vartype tenant_id: str + :ivar cluster_application: Azure active directory cluster application id. + :vartype cluster_application: str + :ivar client_application: Azure active directory client application id. + :vartype client_application: str """ _attribute_map = { @@ -1101,6 +1422,14 @@ def __init__( client_application: Optional[str] = None, **kwargs ): + """ + :keyword tenant_id: Azure active directory tenant id. + :paramtype tenant_id: str + :keyword cluster_application: Azure active directory cluster application id. + :paramtype cluster_application: str + :keyword client_application: Azure active directory client application id. + :paramtype client_application: str + """ super(AzureActiveDirectory, self).__init__(**kwargs) self.tenant_id = tenant_id self.cluster_application = cluster_application @@ -1112,14 +1441,14 @@ class CertificateDescription(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param thumbprint: Required. Thumbprint of the primary certificate. - :type thumbprint: str - :param thumbprint_secondary: Thumbprint of the secondary certificate. - :type thumbprint_secondary: str - :param x509_store_name: The local certificate store location. Possible values include: - "AddressBook", "AuthRoot", "CertificateAuthority", "Disallowed", "My", "Root", "TrustedPeople", + :ivar thumbprint: Required. Thumbprint of the primary certificate. + :vartype thumbprint: str + :ivar thumbprint_secondary: Thumbprint of the secondary certificate. + :vartype thumbprint_secondary: str + :ivar x509_store_name: The local certificate store location. Known values are: "AddressBook", + "AuthRoot", "CertificateAuthority", "Disallowed", "My", "Root", "TrustedPeople", "TrustedPublisher". - :type x509_store_name: str or ~azure.mgmt.servicefabric.models.StoreName + :vartype x509_store_name: str or ~azure.mgmt.servicefabric.models.StoreName """ _validation = { @@ -1137,9 +1466,19 @@ def __init__( *, thumbprint: str, thumbprint_secondary: Optional[str] = None, - x509_store_name: Optional[Union[str, "StoreName"]] = None, + x509_store_name: Optional[Union[str, "_models.StoreName"]] = None, **kwargs ): + """ + :keyword thumbprint: Required. Thumbprint of the primary certificate. + :paramtype thumbprint: str + :keyword thumbprint_secondary: Thumbprint of the secondary certificate. + :paramtype thumbprint_secondary: str + :keyword x509_store_name: The local certificate store location. Known values are: + "AddressBook", "AuthRoot", "CertificateAuthority", "Disallowed", "My", "Root", "TrustedPeople", + "TrustedPublisher". + :paramtype x509_store_name: str or ~azure.mgmt.servicefabric.models.StoreName + """ super(CertificateDescription, self).__init__(**kwargs) self.thumbprint = thumbprint self.thumbprint_secondary = thumbprint_secondary @@ -1151,14 +1490,13 @@ class ClientCertificateCommonName(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param is_admin: Required. Indicates if the client certificate has admin access to the cluster. + :ivar is_admin: Required. Indicates if the client certificate has admin access to the cluster. Non admin clients can perform only read only operations on the cluster. - :type is_admin: bool - :param certificate_common_name: Required. The common name of the client certificate. - :type certificate_common_name: str - :param certificate_issuer_thumbprint: Required. The issuer thumbprint of the client - certificate. - :type certificate_issuer_thumbprint: str + :vartype is_admin: bool + :ivar certificate_common_name: Required. The common name of the client certificate. + :vartype certificate_common_name: str + :ivar certificate_issuer_thumbprint: Required. The issuer thumbprint of the client certificate. + :vartype certificate_issuer_thumbprint: str """ _validation = { @@ -1181,6 +1519,16 @@ def __init__( certificate_issuer_thumbprint: str, **kwargs ): + """ + :keyword is_admin: Required. Indicates if the client certificate has admin access to the + cluster. Non admin clients can perform only read only operations on the cluster. + :paramtype is_admin: bool + :keyword certificate_common_name: Required. The common name of the client certificate. + :paramtype certificate_common_name: str + :keyword certificate_issuer_thumbprint: Required. The issuer thumbprint of the client + certificate. + :paramtype certificate_issuer_thumbprint: str + """ super(ClientCertificateCommonName, self).__init__(**kwargs) self.is_admin = is_admin self.certificate_common_name = certificate_common_name @@ -1192,11 +1540,11 @@ class ClientCertificateThumbprint(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param is_admin: Required. Indicates if the client certificate has admin access to the cluster. + :ivar is_admin: Required. Indicates if the client certificate has admin access to the cluster. Non admin clients can perform only read only operations on the cluster. - :type is_admin: bool - :param certificate_thumbprint: Required. The thumbprint of the client certificate. - :type certificate_thumbprint: str + :vartype is_admin: bool + :ivar certificate_thumbprint: Required. The thumbprint of the client certificate. + :vartype certificate_thumbprint: str """ _validation = { @@ -1216,6 +1564,13 @@ def __init__( certificate_thumbprint: str, **kwargs ): + """ + :keyword is_admin: Required. Indicates if the client certificate has admin access to the + cluster. Non admin clients can perform only read only operations on the cluster. + :paramtype is_admin: bool + :keyword certificate_thumbprint: Required. The thumbprint of the client certificate. + :paramtype certificate_thumbprint: str + """ super(ClientCertificateThumbprint, self).__init__(**kwargs) self.is_admin = is_admin self.certificate_thumbprint = certificate_thumbprint @@ -1234,10 +1589,10 @@ class Resource(msrest.serialization.Model): :vartype name: str :ivar type: Azure resource type. :vartype type: str - :param location: Required. Azure resource location. - :type location: str - :param tags: A set of tags. Azure resource tags. - :type tags: dict[str, str] + :ivar location: Required. Azure resource location. + :vartype location: str + :ivar tags: A set of tags. Azure resource tags. + :vartype tags: dict[str, str] :ivar etag: Azure resource etag. :vartype etag: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. @@ -1270,6 +1625,12 @@ def __init__( tags: Optional[Dict[str, str]] = None, **kwargs ): + """ + :keyword location: Required. Azure resource location. + :paramtype location: str + :keyword tags: A set of tags. Azure resource tags. + :paramtype tags: dict[str, str] + """ super(Resource, self).__init__(**kwargs) self.id = None self.name = None @@ -1293,42 +1654,43 @@ class Cluster(Resource): :vartype name: str :ivar type: Azure resource type. :vartype type: str - :param location: Required. Azure resource location. - :type location: str - :param tags: A set of tags. Azure resource tags. - :type tags: dict[str, str] + :ivar location: Required. Azure resource location. + :vartype location: str + :ivar tags: A set of tags. Azure resource tags. + :vartype tags: dict[str, str] :ivar etag: Azure resource etag. :vartype etag: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.servicefabric.models.SystemData - :param add_on_features: The list of add-on features to enable in the cluster. - :type add_on_features: list[str or ~azure.mgmt.servicefabric.models.AddOnFeatures] + :ivar add_on_features: The list of add-on features to enable in the cluster. + :vartype add_on_features: list[str or ~azure.mgmt.servicefabric.models.AddOnFeatures] :ivar available_cluster_versions: The Service Fabric runtime versions available for this cluster. :vartype available_cluster_versions: list[~azure.mgmt.servicefabric.models.ClusterVersionDetails] - :param azure_active_directory: The AAD authentication settings of the cluster. - :type azure_active_directory: ~azure.mgmt.servicefabric.models.AzureActiveDirectory - :param certificate: The certificate to use for securing the cluster. The certificate provided + :ivar azure_active_directory: The AAD authentication settings of the cluster. + :vartype azure_active_directory: ~azure.mgmt.servicefabric.models.AzureActiveDirectory + :ivar certificate: The certificate to use for securing the cluster. The certificate provided will be used for node to node security within the cluster, SSL certificate for cluster management endpoint and default admin client. - :type certificate: ~azure.mgmt.servicefabric.models.CertificateDescription - :param certificate_common_names: Describes a list of server certificates referenced by common + :vartype certificate: ~azure.mgmt.servicefabric.models.CertificateDescription + :ivar certificate_common_names: Describes a list of server certificates referenced by common name that are used to secure the cluster. - :type certificate_common_names: ~azure.mgmt.servicefabric.models.ServerCertificateCommonNames - :param client_certificate_common_names: The list of client certificates referenced by common + :vartype certificate_common_names: + ~azure.mgmt.servicefabric.models.ServerCertificateCommonNames + :ivar client_certificate_common_names: The list of client certificates referenced by common name that are allowed to manage the cluster. - :type client_certificate_common_names: + :vartype client_certificate_common_names: list[~azure.mgmt.servicefabric.models.ClientCertificateCommonName] - :param client_certificate_thumbprints: The list of client certificates referenced by thumbprint + :ivar client_certificate_thumbprints: The list of client certificates referenced by thumbprint that are allowed to manage the cluster. - :type client_certificate_thumbprints: + :vartype client_certificate_thumbprints: list[~azure.mgmt.servicefabric.models.ClientCertificateThumbprint] - :param cluster_code_version: The Service Fabric runtime version of the cluster. This property + :ivar cluster_code_version: The Service Fabric runtime version of the cluster. This property can only by set the user when **upgradeMode** is set to 'Manual'. To get list of available Service Fabric versions for new clusters use `ClusterVersion API <./ClusterVersion.md>`_. To get the list of available version for existing clusters use **availableClusterVersions**. - :type cluster_code_version: str + :vartype cluster_code_version: str :ivar cluster_endpoint: The Azure Resource Provider endpoint. A system service in the cluster connects to this endpoint. :vartype cluster_endpoint: str @@ -1356,27 +1718,27 @@ class Cluster(Resource): polling the Resource Provider. Clusters in this state cannot be managed by the Resource Provider. * AutoScale - Indicates that the ReliabilityLevel of the cluster is being adjusted. - * Ready - Indicates that the cluster is in a stable state. Possible values include: + * Ready - Indicates that the cluster is in a stable state. Known values are: "WaitingForNodes", "Deploying", "BaselineUpgrade", "UpdatingUserConfiguration", "UpdatingUserCertificate", "UpdatingInfrastructure", "EnforcingClusterVersion", "UpgradeServiceUnreachable", "AutoScale", "Ready". :vartype cluster_state: str or ~azure.mgmt.servicefabric.models.ClusterState - :param diagnostics_storage_account_config: The storage account information for storing Service + :ivar diagnostics_storage_account_config: The storage account information for storing Service Fabric diagnostic logs. - :type diagnostics_storage_account_config: + :vartype diagnostics_storage_account_config: ~azure.mgmt.servicefabric.models.DiagnosticsStorageAccountConfig - :param event_store_service_enabled: Indicates if the event store service is enabled. - :type event_store_service_enabled: bool - :param fabric_settings: The list of custom fabric settings to configure the cluster. - :type fabric_settings: list[~azure.mgmt.servicefabric.models.SettingsSectionDescription] - :param management_endpoint: The http management endpoint of the cluster. - :type management_endpoint: str - :param node_types: The list of node types in the cluster. - :type node_types: list[~azure.mgmt.servicefabric.models.NodeTypeDescription] - :ivar provisioning_state: The provisioning state of the cluster resource. Possible values - include: "Updating", "Succeeded", "Failed", "Canceled". + :ivar event_store_service_enabled: Indicates if the event store service is enabled. + :vartype event_store_service_enabled: bool + :ivar fabric_settings: The list of custom fabric settings to configure the cluster. + :vartype fabric_settings: list[~azure.mgmt.servicefabric.models.SettingsSectionDescription] + :ivar management_endpoint: The http management endpoint of the cluster. + :vartype management_endpoint: str + :ivar node_types: The list of node types in the cluster. + :vartype node_types: list[~azure.mgmt.servicefabric.models.NodeTypeDescription] + :ivar provisioning_state: The provisioning state of the cluster resource. Known values are: + "Updating", "Succeeded", "Failed", "Canceled". :vartype provisioning_state: str or ~azure.mgmt.servicefabric.models.ProvisioningState - :param reliability_level: The reliability level sets the replica set size of system services. + :ivar reliability_level: The reliability level sets the replica set size of system services. Learn about `ReliabilityLevel `_. @@ -1387,50 +1749,50 @@ class Cluster(Resource): used for test clusters. * Silver - Run the System services with a target replica set count of 5. * Gold - Run the System services with a target replica set count of 7. - * Platinum - Run the System services with a target replica set count of 9. Possible values - include: "None", "Bronze", "Silver", "Gold", "Platinum". - :type reliability_level: str or ~azure.mgmt.servicefabric.models.ReliabilityLevel - :param reverse_proxy_certificate: The server certificate used by reverse proxy. - :type reverse_proxy_certificate: ~azure.mgmt.servicefabric.models.CertificateDescription - :param reverse_proxy_certificate_common_names: Describes a list of server certificates + * Platinum - Run the System services with a target replica set count of 9. Known values are: + "None", "Bronze", "Silver", "Gold", "Platinum". + :vartype reliability_level: str or ~azure.mgmt.servicefabric.models.ReliabilityLevel + :ivar reverse_proxy_certificate: The server certificate used by reverse proxy. + :vartype reverse_proxy_certificate: ~azure.mgmt.servicefabric.models.CertificateDescription + :ivar reverse_proxy_certificate_common_names: Describes a list of server certificates referenced by common name that are used to secure the cluster. - :type reverse_proxy_certificate_common_names: + :vartype reverse_proxy_certificate_common_names: ~azure.mgmt.servicefabric.models.ServerCertificateCommonNames - :param upgrade_description: The policy to use when upgrading the cluster. - :type upgrade_description: ~azure.mgmt.servicefabric.models.ClusterUpgradePolicy - :param upgrade_mode: The upgrade mode of the cluster when new Service Fabric runtime version is - available. Possible values include: "Automatic", "Manual". Default value: "Automatic". - :type upgrade_mode: str or ~azure.mgmt.servicefabric.models.UpgradeMode - :param application_type_versions_cleanup_policy: The policy used to clean up unused versions. - :type application_type_versions_cleanup_policy: + :ivar upgrade_description: The policy to use when upgrading the cluster. + :vartype upgrade_description: ~azure.mgmt.servicefabric.models.ClusterUpgradePolicy + :ivar upgrade_mode: The upgrade mode of the cluster when new Service Fabric runtime version is + available. Known values are: "Automatic", "Manual". Default value: "Automatic". + :vartype upgrade_mode: str or ~azure.mgmt.servicefabric.models.UpgradeMode + :ivar application_type_versions_cleanup_policy: The policy used to clean up unused versions. + :vartype application_type_versions_cleanup_policy: ~azure.mgmt.servicefabric.models.ApplicationTypeVersionsCleanupPolicy - :param vm_image: The VM image VMSS has been configured with. Generic names such as Windows or + :ivar vm_image: The VM image VMSS has been configured with. Generic names such as Windows or Linux can be used. - :type vm_image: str - :param sf_zonal_upgrade_mode: This property controls the logical grouping of VMs in upgrade + :vartype vm_image: str + :ivar sf_zonal_upgrade_mode: This property controls the logical grouping of VMs in upgrade domains (UDs). This property can't be modified if a node type with multiple Availability Zones - is already present in the cluster. Possible values include: "Parallel", "Hierarchical". - :type sf_zonal_upgrade_mode: str or ~azure.mgmt.servicefabric.models.SfZonalUpgradeMode - :param vmss_zonal_upgrade_mode: This property defines the upgrade mode for the virtual machine - scale set, it is mandatory if a node type with multiple Availability Zones is added. Possible - values include: "Parallel", "Hierarchical". - :type vmss_zonal_upgrade_mode: str or ~azure.mgmt.servicefabric.models.VmssZonalUpgradeMode - :param infrastructure_service_manager: Indicates if infrastructure service manager is enabled. - :type infrastructure_service_manager: bool - :param upgrade_wave: Indicates when new cluster runtime version upgrades will be applied after + is already present in the cluster. Known values are: "Parallel", "Hierarchical". + :vartype sf_zonal_upgrade_mode: str or ~azure.mgmt.servicefabric.models.SfZonalUpgradeMode + :ivar vmss_zonal_upgrade_mode: This property defines the upgrade mode for the virtual machine + scale set, it is mandatory if a node type with multiple Availability Zones is added. Known + values are: "Parallel", "Hierarchical". + :vartype vmss_zonal_upgrade_mode: str or ~azure.mgmt.servicefabric.models.VmssZonalUpgradeMode + :ivar infrastructure_service_manager: Indicates if infrastructure service manager is enabled. + :vartype infrastructure_service_manager: bool + :ivar upgrade_wave: Indicates when new cluster runtime version upgrades will be applied after they are released. By default is Wave0. Only applies when **upgradeMode** is set to - 'Automatic'. Possible values include: "Wave0", "Wave1", "Wave2". - :type upgrade_wave: str or ~azure.mgmt.servicefabric.models.ClusterUpgradeCadence - :param upgrade_pause_start_timestamp_utc: Indicates the start date and time to pause automatic + 'Automatic'. Known values are: "Wave0", "Wave1", "Wave2". + :vartype upgrade_wave: str or ~azure.mgmt.servicefabric.models.ClusterUpgradeCadence + :ivar upgrade_pause_start_timestamp_utc: Indicates the start date and time to pause automatic runtime version upgrades on the cluster for an specific period of time on the cluster (UTC). - :type upgrade_pause_start_timestamp_utc: ~datetime.datetime - :param upgrade_pause_end_timestamp_utc: Indicates the end date and time to pause automatic + :vartype upgrade_pause_start_timestamp_utc: ~datetime.datetime + :ivar upgrade_pause_end_timestamp_utc: Indicates the end date and time to pause automatic runtime version upgrades on the cluster for an specific period of time on the cluster (UTC). - :type upgrade_pause_end_timestamp_utc: ~datetime.datetime - :param wave_upgrade_paused: Boolean to pause automatic runtime version upgrades to the cluster. - :type wave_upgrade_paused: bool - :param notifications: Indicates a list of notification channels for cluster events. - :type notifications: list[~azure.mgmt.servicefabric.models.Notification] + :vartype upgrade_pause_end_timestamp_utc: ~datetime.datetime + :ivar wave_upgrade_paused: Boolean to pause automatic runtime version upgrades to the cluster. + :vartype wave_upgrade_paused: bool + :ivar notifications: Indicates a list of notification channels for cluster events. + :vartype notifications: list[~azure.mgmt.servicefabric.models.Notification] """ _validation = { @@ -1494,35 +1856,137 @@ def __init__( *, location: str, tags: Optional[Dict[str, str]] = None, - add_on_features: Optional[List[Union[str, "AddOnFeatures"]]] = None, - azure_active_directory: Optional["AzureActiveDirectory"] = None, - certificate: Optional["CertificateDescription"] = None, - certificate_common_names: Optional["ServerCertificateCommonNames"] = None, - client_certificate_common_names: Optional[List["ClientCertificateCommonName"]] = None, - client_certificate_thumbprints: Optional[List["ClientCertificateThumbprint"]] = None, + add_on_features: Optional[List[Union[str, "_models.AddOnFeatures"]]] = None, + azure_active_directory: Optional["_models.AzureActiveDirectory"] = None, + certificate: Optional["_models.CertificateDescription"] = None, + certificate_common_names: Optional["_models.ServerCertificateCommonNames"] = None, + client_certificate_common_names: Optional[List["_models.ClientCertificateCommonName"]] = None, + client_certificate_thumbprints: Optional[List["_models.ClientCertificateThumbprint"]] = None, cluster_code_version: Optional[str] = None, - diagnostics_storage_account_config: Optional["DiagnosticsStorageAccountConfig"] = None, + diagnostics_storage_account_config: Optional["_models.DiagnosticsStorageAccountConfig"] = None, event_store_service_enabled: Optional[bool] = None, - fabric_settings: Optional[List["SettingsSectionDescription"]] = None, + fabric_settings: Optional[List["_models.SettingsSectionDescription"]] = None, management_endpoint: Optional[str] = None, - node_types: Optional[List["NodeTypeDescription"]] = None, - reliability_level: Optional[Union[str, "ReliabilityLevel"]] = None, - reverse_proxy_certificate: Optional["CertificateDescription"] = None, - reverse_proxy_certificate_common_names: Optional["ServerCertificateCommonNames"] = None, - upgrade_description: Optional["ClusterUpgradePolicy"] = None, - upgrade_mode: Optional[Union[str, "UpgradeMode"]] = "Automatic", - application_type_versions_cleanup_policy: Optional["ApplicationTypeVersionsCleanupPolicy"] = None, + node_types: Optional[List["_models.NodeTypeDescription"]] = None, + reliability_level: Optional[Union[str, "_models.ReliabilityLevel"]] = None, + reverse_proxy_certificate: Optional["_models.CertificateDescription"] = None, + reverse_proxy_certificate_common_names: Optional["_models.ServerCertificateCommonNames"] = None, + upgrade_description: Optional["_models.ClusterUpgradePolicy"] = None, + upgrade_mode: Optional[Union[str, "_models.UpgradeMode"]] = "Automatic", + application_type_versions_cleanup_policy: Optional["_models.ApplicationTypeVersionsCleanupPolicy"] = None, vm_image: Optional[str] = None, - sf_zonal_upgrade_mode: Optional[Union[str, "SfZonalUpgradeMode"]] = None, - vmss_zonal_upgrade_mode: Optional[Union[str, "VmssZonalUpgradeMode"]] = None, + sf_zonal_upgrade_mode: Optional[Union[str, "_models.SfZonalUpgradeMode"]] = None, + vmss_zonal_upgrade_mode: Optional[Union[str, "_models.VmssZonalUpgradeMode"]] = None, infrastructure_service_manager: Optional[bool] = None, - upgrade_wave: Optional[Union[str, "ClusterUpgradeCadence"]] = None, + upgrade_wave: Optional[Union[str, "_models.ClusterUpgradeCadence"]] = None, upgrade_pause_start_timestamp_utc: Optional[datetime.datetime] = None, upgrade_pause_end_timestamp_utc: Optional[datetime.datetime] = None, wave_upgrade_paused: Optional[bool] = None, - notifications: Optional[List["Notification"]] = None, + notifications: Optional[List["_models.Notification"]] = None, **kwargs ): + """ + :keyword location: Required. Azure resource location. + :paramtype location: str + :keyword tags: A set of tags. Azure resource tags. + :paramtype tags: dict[str, str] + :keyword add_on_features: The list of add-on features to enable in the cluster. + :paramtype add_on_features: list[str or ~azure.mgmt.servicefabric.models.AddOnFeatures] + :keyword azure_active_directory: The AAD authentication settings of the cluster. + :paramtype azure_active_directory: ~azure.mgmt.servicefabric.models.AzureActiveDirectory + :keyword certificate: The certificate to use for securing the cluster. The certificate provided + will be used for node to node security within the cluster, SSL certificate for cluster + management endpoint and default admin client. + :paramtype certificate: ~azure.mgmt.servicefabric.models.CertificateDescription + :keyword certificate_common_names: Describes a list of server certificates referenced by common + name that are used to secure the cluster. + :paramtype certificate_common_names: + ~azure.mgmt.servicefabric.models.ServerCertificateCommonNames + :keyword client_certificate_common_names: The list of client certificates referenced by common + name that are allowed to manage the cluster. + :paramtype client_certificate_common_names: + list[~azure.mgmt.servicefabric.models.ClientCertificateCommonName] + :keyword client_certificate_thumbprints: The list of client certificates referenced by + thumbprint that are allowed to manage the cluster. + :paramtype client_certificate_thumbprints: + list[~azure.mgmt.servicefabric.models.ClientCertificateThumbprint] + :keyword cluster_code_version: The Service Fabric runtime version of the cluster. This property + can only by set the user when **upgradeMode** is set to 'Manual'. To get list of available + Service Fabric versions for new clusters use `ClusterVersion API <./ClusterVersion.md>`_. To + get the list of available version for existing clusters use **availableClusterVersions**. + :paramtype cluster_code_version: str + :keyword diagnostics_storage_account_config: The storage account information for storing + Service Fabric diagnostic logs. + :paramtype diagnostics_storage_account_config: + ~azure.mgmt.servicefabric.models.DiagnosticsStorageAccountConfig + :keyword event_store_service_enabled: Indicates if the event store service is enabled. + :paramtype event_store_service_enabled: bool + :keyword fabric_settings: The list of custom fabric settings to configure the cluster. + :paramtype fabric_settings: list[~azure.mgmt.servicefabric.models.SettingsSectionDescription] + :keyword management_endpoint: The http management endpoint of the cluster. + :paramtype management_endpoint: str + :keyword node_types: The list of node types in the cluster. + :paramtype node_types: list[~azure.mgmt.servicefabric.models.NodeTypeDescription] + :keyword reliability_level: The reliability level sets the replica set size of system services. + Learn about `ReliabilityLevel + `_. + + + * None - Run the System services with a target replica set count of 1. This should only be + used for test clusters. + * Bronze - Run the System services with a target replica set count of 3. This should only be + used for test clusters. + * Silver - Run the System services with a target replica set count of 5. + * Gold - Run the System services with a target replica set count of 7. + * Platinum - Run the System services with a target replica set count of 9. Known values are: + "None", "Bronze", "Silver", "Gold", "Platinum". + :paramtype reliability_level: str or ~azure.mgmt.servicefabric.models.ReliabilityLevel + :keyword reverse_proxy_certificate: The server certificate used by reverse proxy. + :paramtype reverse_proxy_certificate: ~azure.mgmt.servicefabric.models.CertificateDescription + :keyword reverse_proxy_certificate_common_names: Describes a list of server certificates + referenced by common name that are used to secure the cluster. + :paramtype reverse_proxy_certificate_common_names: + ~azure.mgmt.servicefabric.models.ServerCertificateCommonNames + :keyword upgrade_description: The policy to use when upgrading the cluster. + :paramtype upgrade_description: ~azure.mgmt.servicefabric.models.ClusterUpgradePolicy + :keyword upgrade_mode: The upgrade mode of the cluster when new Service Fabric runtime version + is available. Known values are: "Automatic", "Manual". Default value: "Automatic". + :paramtype upgrade_mode: str or ~azure.mgmt.servicefabric.models.UpgradeMode + :keyword application_type_versions_cleanup_policy: The policy used to clean up unused versions. + :paramtype application_type_versions_cleanup_policy: + ~azure.mgmt.servicefabric.models.ApplicationTypeVersionsCleanupPolicy + :keyword vm_image: The VM image VMSS has been configured with. Generic names such as Windows or + Linux can be used. + :paramtype vm_image: str + :keyword sf_zonal_upgrade_mode: This property controls the logical grouping of VMs in upgrade + domains (UDs). This property can't be modified if a node type with multiple Availability Zones + is already present in the cluster. Known values are: "Parallel", "Hierarchical". + :paramtype sf_zonal_upgrade_mode: str or ~azure.mgmt.servicefabric.models.SfZonalUpgradeMode + :keyword vmss_zonal_upgrade_mode: This property defines the upgrade mode for the virtual + machine scale set, it is mandatory if a node type with multiple Availability Zones is added. + Known values are: "Parallel", "Hierarchical". + :paramtype vmss_zonal_upgrade_mode: str or + ~azure.mgmt.servicefabric.models.VmssZonalUpgradeMode + :keyword infrastructure_service_manager: Indicates if infrastructure service manager is + enabled. + :paramtype infrastructure_service_manager: bool + :keyword upgrade_wave: Indicates when new cluster runtime version upgrades will be applied + after they are released. By default is Wave0. Only applies when **upgradeMode** is set to + 'Automatic'. Known values are: "Wave0", "Wave1", "Wave2". + :paramtype upgrade_wave: str or ~azure.mgmt.servicefabric.models.ClusterUpgradeCadence + :keyword upgrade_pause_start_timestamp_utc: Indicates the start date and time to pause + automatic runtime version upgrades on the cluster for an specific period of time on the cluster + (UTC). + :paramtype upgrade_pause_start_timestamp_utc: ~datetime.datetime + :keyword upgrade_pause_end_timestamp_utc: Indicates the end date and time to pause automatic + runtime version upgrades on the cluster for an specific period of time on the cluster (UTC). + :paramtype upgrade_pause_end_timestamp_utc: ~datetime.datetime + :keyword wave_upgrade_paused: Boolean to pause automatic runtime version upgrades to the + cluster. + :paramtype wave_upgrade_paused: bool + :keyword notifications: Indicates a list of notification channels for cluster events. + :paramtype notifications: list[~azure.mgmt.servicefabric.models.Notification] + """ super(Cluster, self).__init__(location=location, tags=tags, **kwargs) self.add_on_features = add_on_features self.available_cluster_versions = None @@ -1561,10 +2025,10 @@ def __init__( class ClusterCodeVersionsListResult(msrest.serialization.Model): """The list results of the Service Fabric runtime versions. - :param value: - :type value: list[~azure.mgmt.servicefabric.models.ClusterCodeVersionsResult] - :param next_link: The URL to use for getting the next set of results. - :type next_link: str + :ivar value: + :vartype value: list[~azure.mgmt.servicefabric.models.ClusterCodeVersionsResult] + :ivar next_link: The URL to use for getting the next set of results. + :vartype next_link: str """ _attribute_map = { @@ -1575,10 +2039,16 @@ class ClusterCodeVersionsListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["ClusterCodeVersionsResult"]] = None, + value: Optional[List["_models.ClusterCodeVersionsResult"]] = None, next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: + :paramtype value: list[~azure.mgmt.servicefabric.models.ClusterCodeVersionsResult] + :keyword next_link: The URL to use for getting the next set of results. + :paramtype next_link: str + """ super(ClusterCodeVersionsListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1587,19 +2057,19 @@ def __init__( class ClusterCodeVersionsResult(msrest.serialization.Model): """The result of the Service Fabric runtime versions. - :param id: The identification of the result. - :type id: str - :param name: The name of the result. - :type name: str - :param type: The result resource type. - :type type: str - :param code_version: The Service Fabric runtime version of the cluster. - :type code_version: str - :param support_expiry_utc: The date of expiry of support of the version. - :type support_expiry_utc: str - :param environment: Indicates if this version is for Windows or Linux operating system. - Possible values include: "Windows", "Linux". - :type environment: str or ~azure.mgmt.servicefabric.models.ClusterEnvironment + :ivar id: The identification of the result. + :vartype id: str + :ivar name: The name of the result. + :vartype name: str + :ivar type: The result resource type. + :vartype type: str + :ivar code_version: The Service Fabric runtime version of the cluster. + :vartype code_version: str + :ivar support_expiry_utc: The date of expiry of support of the version. + :vartype support_expiry_utc: str + :ivar environment: Indicates if this version is for Windows or Linux operating system. Known + values are: "Windows", "Linux". + :vartype environment: str or ~azure.mgmt.servicefabric.models.ClusterEnvironment """ _attribute_map = { @@ -1619,9 +2089,24 @@ def __init__( type: Optional[str] = None, code_version: Optional[str] = None, support_expiry_utc: Optional[str] = None, - environment: Optional[Union[str, "ClusterEnvironment"]] = None, + environment: Optional[Union[str, "_models.ClusterEnvironment"]] = None, **kwargs ): + """ + :keyword id: The identification of the result. + :paramtype id: str + :keyword name: The name of the result. + :paramtype name: str + :keyword type: The result resource type. + :paramtype type: str + :keyword code_version: The Service Fabric runtime version of the cluster. + :paramtype code_version: str + :keyword support_expiry_utc: The date of expiry of support of the version. + :paramtype support_expiry_utc: str + :keyword environment: Indicates if this version is for Windows or Linux operating system. Known + values are: "Windows", "Linux". + :paramtype environment: str or ~azure.mgmt.servicefabric.models.ClusterEnvironment + """ super(ClusterCodeVersionsResult, self).__init__(**kwargs) self.id = id self.name = name @@ -1634,7 +2119,7 @@ def __init__( class ClusterHealthPolicy(msrest.serialization.Model): """Defines a health policy used to evaluate the health of the cluster or of a cluster node. - :param max_percent_unhealthy_nodes: The maximum allowed percentage of unhealthy nodes before + :ivar max_percent_unhealthy_nodes: The maximum allowed percentage of unhealthy nodes before reporting an error. For example, to allow 10% of nodes to be unhealthy, this value would be 10. The percentage represents the maximum tolerated percentage of nodes that can be unhealthy @@ -1648,8 +2133,8 @@ class ClusterHealthPolicy(msrest.serialization.Model): In large clusters, some nodes will always be down or out for repairs, so this percentage should be configured to tolerate that. - :type max_percent_unhealthy_nodes: int - :param max_percent_unhealthy_applications: The maximum allowed percentage of unhealthy + :vartype max_percent_unhealthy_nodes: int + :ivar max_percent_unhealthy_applications: The maximum allowed percentage of unhealthy applications before reporting an error. For example, to allow 10% of applications to be unhealthy, this value would be 10. @@ -1662,10 +2147,10 @@ class ClusterHealthPolicy(msrest.serialization.Model): included in the ApplicationTypeHealthPolicyMap. The computation rounds up to tolerate one failure on small numbers of applications. Default percentage is zero. - :type max_percent_unhealthy_applications: int - :param application_health_policies: Defines the application health policy map used to evaluate + :vartype max_percent_unhealthy_applications: int + :ivar application_health_policies: Defines the application health policy map used to evaluate the health of an application or one of its children entities. - :type application_health_policies: dict[str, + :vartype application_health_policies: dict[str, ~azure.mgmt.servicefabric.models.ApplicationHealthPolicy] """ @@ -1685,9 +2170,44 @@ def __init__( *, max_percent_unhealthy_nodes: Optional[int] = 0, max_percent_unhealthy_applications: Optional[int] = 0, - application_health_policies: Optional[Dict[str, "ApplicationHealthPolicy"]] = None, + application_health_policies: Optional[Dict[str, "_models.ApplicationHealthPolicy"]] = None, **kwargs ): + """ + :keyword max_percent_unhealthy_nodes: The maximum allowed percentage of unhealthy nodes before + reporting an error. For example, to allow 10% of nodes to be unhealthy, this value would be 10. + + The percentage represents the maximum tolerated percentage of nodes that can be unhealthy + before the cluster is considered in error. + If the percentage is respected but there is at least one unhealthy node, the health is + evaluated as Warning. + The percentage is calculated by dividing the number of unhealthy nodes over the total number + of nodes in the cluster. + The computation rounds up to tolerate one failure on small numbers of nodes. Default + percentage is zero. + + In large clusters, some nodes will always be down or out for repairs, so this percentage + should be configured to tolerate that. + :paramtype max_percent_unhealthy_nodes: int + :keyword max_percent_unhealthy_applications: The maximum allowed percentage of unhealthy + applications before reporting an error. For example, to allow 10% of applications to be + unhealthy, this value would be 10. + + The percentage represents the maximum tolerated percentage of applications that can be + unhealthy before the cluster is considered in error. + If the percentage is respected but there is at least one unhealthy application, the health is + evaluated as Warning. + This is calculated by dividing the number of unhealthy applications over the total number of + application instances in the cluster, excluding applications of application types that are + included in the ApplicationTypeHealthPolicyMap. + The computation rounds up to tolerate one failure on small numbers of applications. Default + percentage is zero. + :paramtype max_percent_unhealthy_applications: int + :keyword application_health_policies: Defines the application health policy map used to + evaluate the health of an application or one of its children entities. + :paramtype application_health_policies: dict[str, + ~azure.mgmt.servicefabric.models.ApplicationHealthPolicy] + """ super(ClusterHealthPolicy, self).__init__(**kwargs) self.max_percent_unhealthy_nodes = max_percent_unhealthy_nodes self.max_percent_unhealthy_applications = max_percent_unhealthy_applications @@ -1697,10 +2217,10 @@ def __init__( class ClusterListResult(msrest.serialization.Model): """Cluster list results. - :param value: - :type value: list[~azure.mgmt.servicefabric.models.Cluster] - :param next_link: The URL to use for getting the next set of results. - :type next_link: str + :ivar value: + :vartype value: list[~azure.mgmt.servicefabric.models.Cluster] + :ivar next_link: The URL to use for getting the next set of results. + :vartype next_link: str """ _attribute_map = { @@ -1711,10 +2231,16 @@ class ClusterListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["Cluster"]] = None, + value: Optional[List["_models.Cluster"]] = None, next_link: Optional[str] = None, **kwargs ): + """ + :keyword value: + :paramtype value: list[~azure.mgmt.servicefabric.models.Cluster] + :keyword next_link: The URL to use for getting the next set of results. + :paramtype next_link: str + """ super(ClusterListResult, self).__init__(**kwargs) self.value = value self.next_link = next_link @@ -1723,39 +2249,39 @@ def __init__( class ClusterUpdateParameters(msrest.serialization.Model): """Cluster update request. - :param tags: A set of tags. Cluster update parameters. - :type tags: dict[str, str] - :param add_on_features: The list of add-on features to enable in the cluster. - :type add_on_features: list[str or ~azure.mgmt.servicefabric.models.AddOnFeatures] - :param certificate: The certificate to use for securing the cluster. The certificate provided + :ivar tags: A set of tags. Cluster update parameters. + :vartype tags: dict[str, str] + :ivar add_on_features: The list of add-on features to enable in the cluster. + :vartype add_on_features: list[str or ~azure.mgmt.servicefabric.models.AddOnFeatures] + :ivar certificate: The certificate to use for securing the cluster. The certificate provided will be used for node to node security within the cluster, SSL certificate for cluster management endpoint and default admin client. - :type certificate: ~azure.mgmt.servicefabric.models.CertificateDescription - :param certificate_common_names: Describes a list of server certificates referenced by common + :vartype certificate: ~azure.mgmt.servicefabric.models.CertificateDescription + :ivar certificate_common_names: Describes a list of server certificates referenced by common name that are used to secure the cluster. - :type certificate_common_names: ~azure.mgmt.servicefabric.models.ServerCertificateCommonNames - :param client_certificate_common_names: The list of client certificates referenced by common + :vartype certificate_common_names: + ~azure.mgmt.servicefabric.models.ServerCertificateCommonNames + :ivar client_certificate_common_names: The list of client certificates referenced by common name that are allowed to manage the cluster. This will overwrite the existing list. - :type client_certificate_common_names: + :vartype client_certificate_common_names: list[~azure.mgmt.servicefabric.models.ClientCertificateCommonName] - :param client_certificate_thumbprints: The list of client certificates referenced by thumbprint + :ivar client_certificate_thumbprints: The list of client certificates referenced by thumbprint that are allowed to manage the cluster. This will overwrite the existing list. - :type client_certificate_thumbprints: + :vartype client_certificate_thumbprints: list[~azure.mgmt.servicefabric.models.ClientCertificateThumbprint] - :param cluster_code_version: The Service Fabric runtime version of the cluster. This property + :ivar cluster_code_version: The Service Fabric runtime version of the cluster. This property can only by set the user when **upgradeMode** is set to 'Manual'. To get list of available Service Fabric versions for new clusters use `ClusterVersion API <./ClusterVersion.md>`_. To get the list of available version for existing clusters use **availableClusterVersions**. - :type cluster_code_version: str - :param event_store_service_enabled: Indicates if the event store service is enabled. - :type event_store_service_enabled: bool - :param fabric_settings: The list of custom fabric settings to configure the cluster. This will + :vartype cluster_code_version: str + :ivar event_store_service_enabled: Indicates if the event store service is enabled. + :vartype event_store_service_enabled: bool + :ivar fabric_settings: The list of custom fabric settings to configure the cluster. This will overwrite the existing list. - :type fabric_settings: list[~azure.mgmt.servicefabric.models.SettingsSectionDescription] - :param node_types: The list of node types in the cluster. This will overwrite the existing - list. - :type node_types: list[~azure.mgmt.servicefabric.models.NodeTypeDescription] - :param reliability_level: The reliability level sets the replica set size of system services. + :vartype fabric_settings: list[~azure.mgmt.servicefabric.models.SettingsSectionDescription] + :ivar node_types: The list of node types in the cluster. This will overwrite the existing list. + :vartype node_types: list[~azure.mgmt.servicefabric.models.NodeTypeDescription] + :ivar reliability_level: The reliability level sets the replica set size of system services. Learn about `ReliabilityLevel `_. @@ -1766,43 +2292,43 @@ class ClusterUpdateParameters(msrest.serialization.Model): used for test clusters. * Silver - Run the System services with a target replica set count of 5. * Gold - Run the System services with a target replica set count of 7. - * Platinum - Run the System services with a target replica set count of 9. Possible values - include: "None", "Bronze", "Silver", "Gold", "Platinum". - :type reliability_level: str or ~azure.mgmt.servicefabric.models.ReliabilityLevel - :param reverse_proxy_certificate: The server certificate used by reverse proxy. - :type reverse_proxy_certificate: ~azure.mgmt.servicefabric.models.CertificateDescription - :param upgrade_description: The policy to use when upgrading the cluster. - :type upgrade_description: ~azure.mgmt.servicefabric.models.ClusterUpgradePolicy - :param application_type_versions_cleanup_policy: The policy used to clean up unused versions. - :type application_type_versions_cleanup_policy: + * Platinum - Run the System services with a target replica set count of 9. Known values are: + "None", "Bronze", "Silver", "Gold", "Platinum". + :vartype reliability_level: str or ~azure.mgmt.servicefabric.models.ReliabilityLevel + :ivar reverse_proxy_certificate: The server certificate used by reverse proxy. + :vartype reverse_proxy_certificate: ~azure.mgmt.servicefabric.models.CertificateDescription + :ivar upgrade_description: The policy to use when upgrading the cluster. + :vartype upgrade_description: ~azure.mgmt.servicefabric.models.ClusterUpgradePolicy + :ivar application_type_versions_cleanup_policy: The policy used to clean up unused versions. + :vartype application_type_versions_cleanup_policy: ~azure.mgmt.servicefabric.models.ApplicationTypeVersionsCleanupPolicy - :param upgrade_mode: The upgrade mode of the cluster when new Service Fabric runtime version is - available. Possible values include: "Automatic", "Manual". Default value: "Automatic". - :type upgrade_mode: str or ~azure.mgmt.servicefabric.models.UpgradeMode - :param sf_zonal_upgrade_mode: This property controls the logical grouping of VMs in upgrade + :ivar upgrade_mode: The upgrade mode of the cluster when new Service Fabric runtime version is + available. Known values are: "Automatic", "Manual". Default value: "Automatic". + :vartype upgrade_mode: str or ~azure.mgmt.servicefabric.models.UpgradeMode + :ivar sf_zonal_upgrade_mode: This property controls the logical grouping of VMs in upgrade domains (UDs). This property can't be modified if a node type with multiple Availability Zones - is already present in the cluster. Possible values include: "Parallel", "Hierarchical". - :type sf_zonal_upgrade_mode: str or ~azure.mgmt.servicefabric.models.SfZonalUpgradeMode - :param vmss_zonal_upgrade_mode: This property defines the upgrade mode for the virtual machine - scale set, it is mandatory if a node type with multiple Availability Zones is added. Possible - values include: "Parallel", "Hierarchical". - :type vmss_zonal_upgrade_mode: str or ~azure.mgmt.servicefabric.models.VmssZonalUpgradeMode - :param infrastructure_service_manager: Indicates if infrastructure service manager is enabled. - :type infrastructure_service_manager: bool - :param upgrade_wave: Indicates when new cluster runtime version upgrades will be applied after + is already present in the cluster. Known values are: "Parallel", "Hierarchical". + :vartype sf_zonal_upgrade_mode: str or ~azure.mgmt.servicefabric.models.SfZonalUpgradeMode + :ivar vmss_zonal_upgrade_mode: This property defines the upgrade mode for the virtual machine + scale set, it is mandatory if a node type with multiple Availability Zones is added. Known + values are: "Parallel", "Hierarchical". + :vartype vmss_zonal_upgrade_mode: str or ~azure.mgmt.servicefabric.models.VmssZonalUpgradeMode + :ivar infrastructure_service_manager: Indicates if infrastructure service manager is enabled. + :vartype infrastructure_service_manager: bool + :ivar upgrade_wave: Indicates when new cluster runtime version upgrades will be applied after they are released. By default is Wave0. Only applies when **upgradeMode** is set to - 'Automatic'. Possible values include: "Wave0", "Wave1", "Wave2". - :type upgrade_wave: str or ~azure.mgmt.servicefabric.models.ClusterUpgradeCadence - :param upgrade_pause_start_timestamp_utc: The start timestamp to pause runtime version upgrades + 'Automatic'. Known values are: "Wave0", "Wave1", "Wave2". + :vartype upgrade_wave: str or ~azure.mgmt.servicefabric.models.ClusterUpgradeCadence + :ivar upgrade_pause_start_timestamp_utc: The start timestamp to pause runtime version upgrades on the cluster (UTC). - :type upgrade_pause_start_timestamp_utc: ~datetime.datetime - :param upgrade_pause_end_timestamp_utc: The end timestamp of pause runtime version upgrades on + :vartype upgrade_pause_start_timestamp_utc: ~datetime.datetime + :ivar upgrade_pause_end_timestamp_utc: The end timestamp of pause runtime version upgrades on the cluster (UTC). - :type upgrade_pause_end_timestamp_utc: ~datetime.datetime - :param wave_upgrade_paused: Boolean to pause automatic runtime version upgrades to the cluster. - :type wave_upgrade_paused: bool - :param notifications: Indicates a list of notification channels for cluster events. - :type notifications: list[~azure.mgmt.servicefabric.models.Notification] + :vartype upgrade_pause_end_timestamp_utc: ~datetime.datetime + :ivar wave_upgrade_paused: Boolean to pause automatic runtime version upgrades to the cluster. + :vartype wave_upgrade_paused: bool + :ivar notifications: Indicates a list of notification channels for cluster events. + :vartype notifications: list[~azure.mgmt.servicefabric.models.Notification] """ _attribute_map = { @@ -1835,30 +2361,116 @@ def __init__( self, *, tags: Optional[Dict[str, str]] = None, - add_on_features: Optional[List[Union[str, "AddOnFeatures"]]] = None, - certificate: Optional["CertificateDescription"] = None, - certificate_common_names: Optional["ServerCertificateCommonNames"] = None, - client_certificate_common_names: Optional[List["ClientCertificateCommonName"]] = None, - client_certificate_thumbprints: Optional[List["ClientCertificateThumbprint"]] = None, + add_on_features: Optional[List[Union[str, "_models.AddOnFeatures"]]] = None, + certificate: Optional["_models.CertificateDescription"] = None, + certificate_common_names: Optional["_models.ServerCertificateCommonNames"] = None, + client_certificate_common_names: Optional[List["_models.ClientCertificateCommonName"]] = None, + client_certificate_thumbprints: Optional[List["_models.ClientCertificateThumbprint"]] = None, cluster_code_version: Optional[str] = None, event_store_service_enabled: Optional[bool] = None, - fabric_settings: Optional[List["SettingsSectionDescription"]] = None, - node_types: Optional[List["NodeTypeDescription"]] = None, - reliability_level: Optional[Union[str, "ReliabilityLevel"]] = None, - reverse_proxy_certificate: Optional["CertificateDescription"] = None, - upgrade_description: Optional["ClusterUpgradePolicy"] = None, - application_type_versions_cleanup_policy: Optional["ApplicationTypeVersionsCleanupPolicy"] = None, - upgrade_mode: Optional[Union[str, "UpgradeMode"]] = "Automatic", - sf_zonal_upgrade_mode: Optional[Union[str, "SfZonalUpgradeMode"]] = None, - vmss_zonal_upgrade_mode: Optional[Union[str, "VmssZonalUpgradeMode"]] = None, + fabric_settings: Optional[List["_models.SettingsSectionDescription"]] = None, + node_types: Optional[List["_models.NodeTypeDescription"]] = None, + reliability_level: Optional[Union[str, "_models.ReliabilityLevel"]] = None, + reverse_proxy_certificate: Optional["_models.CertificateDescription"] = None, + upgrade_description: Optional["_models.ClusterUpgradePolicy"] = None, + application_type_versions_cleanup_policy: Optional["_models.ApplicationTypeVersionsCleanupPolicy"] = None, + upgrade_mode: Optional[Union[str, "_models.UpgradeMode"]] = "Automatic", + sf_zonal_upgrade_mode: Optional[Union[str, "_models.SfZonalUpgradeMode"]] = None, + vmss_zonal_upgrade_mode: Optional[Union[str, "_models.VmssZonalUpgradeMode"]] = None, infrastructure_service_manager: Optional[bool] = None, - upgrade_wave: Optional[Union[str, "ClusterUpgradeCadence"]] = None, + upgrade_wave: Optional[Union[str, "_models.ClusterUpgradeCadence"]] = None, upgrade_pause_start_timestamp_utc: Optional[datetime.datetime] = None, upgrade_pause_end_timestamp_utc: Optional[datetime.datetime] = None, wave_upgrade_paused: Optional[bool] = None, - notifications: Optional[List["Notification"]] = None, + notifications: Optional[List["_models.Notification"]] = None, **kwargs ): + """ + :keyword tags: A set of tags. Cluster update parameters. + :paramtype tags: dict[str, str] + :keyword add_on_features: The list of add-on features to enable in the cluster. + :paramtype add_on_features: list[str or ~azure.mgmt.servicefabric.models.AddOnFeatures] + :keyword certificate: The certificate to use for securing the cluster. The certificate provided + will be used for node to node security within the cluster, SSL certificate for cluster + management endpoint and default admin client. + :paramtype certificate: ~azure.mgmt.servicefabric.models.CertificateDescription + :keyword certificate_common_names: Describes a list of server certificates referenced by common + name that are used to secure the cluster. + :paramtype certificate_common_names: + ~azure.mgmt.servicefabric.models.ServerCertificateCommonNames + :keyword client_certificate_common_names: The list of client certificates referenced by common + name that are allowed to manage the cluster. This will overwrite the existing list. + :paramtype client_certificate_common_names: + list[~azure.mgmt.servicefabric.models.ClientCertificateCommonName] + :keyword client_certificate_thumbprints: The list of client certificates referenced by + thumbprint that are allowed to manage the cluster. This will overwrite the existing list. + :paramtype client_certificate_thumbprints: + list[~azure.mgmt.servicefabric.models.ClientCertificateThumbprint] + :keyword cluster_code_version: The Service Fabric runtime version of the cluster. This property + can only by set the user when **upgradeMode** is set to 'Manual'. To get list of available + Service Fabric versions for new clusters use `ClusterVersion API <./ClusterVersion.md>`_. To + get the list of available version for existing clusters use **availableClusterVersions**. + :paramtype cluster_code_version: str + :keyword event_store_service_enabled: Indicates if the event store service is enabled. + :paramtype event_store_service_enabled: bool + :keyword fabric_settings: The list of custom fabric settings to configure the cluster. This + will overwrite the existing list. + :paramtype fabric_settings: list[~azure.mgmt.servicefabric.models.SettingsSectionDescription] + :keyword node_types: The list of node types in the cluster. This will overwrite the existing + list. + :paramtype node_types: list[~azure.mgmt.servicefabric.models.NodeTypeDescription] + :keyword reliability_level: The reliability level sets the replica set size of system services. + Learn about `ReliabilityLevel + `_. + + + * None - Run the System services with a target replica set count of 1. This should only be + used for test clusters. + * Bronze - Run the System services with a target replica set count of 3. This should only be + used for test clusters. + * Silver - Run the System services with a target replica set count of 5. + * Gold - Run the System services with a target replica set count of 7. + * Platinum - Run the System services with a target replica set count of 9. Known values are: + "None", "Bronze", "Silver", "Gold", "Platinum". + :paramtype reliability_level: str or ~azure.mgmt.servicefabric.models.ReliabilityLevel + :keyword reverse_proxy_certificate: The server certificate used by reverse proxy. + :paramtype reverse_proxy_certificate: ~azure.mgmt.servicefabric.models.CertificateDescription + :keyword upgrade_description: The policy to use when upgrading the cluster. + :paramtype upgrade_description: ~azure.mgmt.servicefabric.models.ClusterUpgradePolicy + :keyword application_type_versions_cleanup_policy: The policy used to clean up unused versions. + :paramtype application_type_versions_cleanup_policy: + ~azure.mgmt.servicefabric.models.ApplicationTypeVersionsCleanupPolicy + :keyword upgrade_mode: The upgrade mode of the cluster when new Service Fabric runtime version + is available. Known values are: "Automatic", "Manual". Default value: "Automatic". + :paramtype upgrade_mode: str or ~azure.mgmt.servicefabric.models.UpgradeMode + :keyword sf_zonal_upgrade_mode: This property controls the logical grouping of VMs in upgrade + domains (UDs). This property can't be modified if a node type with multiple Availability Zones + is already present in the cluster. Known values are: "Parallel", "Hierarchical". + :paramtype sf_zonal_upgrade_mode: str or ~azure.mgmt.servicefabric.models.SfZonalUpgradeMode + :keyword vmss_zonal_upgrade_mode: This property defines the upgrade mode for the virtual + machine scale set, it is mandatory if a node type with multiple Availability Zones is added. + Known values are: "Parallel", "Hierarchical". + :paramtype vmss_zonal_upgrade_mode: str or + ~azure.mgmt.servicefabric.models.VmssZonalUpgradeMode + :keyword infrastructure_service_manager: Indicates if infrastructure service manager is + enabled. + :paramtype infrastructure_service_manager: bool + :keyword upgrade_wave: Indicates when new cluster runtime version upgrades will be applied + after they are released. By default is Wave0. Only applies when **upgradeMode** is set to + 'Automatic'. Known values are: "Wave0", "Wave1", "Wave2". + :paramtype upgrade_wave: str or ~azure.mgmt.servicefabric.models.ClusterUpgradeCadence + :keyword upgrade_pause_start_timestamp_utc: The start timestamp to pause runtime version + upgrades on the cluster (UTC). + :paramtype upgrade_pause_start_timestamp_utc: ~datetime.datetime + :keyword upgrade_pause_end_timestamp_utc: The end timestamp of pause runtime version upgrades + on the cluster (UTC). + :paramtype upgrade_pause_end_timestamp_utc: ~datetime.datetime + :keyword wave_upgrade_paused: Boolean to pause automatic runtime version upgrades to the + cluster. + :paramtype wave_upgrade_paused: bool + :keyword notifications: Indicates a list of notification channels for cluster events. + :paramtype notifications: list[~azure.mgmt.servicefabric.models.Notification] + """ super(ClusterUpdateParameters, self).__init__(**kwargs) self.tags = tags self.add_on_features = add_on_features @@ -1890,31 +2502,31 @@ class ClusterUpgradeDeltaHealthPolicy(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param max_percent_delta_unhealthy_nodes: Required. The maximum allowed percentage of nodes + :ivar max_percent_delta_unhealthy_nodes: Required. The maximum allowed percentage of nodes health degradation allowed during cluster upgrades. The delta is measured between the state of the nodes at the beginning of upgrade and the state of the nodes at the time of the health evaluation. The check is performed after every upgrade domain upgrade completion to make sure the global state of the cluster is within tolerated limits. - :type max_percent_delta_unhealthy_nodes: int - :param max_percent_upgrade_domain_delta_unhealthy_nodes: Required. The maximum allowed + :vartype max_percent_delta_unhealthy_nodes: int + :ivar max_percent_upgrade_domain_delta_unhealthy_nodes: Required. The maximum allowed percentage of upgrade domain nodes health degradation allowed during cluster upgrades. The delta is measured between the state of the upgrade domain nodes at the beginning of upgrade and the state of the upgrade domain nodes at the time of the health evaluation. The check is performed after every upgrade domain upgrade completion for all completed upgrade domains to make sure the state of the upgrade domains is within tolerated limits. - :type max_percent_upgrade_domain_delta_unhealthy_nodes: int - :param max_percent_delta_unhealthy_applications: Required. The maximum allowed percentage of + :vartype max_percent_upgrade_domain_delta_unhealthy_nodes: int + :ivar max_percent_delta_unhealthy_applications: Required. The maximum allowed percentage of applications health degradation allowed during cluster upgrades. The delta is measured between the state of the applications at the beginning of upgrade and the state of the applications at the time of the health evaluation. The check is performed after every upgrade domain upgrade completion to make sure the global state of the cluster is within tolerated limits. System services are not included in this. - :type max_percent_delta_unhealthy_applications: int - :param application_delta_health_policies: Defines the application delta health policy map used + :vartype max_percent_delta_unhealthy_applications: int + :ivar application_delta_health_policies: Defines the application delta health policy map used to evaluate the health of an application or one of its child entities when upgrading the cluster. - :type application_delta_health_policies: dict[str, + :vartype application_delta_health_policies: dict[str, ~azure.mgmt.servicefabric.models.ApplicationDeltaHealthPolicy] """ @@ -1937,9 +2549,37 @@ def __init__( max_percent_delta_unhealthy_nodes: int, max_percent_upgrade_domain_delta_unhealthy_nodes: int, max_percent_delta_unhealthy_applications: int, - application_delta_health_policies: Optional[Dict[str, "ApplicationDeltaHealthPolicy"]] = None, + application_delta_health_policies: Optional[Dict[str, "_models.ApplicationDeltaHealthPolicy"]] = None, **kwargs ): + """ + :keyword max_percent_delta_unhealthy_nodes: Required. The maximum allowed percentage of nodes + health degradation allowed during cluster upgrades. + The delta is measured between the state of the nodes at the beginning of upgrade and the state + of the nodes at the time of the health evaluation. + The check is performed after every upgrade domain upgrade completion to make sure the global + state of the cluster is within tolerated limits. + :paramtype max_percent_delta_unhealthy_nodes: int + :keyword max_percent_upgrade_domain_delta_unhealthy_nodes: Required. The maximum allowed + percentage of upgrade domain nodes health degradation allowed during cluster upgrades. + The delta is measured between the state of the upgrade domain nodes at the beginning of + upgrade and the state of the upgrade domain nodes at the time of the health evaluation. + The check is performed after every upgrade domain upgrade completion for all completed upgrade + domains to make sure the state of the upgrade domains is within tolerated limits. + :paramtype max_percent_upgrade_domain_delta_unhealthy_nodes: int + :keyword max_percent_delta_unhealthy_applications: Required. The maximum allowed percentage of + applications health degradation allowed during cluster upgrades. + The delta is measured between the state of the applications at the beginning of upgrade and + the state of the applications at the time of the health evaluation. + The check is performed after every upgrade domain upgrade completion to make sure the global + state of the cluster is within tolerated limits. System services are not included in this. + :paramtype max_percent_delta_unhealthy_applications: int + :keyword application_delta_health_policies: Defines the application delta health policy map + used to evaluate the health of an application or one of its child entities when upgrading the + cluster. + :paramtype application_delta_health_policies: dict[str, + ~azure.mgmt.servicefabric.models.ApplicationDeltaHealthPolicy] + """ super(ClusterUpgradeDeltaHealthPolicy, self).__init__(**kwargs) self.max_percent_delta_unhealthy_nodes = max_percent_delta_unhealthy_nodes self.max_percent_upgrade_domain_delta_unhealthy_nodes = max_percent_upgrade_domain_delta_unhealthy_nodes @@ -1952,38 +2592,38 @@ class ClusterUpgradePolicy(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param force_restart: If true, then processes are forcefully restarted during upgrade even when + :ivar force_restart: If true, then processes are forcefully restarted during upgrade even when the code version has not changed (the upgrade only changes configuration or data). - :type force_restart: bool - :param upgrade_replica_set_check_timeout: Required. The maximum amount of time to block + :vartype force_restart: bool + :ivar upgrade_replica_set_check_timeout: Required. The maximum amount of time to block processing of an upgrade domain and prevent loss of availability when there are unexpected issues. When this timeout expires, processing of the upgrade domain will proceed regardless of availability loss issues. The timeout is reset at the start of each upgrade domain. The timeout can be in either hh:mm:ss or in d.hh:mm:ss.ms format. - :type upgrade_replica_set_check_timeout: str - :param health_check_wait_duration: Required. The length of time to wait after completing an + :vartype upgrade_replica_set_check_timeout: str + :ivar health_check_wait_duration: Required. The length of time to wait after completing an upgrade domain before performing health checks. The duration can be in either hh:mm:ss or in d.hh:mm:ss.ms format. - :type health_check_wait_duration: str - :param health_check_stable_duration: Required. The amount of time that the application or + :vartype health_check_wait_duration: str + :ivar health_check_stable_duration: Required. The amount of time that the application or cluster must remain healthy before the upgrade proceeds to the next upgrade domain. The duration can be in either hh:mm:ss or in d.hh:mm:ss.ms format. - :type health_check_stable_duration: str - :param health_check_retry_timeout: Required. The amount of time to retry health evaluation when + :vartype health_check_stable_duration: str + :ivar health_check_retry_timeout: Required. The amount of time to retry health evaluation when the application or cluster is unhealthy before the upgrade rolls back. The timeout can be in either hh:mm:ss or in d.hh:mm:ss.ms format. - :type health_check_retry_timeout: str - :param upgrade_timeout: Required. The amount of time the overall upgrade has to complete before + :vartype health_check_retry_timeout: str + :ivar upgrade_timeout: Required. The amount of time the overall upgrade has to complete before the upgrade rolls back. The timeout can be in either hh:mm:ss or in d.hh:mm:ss.ms format. - :type upgrade_timeout: str - :param upgrade_domain_timeout: Required. The amount of time each upgrade domain has to complete + :vartype upgrade_timeout: str + :ivar upgrade_domain_timeout: Required. The amount of time each upgrade domain has to complete before the upgrade rolls back. The timeout can be in either hh:mm:ss or in d.hh:mm:ss.ms format. - :type upgrade_domain_timeout: str - :param health_policy: Required. The cluster health policy used when upgrading the cluster. - :type health_policy: ~azure.mgmt.servicefabric.models.ClusterHealthPolicy - :param delta_health_policy: The cluster delta health policy used when upgrading the cluster. - :type delta_health_policy: ~azure.mgmt.servicefabric.models.ClusterUpgradeDeltaHealthPolicy + :vartype upgrade_domain_timeout: str + :ivar health_policy: Required. The cluster health policy used when upgrading the cluster. + :vartype health_policy: ~azure.mgmt.servicefabric.models.ClusterHealthPolicy + :ivar delta_health_policy: The cluster delta health policy used when upgrading the cluster. + :vartype delta_health_policy: ~azure.mgmt.servicefabric.models.ClusterUpgradeDeltaHealthPolicy """ _validation = { @@ -2017,11 +2657,47 @@ def __init__( health_check_retry_timeout: str, upgrade_timeout: str, upgrade_domain_timeout: str, - health_policy: "ClusterHealthPolicy", + health_policy: "_models.ClusterHealthPolicy", force_restart: Optional[bool] = None, - delta_health_policy: Optional["ClusterUpgradeDeltaHealthPolicy"] = None, + delta_health_policy: Optional["_models.ClusterUpgradeDeltaHealthPolicy"] = None, **kwargs ): + """ + :keyword force_restart: If true, then processes are forcefully restarted during upgrade even + when the code version has not changed (the upgrade only changes configuration or data). + :paramtype force_restart: bool + :keyword upgrade_replica_set_check_timeout: Required. The maximum amount of time to block + processing of an upgrade domain and prevent loss of availability when there are unexpected + issues. When this timeout expires, processing of the upgrade domain will proceed regardless of + availability loss issues. The timeout is reset at the start of each upgrade domain. The timeout + can be in either hh:mm:ss or in d.hh:mm:ss.ms format. + :paramtype upgrade_replica_set_check_timeout: str + :keyword health_check_wait_duration: Required. The length of time to wait after completing an + upgrade domain before performing health checks. The duration can be in either hh:mm:ss or in + d.hh:mm:ss.ms format. + :paramtype health_check_wait_duration: str + :keyword health_check_stable_duration: Required. The amount of time that the application or + cluster must remain healthy before the upgrade proceeds to the next upgrade domain. The + duration can be in either hh:mm:ss or in d.hh:mm:ss.ms format. + :paramtype health_check_stable_duration: str + :keyword health_check_retry_timeout: Required. The amount of time to retry health evaluation + when the application or cluster is unhealthy before the upgrade rolls back. The timeout can be + in either hh:mm:ss or in d.hh:mm:ss.ms format. + :paramtype health_check_retry_timeout: str + :keyword upgrade_timeout: Required. The amount of time the overall upgrade has to complete + before the upgrade rolls back. The timeout can be in either hh:mm:ss or in d.hh:mm:ss.ms + format. + :paramtype upgrade_timeout: str + :keyword upgrade_domain_timeout: Required. The amount of time each upgrade domain has to + complete before the upgrade rolls back. The timeout can be in either hh:mm:ss or in + d.hh:mm:ss.ms format. + :paramtype upgrade_domain_timeout: str + :keyword health_policy: Required. The cluster health policy used when upgrading the cluster. + :paramtype health_policy: ~azure.mgmt.servicefabric.models.ClusterHealthPolicy + :keyword delta_health_policy: The cluster delta health policy used when upgrading the cluster. + :paramtype delta_health_policy: + ~azure.mgmt.servicefabric.models.ClusterUpgradeDeltaHealthPolicy + """ super(ClusterUpgradePolicy, self).__init__(**kwargs) self.force_restart = force_restart self.upgrade_replica_set_check_timeout = upgrade_replica_set_check_timeout @@ -2037,13 +2713,13 @@ def __init__( class ClusterVersionDetails(msrest.serialization.Model): """The detail of the Service Fabric runtime version result. - :param code_version: The Service Fabric runtime version of the cluster. - :type code_version: str - :param support_expiry_utc: The date of expiry of support of the version. - :type support_expiry_utc: str - :param environment: Indicates if this version is for Windows or Linux operating system. - Possible values include: "Windows", "Linux". - :type environment: str or ~azure.mgmt.servicefabric.models.ClusterEnvironment + :ivar code_version: The Service Fabric runtime version of the cluster. + :vartype code_version: str + :ivar support_expiry_utc: The date of expiry of support of the version. + :vartype support_expiry_utc: str + :ivar environment: Indicates if this version is for Windows or Linux operating system. Known + values are: "Windows", "Linux". + :vartype environment: str or ~azure.mgmt.servicefabric.models.ClusterEnvironment """ _attribute_map = { @@ -2057,9 +2733,18 @@ def __init__( *, code_version: Optional[str] = None, support_expiry_utc: Optional[str] = None, - environment: Optional[Union[str, "ClusterEnvironment"]] = None, + environment: Optional[Union[str, "_models.ClusterEnvironment"]] = None, **kwargs ): + """ + :keyword code_version: The Service Fabric runtime version of the cluster. + :paramtype code_version: str + :keyword support_expiry_utc: The date of expiry of support of the version. + :paramtype support_expiry_utc: str + :keyword environment: Indicates if this version is for Windows or Linux operating system. Known + values are: "Windows", "Linux". + :paramtype environment: str or ~azure.mgmt.servicefabric.models.ClusterEnvironment + """ super(ClusterVersionDetails, self).__init__(**kwargs) self.code_version = code_version self.support_expiry_utc = support_expiry_utc @@ -2071,19 +2756,19 @@ class DiagnosticsStorageAccountConfig(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param storage_account_name: Required. The Azure storage account name. - :type storage_account_name: str - :param protected_account_key_name: Required. The protected diagnostics storage key name. - :type protected_account_key_name: str - :param protected_account_key_name2: The secondary protected diagnostics storage key name. If - one of the storage account keys is rotated the cluster will fallback to using the other. - :type protected_account_key_name2: str - :param blob_endpoint: Required. The blob endpoint of the azure storage account. - :type blob_endpoint: str - :param queue_endpoint: Required. The queue endpoint of the azure storage account. - :type queue_endpoint: str - :param table_endpoint: Required. The table endpoint of the azure storage account. - :type table_endpoint: str + :ivar storage_account_name: Required. The Azure storage account name. + :vartype storage_account_name: str + :ivar protected_account_key_name: Required. The protected diagnostics storage key name. + :vartype protected_account_key_name: str + :ivar protected_account_key_name2: The secondary protected diagnostics storage key name. If one + of the storage account keys is rotated the cluster will fallback to using the other. + :vartype protected_account_key_name2: str + :ivar blob_endpoint: Required. The blob endpoint of the azure storage account. + :vartype blob_endpoint: str + :ivar queue_endpoint: Required. The queue endpoint of the azure storage account. + :vartype queue_endpoint: str + :ivar table_endpoint: Required. The table endpoint of the azure storage account. + :vartype table_endpoint: str """ _validation = { @@ -2114,6 +2799,21 @@ def __init__( protected_account_key_name2: Optional[str] = None, **kwargs ): + """ + :keyword storage_account_name: Required. The Azure storage account name. + :paramtype storage_account_name: str + :keyword protected_account_key_name: Required. The protected diagnostics storage key name. + :paramtype protected_account_key_name: str + :keyword protected_account_key_name2: The secondary protected diagnostics storage key name. If + one of the storage account keys is rotated the cluster will fallback to using the other. + :paramtype protected_account_key_name2: str + :keyword blob_endpoint: Required. The blob endpoint of the azure storage account. + :paramtype blob_endpoint: str + :keyword queue_endpoint: Required. The queue endpoint of the azure storage account. + :paramtype queue_endpoint: str + :keyword table_endpoint: Required. The table endpoint of the azure storage account. + :paramtype table_endpoint: str + """ super(DiagnosticsStorageAccountConfig, self).__init__(**kwargs) self.storage_account_name = storage_account_name self.protected_account_key_name = protected_account_key_name @@ -2128,10 +2828,10 @@ class EndpointRangeDescription(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param start_port: Required. Starting port of a range of ports. - :type start_port: int - :param end_port: Required. End port of a range of ports. - :type end_port: int + :ivar start_port: Required. Starting port of a range of ports. + :vartype start_port: int + :ivar end_port: Required. End port of a range of ports. + :vartype end_port: int """ _validation = { @@ -2151,6 +2851,12 @@ def __init__( end_port: int, **kwargs ): + """ + :keyword start_port: Required. Starting port of a range of ports. + :paramtype start_port: int + :keyword end_port: Required. End port of a range of ports. + :paramtype end_port: int + """ super(EndpointRangeDescription, self).__init__(**kwargs) self.start_port = start_port self.end_port = end_port @@ -2159,8 +2865,8 @@ def __init__( class ErrorModel(msrest.serialization.Model): """The structure of the error. - :param error: The error details. - :type error: ~azure.mgmt.servicefabric.models.ErrorModelError + :ivar error: The error details. + :vartype error: ~azure.mgmt.servicefabric.models.ErrorModelError """ _attribute_map = { @@ -2170,9 +2876,13 @@ class ErrorModel(msrest.serialization.Model): def __init__( self, *, - error: Optional["ErrorModelError"] = None, + error: Optional["_models.ErrorModelError"] = None, **kwargs ): + """ + :keyword error: The error details. + :paramtype error: ~azure.mgmt.servicefabric.models.ErrorModelError + """ super(ErrorModel, self).__init__(**kwargs) self.error = error @@ -2180,10 +2890,10 @@ def __init__( class ErrorModelError(msrest.serialization.Model): """The error details. - :param code: The error code. - :type code: str - :param message: The error message. - :type message: str + :ivar code: The error code. + :vartype code: str + :ivar message: The error message. + :vartype message: str """ _attribute_map = { @@ -2198,6 +2908,12 @@ def __init__( message: Optional[str] = None, **kwargs ): + """ + :keyword code: The error code. + :paramtype code: str + :keyword message: The error message. + :paramtype message: str + """ super(ErrorModelError, self).__init__(**kwargs) self.code = code self.message = message @@ -2214,13 +2930,13 @@ class ManagedIdentity(msrest.serialization.Model): :ivar tenant_id: The tenant id of the managed identity. This property will only be provided for a system assigned identity. :vartype tenant_id: str - :param type: The type of managed identity for the resource. Possible values include: - "SystemAssigned", "UserAssigned", "SystemAssigned, UserAssigned", "None". - :type type: str or ~azure.mgmt.servicefabric.models.ManagedIdentityType - :param user_assigned_identities: The list of user identities associated with the resource. The + :ivar type: The type of managed identity for the resource. Known values are: "SystemAssigned", + "UserAssigned", "SystemAssigned, UserAssigned", "None". + :vartype type: str or ~azure.mgmt.servicefabric.models.ManagedIdentityType + :ivar user_assigned_identities: The list of user identities associated with the resource. The user identity dictionary key references will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. - :type user_assigned_identities: dict[str, + :vartype user_assigned_identities: dict[str, ~azure.mgmt.servicefabric.models.UserAssignedIdentity] """ @@ -2239,10 +2955,20 @@ class ManagedIdentity(msrest.serialization.Model): def __init__( self, *, - type: Optional[Union[str, "ManagedIdentityType"]] = None, - user_assigned_identities: Optional[Dict[str, "UserAssignedIdentity"]] = None, + type: Optional[Union[str, "_models.ManagedIdentityType"]] = None, + user_assigned_identities: Optional[Dict[str, "_models.UserAssignedIdentity"]] = None, **kwargs ): + """ + :keyword type: The type of managed identity for the resource. Known values are: + "SystemAssigned", "UserAssigned", "SystemAssigned, UserAssigned", "None". + :paramtype type: str or ~azure.mgmt.servicefabric.models.ManagedIdentityType + :keyword user_assigned_identities: The list of user identities associated with the resource. + The user identity dictionary key references will be ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + :paramtype user_assigned_identities: dict[str, + ~azure.mgmt.servicefabric.models.UserAssignedIdentity] + """ super(ManagedIdentity, self).__init__(**kwargs) self.principal_id = None self.tenant_id = None @@ -2258,9 +2984,9 @@ class PartitionSchemeDescription(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param partition_scheme: Required. Specifies how the service is partitioned.Constant filled by - server. Possible values include: "Invalid", "Singleton", "UniformInt64Range", "Named". - :type partition_scheme: str or ~azure.mgmt.servicefabric.models.PartitionScheme + :ivar partition_scheme: Required. Specifies how the service is partitioned.Constant filled by + server. Known values are: "Invalid", "Singleton", "UniformInt64Range", "Named". + :vartype partition_scheme: str or ~azure.mgmt.servicefabric.models.PartitionScheme """ _validation = { @@ -2279,6 +3005,8 @@ def __init__( self, **kwargs ): + """ + """ super(PartitionSchemeDescription, self).__init__(**kwargs) self.partition_scheme = None # type: Optional[str] @@ -2288,14 +3016,14 @@ class NamedPartitionSchemeDescription(PartitionSchemeDescription): All required parameters must be populated in order to send to Azure. - :param partition_scheme: Required. Specifies how the service is partitioned.Constant filled by - server. Possible values include: "Invalid", "Singleton", "UniformInt64Range", "Named". - :type partition_scheme: str or ~azure.mgmt.servicefabric.models.PartitionScheme - :param count: Required. The number of partitions. - :type count: int - :param names: Required. Array of size specified by the ‘count’ parameter, for the names of the + :ivar partition_scheme: Required. Specifies how the service is partitioned.Constant filled by + server. Known values are: "Invalid", "Singleton", "UniformInt64Range", "Named". + :vartype partition_scheme: str or ~azure.mgmt.servicefabric.models.PartitionScheme + :ivar count: Required. The number of partitions. + :vartype count: int + :ivar names: Required. Array of size specified by the ‘count’ parameter, for the names of the partitions. - :type names: list[str] + :vartype names: list[str] """ _validation = { @@ -2317,6 +3045,13 @@ def __init__( names: List[str], **kwargs ): + """ + :keyword count: Required. The number of partitions. + :paramtype count: int + :keyword names: Required. Array of size specified by the ‘count’ parameter, for the names of + the partitions. + :paramtype names: list[str] + """ super(NamedPartitionSchemeDescription, self).__init__(**kwargs) self.partition_scheme = 'Named' # type: str self.count = count @@ -2328,51 +3063,51 @@ class NodeTypeDescription(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The name of the node type. - :type name: str - :param placement_properties: The placement tags applied to nodes in the node type, which can be + :ivar name: Required. The name of the node type. + :vartype name: str + :ivar placement_properties: The placement tags applied to nodes in the node type, which can be used to indicate where certain services (workload) should run. - :type placement_properties: dict[str, str] - :param capacities: The capacity tags applied to the nodes in the node type, the cluster - resource manager uses these tags to understand how much resource a node has. - :type capacities: dict[str, str] - :param client_connection_endpoint_port: Required. The TCP cluster management endpoint port. - :type client_connection_endpoint_port: int - :param http_gateway_endpoint_port: Required. The HTTP cluster management endpoint port. - :type http_gateway_endpoint_port: int - :param durability_level: The durability level of the node type. Learn about `DurabilityLevel + :vartype placement_properties: dict[str, str] + :ivar capacities: The capacity tags applied to the nodes in the node type, the cluster resource + manager uses these tags to understand how much resource a node has. + :vartype capacities: dict[str, str] + :ivar client_connection_endpoint_port: Required. The TCP cluster management endpoint port. + :vartype client_connection_endpoint_port: int + :ivar http_gateway_endpoint_port: Required. The HTTP cluster management endpoint port. + :vartype http_gateway_endpoint_port: int + :ivar durability_level: The durability level of the node type. Learn about `DurabilityLevel `_. * Bronze - No privileges. This is the default. * Silver - The infrastructure jobs can be paused for a duration of 10 minutes per UD. * Gold - The infrastructure jobs can be paused for a duration of 2 hours per UD. Gold - durability can be enabled only on full node VM skus like D15_V2, G5 etc. Possible values - include: "Bronze", "Silver", "Gold". - :type durability_level: str or ~azure.mgmt.servicefabric.models.DurabilityLevel - :param application_ports: The range of ports from which cluster assigned port to Service Fabric + durability can be enabled only on full node VM skus like D15_V2, G5 etc. Known values are: + "Bronze", "Silver", "Gold". + :vartype durability_level: str or ~azure.mgmt.servicefabric.models.DurabilityLevel + :ivar application_ports: The range of ports from which cluster assigned port to Service Fabric applications. - :type application_ports: ~azure.mgmt.servicefabric.models.EndpointRangeDescription - :param ephemeral_ports: The range of ephemeral ports that nodes in this node type should be + :vartype application_ports: ~azure.mgmt.servicefabric.models.EndpointRangeDescription + :ivar ephemeral_ports: The range of ephemeral ports that nodes in this node type should be configured with. - :type ephemeral_ports: ~azure.mgmt.servicefabric.models.EndpointRangeDescription - :param is_primary: Required. The node type on which system services will run. Only one node - type should be marked as primary. Primary node type cannot be deleted or changed for existing + :vartype ephemeral_ports: ~azure.mgmt.servicefabric.models.EndpointRangeDescription + :ivar is_primary: Required. The node type on which system services will run. Only one node type + should be marked as primary. Primary node type cannot be deleted or changed for existing clusters. - :type is_primary: bool - :param vm_instance_count: Required. VMInstanceCount should be 1 to n, where n indicates the + :vartype is_primary: bool + :ivar vm_instance_count: Required. VMInstanceCount should be 1 to n, where n indicates the number of VM instances corresponding to this nodeType. VMInstanceCount = 0 can be done only in these scenarios: NodeType is a secondary nodeType. Durability = Bronze or Durability >= Bronze and InfrastructureServiceManager = true. If VMInstanceCount = 0, implies the VMs for this nodeType will not be used for the initial cluster size computation. - :type vm_instance_count: int - :param reverse_proxy_endpoint_port: The endpoint used by reverse proxy. - :type reverse_proxy_endpoint_port: int - :param is_stateless: Indicates if the node type can only host Stateless workloads. - :type is_stateless: bool - :param multiple_availability_zones: Indicates if the node type is enabled to support multiple + :vartype vm_instance_count: int + :ivar reverse_proxy_endpoint_port: The endpoint used by reverse proxy. + :vartype reverse_proxy_endpoint_port: int + :ivar is_stateless: Indicates if the node type can only host Stateless workloads. + :vartype is_stateless: bool + :ivar multiple_availability_zones: Indicates if the node type is enabled to support multiple zones. - :type multiple_availability_zones: bool + :vartype multiple_availability_zones: bool """ _validation = { @@ -2409,14 +3144,61 @@ def __init__( vm_instance_count: int, placement_properties: Optional[Dict[str, str]] = None, capacities: Optional[Dict[str, str]] = None, - durability_level: Optional[Union[str, "DurabilityLevel"]] = None, - application_ports: Optional["EndpointRangeDescription"] = None, - ephemeral_ports: Optional["EndpointRangeDescription"] = None, + durability_level: Optional[Union[str, "_models.DurabilityLevel"]] = None, + application_ports: Optional["_models.EndpointRangeDescription"] = None, + ephemeral_ports: Optional["_models.EndpointRangeDescription"] = None, reverse_proxy_endpoint_port: Optional[int] = None, is_stateless: Optional[bool] = None, multiple_availability_zones: Optional[bool] = None, **kwargs ): + """ + :keyword name: Required. The name of the node type. + :paramtype name: str + :keyword placement_properties: The placement tags applied to nodes in the node type, which can + be used to indicate where certain services (workload) should run. + :paramtype placement_properties: dict[str, str] + :keyword capacities: The capacity tags applied to the nodes in the node type, the cluster + resource manager uses these tags to understand how much resource a node has. + :paramtype capacities: dict[str, str] + :keyword client_connection_endpoint_port: Required. The TCP cluster management endpoint port. + :paramtype client_connection_endpoint_port: int + :keyword http_gateway_endpoint_port: Required. The HTTP cluster management endpoint port. + :paramtype http_gateway_endpoint_port: int + :keyword durability_level: The durability level of the node type. Learn about `DurabilityLevel + `_. + + + * Bronze - No privileges. This is the default. + * Silver - The infrastructure jobs can be paused for a duration of 10 minutes per UD. + * Gold - The infrastructure jobs can be paused for a duration of 2 hours per UD. Gold + durability can be enabled only on full node VM skus like D15_V2, G5 etc. Known values are: + "Bronze", "Silver", "Gold". + :paramtype durability_level: str or ~azure.mgmt.servicefabric.models.DurabilityLevel + :keyword application_ports: The range of ports from which cluster assigned port to Service + Fabric applications. + :paramtype application_ports: ~azure.mgmt.servicefabric.models.EndpointRangeDescription + :keyword ephemeral_ports: The range of ephemeral ports that nodes in this node type should be + configured with. + :paramtype ephemeral_ports: ~azure.mgmt.servicefabric.models.EndpointRangeDescription + :keyword is_primary: Required. The node type on which system services will run. Only one node + type should be marked as primary. Primary node type cannot be deleted or changed for existing + clusters. + :paramtype is_primary: bool + :keyword vm_instance_count: Required. VMInstanceCount should be 1 to n, where n indicates the + number of VM instances corresponding to this nodeType. VMInstanceCount = 0 can be done only in + these scenarios: NodeType is a secondary nodeType. Durability = Bronze or Durability >= Bronze + and InfrastructureServiceManager = true. If VMInstanceCount = 0, implies the VMs for this + nodeType will not be used for the initial cluster size computation. + :paramtype vm_instance_count: int + :keyword reverse_proxy_endpoint_port: The endpoint used by reverse proxy. + :paramtype reverse_proxy_endpoint_port: int + :keyword is_stateless: Indicates if the node type can only host Stateless workloads. + :paramtype is_stateless: bool + :keyword multiple_availability_zones: Indicates if the node type is enabled to support multiple + zones. + :paramtype multiple_availability_zones: bool + """ super(NodeTypeDescription, self).__init__(**kwargs) self.name = name self.placement_properties = placement_properties @@ -2438,16 +3220,16 @@ class Notification(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param is_enabled: Required. Indicates if the notification is enabled. - :type is_enabled: bool - :param notification_category: Required. The category of notification. Possible values include: + :ivar is_enabled: Required. Indicates if the notification is enabled. + :vartype is_enabled: bool + :ivar notification_category: Required. The category of notification. Known values are: "WaveProgress". - :type notification_category: str or ~azure.mgmt.servicefabric.models.NotificationCategory - :param notification_level: Required. The level of notification. Possible values include: - "Critical", "All". - :type notification_level: str or ~azure.mgmt.servicefabric.models.NotificationLevel - :param notification_targets: Required. List of targets that subscribe to the notification. - :type notification_targets: list[~azure.mgmt.servicefabric.models.NotificationTarget] + :vartype notification_category: str or ~azure.mgmt.servicefabric.models.NotificationCategory + :ivar notification_level: Required. The level of notification. Known values are: "Critical", + "All". + :vartype notification_level: str or ~azure.mgmt.servicefabric.models.NotificationLevel + :ivar notification_targets: Required. List of targets that subscribe to the notification. + :vartype notification_targets: list[~azure.mgmt.servicefabric.models.NotificationTarget] """ _validation = { @@ -2468,11 +3250,23 @@ def __init__( self, *, is_enabled: bool, - notification_category: Union[str, "NotificationCategory"], - notification_level: Union[str, "NotificationLevel"], - notification_targets: List["NotificationTarget"], + notification_category: Union[str, "_models.NotificationCategory"], + notification_level: Union[str, "_models.NotificationLevel"], + notification_targets: List["_models.NotificationTarget"], **kwargs ): + """ + :keyword is_enabled: Required. Indicates if the notification is enabled. + :paramtype is_enabled: bool + :keyword notification_category: Required. The category of notification. Known values are: + "WaveProgress". + :paramtype notification_category: str or ~azure.mgmt.servicefabric.models.NotificationCategory + :keyword notification_level: Required. The level of notification. Known values are: "Critical", + "All". + :paramtype notification_level: str or ~azure.mgmt.servicefabric.models.NotificationLevel + :keyword notification_targets: Required. List of targets that subscribe to the notification. + :paramtype notification_targets: list[~azure.mgmt.servicefabric.models.NotificationTarget] + """ super(Notification, self).__init__(**kwargs) self.is_enabled = is_enabled self.notification_category = notification_category @@ -2485,12 +3279,12 @@ class NotificationTarget(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param notification_channel: Required. The notification channel indicates the type of receivers - subscribed to the notification, either user or subscription. Possible values include: - "EmailUser", "EmailSubscription". - :type notification_channel: str or ~azure.mgmt.servicefabric.models.NotificationChannel - :param receivers: Required. List of targets that subscribe to the notification. - :type receivers: list[str] + :ivar notification_channel: Required. The notification channel indicates the type of receivers + subscribed to the notification, either user or subscription. Known values are: "EmailUser", + "EmailSubscription". + :vartype notification_channel: str or ~azure.mgmt.servicefabric.models.NotificationChannel + :ivar receivers: Required. List of targets that subscribe to the notification. + :vartype receivers: list[str] """ _validation = { @@ -2506,10 +3300,18 @@ class NotificationTarget(msrest.serialization.Model): def __init__( self, *, - notification_channel: Union[str, "NotificationChannel"], + notification_channel: Union[str, "_models.NotificationChannel"], receivers: List[str], **kwargs ): + """ + :keyword notification_channel: Required. The notification channel indicates the type of + receivers subscribed to the notification, either user or subscription. Known values are: + "EmailUser", "EmailSubscription". + :paramtype notification_channel: str or ~azure.mgmt.servicefabric.models.NotificationChannel + :keyword receivers: Required. List of targets that subscribe to the notification. + :paramtype receivers: list[str] + """ super(NotificationTarget, self).__init__(**kwargs) self.notification_channel = notification_channel self.receivers = receivers @@ -2520,8 +3322,8 @@ class OperationListResult(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param value: List of operations supported by the Service Fabric resource provider. - :type value: list[~azure.mgmt.servicefabric.models.OperationResult] + :ivar value: List of operations supported by the Service Fabric resource provider. + :vartype value: list[~azure.mgmt.servicefabric.models.OperationResult] :ivar next_link: URL to get the next set of operation list results if there are any. :vartype next_link: str """ @@ -2538,9 +3340,13 @@ class OperationListResult(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["OperationResult"]] = None, + value: Optional[List["_models.OperationResult"]] = None, **kwargs ): + """ + :keyword value: List of operations supported by the Service Fabric resource provider. + :paramtype value: list[~azure.mgmt.servicefabric.models.OperationResult] + """ super(OperationListResult, self).__init__(**kwargs) self.value = value self.next_link = None @@ -2549,16 +3355,16 @@ def __init__( class OperationResult(msrest.serialization.Model): """Available operation list result. - :param name: The name of the operation. - :type name: str - :param is_data_action: Indicates whether the operation is a data action. - :type is_data_action: bool - :param display: The object that represents the operation. - :type display: ~azure.mgmt.servicefabric.models.AvailableOperationDisplay - :param origin: Origin result. - :type origin: str - :param next_link: The URL to use for getting the next set of results. - :type next_link: str + :ivar name: The name of the operation. + :vartype name: str + :ivar is_data_action: Indicates whether the operation is a data action. + :vartype is_data_action: bool + :ivar display: The object that represents the operation. + :vartype display: ~azure.mgmt.servicefabric.models.AvailableOperationDisplay + :ivar origin: Origin result. + :vartype origin: str + :ivar next_link: The URL to use for getting the next set of results. + :vartype next_link: str """ _attribute_map = { @@ -2574,11 +3380,23 @@ def __init__( *, name: Optional[str] = None, is_data_action: Optional[bool] = None, - display: Optional["AvailableOperationDisplay"] = None, + display: Optional["_models.AvailableOperationDisplay"] = None, origin: Optional[str] = None, next_link: Optional[str] = None, **kwargs ): + """ + :keyword name: The name of the operation. + :paramtype name: str + :keyword is_data_action: Indicates whether the operation is a data action. + :paramtype is_data_action: bool + :keyword display: The object that represents the operation. + :paramtype display: ~azure.mgmt.servicefabric.models.AvailableOperationDisplay + :keyword origin: Origin result. + :paramtype origin: str + :keyword next_link: The URL to use for getting the next set of results. + :paramtype next_link: str + """ super(OperationResult, self).__init__(**kwargs) self.name = name self.is_data_action = is_data_action @@ -2592,11 +3410,10 @@ class ServerCertificateCommonName(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param certificate_common_name: Required. The common name of the server certificate. - :type certificate_common_name: str - :param certificate_issuer_thumbprint: Required. The issuer thumbprint of the server - certificate. - :type certificate_issuer_thumbprint: str + :ivar certificate_common_name: Required. The common name of the server certificate. + :vartype certificate_common_name: str + :ivar certificate_issuer_thumbprint: Required. The issuer thumbprint of the server certificate. + :vartype certificate_issuer_thumbprint: str """ _validation = { @@ -2616,6 +3433,13 @@ def __init__( certificate_issuer_thumbprint: str, **kwargs ): + """ + :keyword certificate_common_name: Required. The common name of the server certificate. + :paramtype certificate_common_name: str + :keyword certificate_issuer_thumbprint: Required. The issuer thumbprint of the server + certificate. + :paramtype certificate_issuer_thumbprint: str + """ super(ServerCertificateCommonName, self).__init__(**kwargs) self.certificate_common_name = certificate_common_name self.certificate_issuer_thumbprint = certificate_issuer_thumbprint @@ -2624,13 +3448,13 @@ def __init__( class ServerCertificateCommonNames(msrest.serialization.Model): """Describes a list of server certificates referenced by common name that are used to secure the cluster. - :param common_names: The list of server certificates referenced by common name that are used to + :ivar common_names: The list of server certificates referenced by common name that are used to secure the cluster. - :type common_names: list[~azure.mgmt.servicefabric.models.ServerCertificateCommonName] - :param x509_store_name: The local certificate store location. Possible values include: - "AddressBook", "AuthRoot", "CertificateAuthority", "Disallowed", "My", "Root", "TrustedPeople", + :vartype common_names: list[~azure.mgmt.servicefabric.models.ServerCertificateCommonName] + :ivar x509_store_name: The local certificate store location. Known values are: "AddressBook", + "AuthRoot", "CertificateAuthority", "Disallowed", "My", "Root", "TrustedPeople", "TrustedPublisher". - :type x509_store_name: str or ~azure.mgmt.servicefabric.models.StoreName + :vartype x509_store_name: str or ~azure.mgmt.servicefabric.models.StoreName """ _attribute_map = { @@ -2641,10 +3465,19 @@ class ServerCertificateCommonNames(msrest.serialization.Model): def __init__( self, *, - common_names: Optional[List["ServerCertificateCommonName"]] = None, - x509_store_name: Optional[Union[str, "StoreName"]] = None, + common_names: Optional[List["_models.ServerCertificateCommonName"]] = None, + x509_store_name: Optional[Union[str, "_models.StoreName"]] = None, **kwargs ): + """ + :keyword common_names: The list of server certificates referenced by common name that are used + to secure the cluster. + :paramtype common_names: list[~azure.mgmt.servicefabric.models.ServerCertificateCommonName] + :keyword x509_store_name: The local certificate store location. Known values are: + "AddressBook", "AuthRoot", "CertificateAuthority", "Disallowed", "My", "Root", "TrustedPeople", + "TrustedPublisher". + :paramtype x509_store_name: str or ~azure.mgmt.servicefabric.models.StoreName + """ super(ServerCertificateCommonNames, self).__init__(**kwargs) self.common_names = common_names self.x509_store_name = x509_store_name @@ -2655,13 +3488,13 @@ class ServiceCorrelationDescription(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param scheme: Required. The ServiceCorrelationScheme which describes the relationship between - this service and the service specified via ServiceName. Possible values include: "Invalid", + :ivar scheme: Required. The ServiceCorrelationScheme which describes the relationship between + this service and the service specified via ServiceName. Known values are: "Invalid", "Affinity", "AlignedAffinity", "NonAlignedAffinity". - :type scheme: str or ~azure.mgmt.servicefabric.models.ServiceCorrelationScheme - :param service_name: Required. The name of the service that the correlation relationship is + :vartype scheme: str or ~azure.mgmt.servicefabric.models.ServiceCorrelationScheme + :ivar service_name: Required. The name of the service that the correlation relationship is established with. - :type service_name: str + :vartype service_name: str """ _validation = { @@ -2677,10 +3510,19 @@ class ServiceCorrelationDescription(msrest.serialization.Model): def __init__( self, *, - scheme: Union[str, "ServiceCorrelationScheme"], + scheme: Union[str, "_models.ServiceCorrelationScheme"], service_name: str, **kwargs ): + """ + :keyword scheme: Required. The ServiceCorrelationScheme which describes the relationship + between this service and the service specified via ServiceName. Known values are: "Invalid", + "Affinity", "AlignedAffinity", "NonAlignedAffinity". + :paramtype scheme: str or ~azure.mgmt.servicefabric.models.ServiceCorrelationScheme + :keyword service_name: Required. The name of the service that the correlation relationship is + established with. + :paramtype service_name: str + """ super(ServiceCorrelationDescription, self).__init__(**kwargs) self.scheme = scheme self.service_name = service_name @@ -2691,22 +3533,22 @@ class ServiceLoadMetricDescription(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The name of the metric. If the service chooses to report load during + :ivar name: Required. The name of the metric. If the service chooses to report load during runtime, the load metric name should match the name that is specified in Name exactly. Note that metric names are case sensitive. - :type name: str - :param weight: The service load metric relative weight, compared to other metrics configured - for this service, as a number. Possible values include: "Zero", "Low", "Medium", "High". - :type weight: str or ~azure.mgmt.servicefabric.models.ServiceLoadMetricWeight - :param primary_default_load: Used only for Stateful services. The default amount of load, as a + :vartype name: str + :ivar weight: The service load metric relative weight, compared to other metrics configured for + this service, as a number. Known values are: "Zero", "Low", "Medium", "High". + :vartype weight: str or ~azure.mgmt.servicefabric.models.ServiceLoadMetricWeight + :ivar primary_default_load: Used only for Stateful services. The default amount of load, as a number, that this service creates for this metric when it is a Primary replica. - :type primary_default_load: int - :param secondary_default_load: Used only for Stateful services. The default amount of load, as - a number, that this service creates for this metric when it is a Secondary replica. - :type secondary_default_load: int - :param default_load: Used only for Stateless services. The default amount of load, as a number, + :vartype primary_default_load: int + :ivar secondary_default_load: Used only for Stateful services. The default amount of load, as a + number, that this service creates for this metric when it is a Secondary replica. + :vartype secondary_default_load: int + :ivar default_load: Used only for Stateless services. The default amount of load, as a number, that this service creates for this metric. - :type default_load: int + :vartype default_load: int """ _validation = { @@ -2725,12 +3567,30 @@ def __init__( self, *, name: str, - weight: Optional[Union[str, "ServiceLoadMetricWeight"]] = None, + weight: Optional[Union[str, "_models.ServiceLoadMetricWeight"]] = None, primary_default_load: Optional[int] = None, secondary_default_load: Optional[int] = None, 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. Known values are: "Zero", "Low", "Medium", "High". + :paramtype weight: str or ~azure.mgmt.servicefabric.models.ServiceLoadMetricWeight + :keyword primary_default_load: Used only for Stateful services. The default amount of load, as + a number, that this service creates for this metric when it is a Primary replica. + :paramtype primary_default_load: int + :keyword secondary_default_load: Used only for Stateful services. The default amount of load, + as a number, that this service creates for this metric when it is a Secondary replica. + :paramtype secondary_default_load: int + :keyword default_load: Used only for Stateless services. The default amount of load, as a + number, that this service creates for this metric. + :paramtype default_load: int + """ super(ServiceLoadMetricDescription, self).__init__(**kwargs) self.name = name self.weight = weight @@ -2747,11 +3607,11 @@ class ServicePlacementPolicyDescription(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param type: Required. The type of placement policy for a service fabric service. Following are - the possible values.Constant filled by server. Possible values include: "Invalid", - "InvalidDomain", "RequiredDomain", "PreferredPrimaryDomain", "RequiredDomainDistribution", + :ivar type: Required. The type of placement policy for a service fabric service. Following are + the possible values.Constant filled by server. Known values are: "Invalid", "InvalidDomain", + "RequiredDomain", "PreferredPrimaryDomain", "RequiredDomainDistribution", "NonPartiallyPlaceService". - :type type: str or ~azure.mgmt.servicefabric.models.ServicePlacementPolicyType + :vartype type: str or ~azure.mgmt.servicefabric.models.ServicePlacementPolicyType """ _validation = { @@ -2770,6 +3630,8 @@ def __init__( self, **kwargs ): + """ + """ super(ServicePlacementPolicyDescription, self).__init__(**kwargs) self.type = None # type: Optional[str] @@ -2785,50 +3647,52 @@ class ServiceResource(ProxyResource): :vartype name: str :ivar type: Azure resource type. :vartype type: str - :param location: It will be deprecated in New API, resource location depends on the parent + :ivar location: It will be deprecated in New API, resource location depends on the parent resource. - :type location: str - :param tags: A set of tags. Azure resource tags. - :type tags: dict[str, str] + :vartype location: str + :ivar tags: A set of tags. Azure resource tags. + :vartype tags: dict[str, str] :ivar etag: Azure resource etag. :vartype etag: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.servicefabric.models.SystemData - :param placement_constraints: The placement constraints as a string. Placement constraints are + :ivar placement_constraints: The placement constraints as a string. Placement constraints are boolean expressions on node properties and allow for restricting a service to particular nodes based on the service requirements. For example, to place a service on nodes where NodeType is blue specify the following: "NodeColor == blue)". - :type placement_constraints: str - :param correlation_scheme: A list that describes the correlation of the service with other + :vartype placement_constraints: str + :ivar correlation_scheme: A list that describes the correlation of the service with other services. - :type correlation_scheme: list[~azure.mgmt.servicefabric.models.ServiceCorrelationDescription] - :param service_load_metrics: The service load metrics is given as an array of + :vartype correlation_scheme: + list[~azure.mgmt.servicefabric.models.ServiceCorrelationDescription] + :ivar service_load_metrics: The service load metrics is given as an array of ServiceLoadMetricDescription objects. - :type service_load_metrics: list[~azure.mgmt.servicefabric.models.ServiceLoadMetricDescription] - :param service_placement_policies: A list that describes the correlation of the service with + :vartype service_load_metrics: + list[~azure.mgmt.servicefabric.models.ServiceLoadMetricDescription] + :ivar service_placement_policies: A list that describes the correlation of the service with other services. - :type service_placement_policies: + :vartype service_placement_policies: list[~azure.mgmt.servicefabric.models.ServicePlacementPolicyDescription] - :param default_move_cost: Specifies the move cost for the service. Possible values include: - "Zero", "Low", "Medium", "High". - :type default_move_cost: str or ~azure.mgmt.servicefabric.models.MoveCost + :ivar default_move_cost: Specifies the move cost for the service. Known values are: "Zero", + "Low", "Medium", "High". + :vartype default_move_cost: str or ~azure.mgmt.servicefabric.models.MoveCost :ivar provisioning_state: The current deployment or provisioning state, which only appears in the response. :vartype provisioning_state: str - :param service_kind: The kind of service (Stateless or Stateful).Constant filled by server. - Possible values include: "Invalid", "Stateless", "Stateful". - :type service_kind: str or ~azure.mgmt.servicefabric.models.ServiceKind - :param service_type_name: The name of the service type. - :type service_type_name: str - :param partition_description: Describes how the service is partitioned. - :type partition_description: ~azure.mgmt.servicefabric.models.PartitionSchemeDescription - :param service_package_activation_mode: The activation Mode of the service package. Possible - values include: "SharedProcess", "ExclusiveProcess". - :type service_package_activation_mode: str or + :ivar service_kind: The kind of service (Stateless or Stateful).Constant filled by server. + Known values are: "Invalid", "Stateless", "Stateful". + :vartype service_kind: str or ~azure.mgmt.servicefabric.models.ServiceKind + :ivar service_type_name: The name of the service type. + :vartype service_type_name: str + :ivar partition_description: Describes how the service is partitioned. + :vartype partition_description: ~azure.mgmt.servicefabric.models.PartitionSchemeDescription + :ivar service_package_activation_mode: The activation Mode of the service package. Known values + are: "SharedProcess", "ExclusiveProcess". + :vartype service_package_activation_mode: str or ~azure.mgmt.servicefabric.models.ArmServicePackageActivationMode - :param service_dns_name: Dns name used for the service. If this is specified, then the service + :ivar service_dns_name: Dns name used for the service. If this is specified, then the service can be accessed via its DNS name instead of service name. - :type service_dns_name: str + :vartype service_dns_name: str """ _validation = { @@ -2867,16 +3731,54 @@ def __init__( location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, placement_constraints: Optional[str] = None, - correlation_scheme: Optional[List["ServiceCorrelationDescription"]] = None, - service_load_metrics: Optional[List["ServiceLoadMetricDescription"]] = None, - service_placement_policies: Optional[List["ServicePlacementPolicyDescription"]] = None, - default_move_cost: Optional[Union[str, "MoveCost"]] = None, + correlation_scheme: Optional[List["_models.ServiceCorrelationDescription"]] = None, + service_load_metrics: Optional[List["_models.ServiceLoadMetricDescription"]] = None, + service_placement_policies: Optional[List["_models.ServicePlacementPolicyDescription"]] = None, + default_move_cost: Optional[Union[str, "_models.MoveCost"]] = None, service_type_name: Optional[str] = None, - partition_description: Optional["PartitionSchemeDescription"] = None, - service_package_activation_mode: Optional[Union[str, "ArmServicePackageActivationMode"]] = None, + partition_description: Optional["_models.PartitionSchemeDescription"] = None, + service_package_activation_mode: Optional[Union[str, "_models.ArmServicePackageActivationMode"]] = None, service_dns_name: Optional[str] = None, **kwargs ): + """ + :keyword location: It will be deprecated in New API, resource location depends on the parent + resource. + :paramtype location: str + :keyword tags: A set of tags. Azure resource tags. + :paramtype tags: dict[str, str] + :keyword placement_constraints: The placement constraints as a string. Placement constraints + are boolean expressions on node properties and allow for restricting a service to particular + nodes based on the service requirements. For example, to place a service on nodes where + NodeType is blue specify the following: "NodeColor == blue)". + :paramtype placement_constraints: str + :keyword correlation_scheme: A list that describes the correlation of the service with other + services. + :paramtype correlation_scheme: + list[~azure.mgmt.servicefabric.models.ServiceCorrelationDescription] + :keyword service_load_metrics: The service load metrics is given as an array of + ServiceLoadMetricDescription objects. + :paramtype service_load_metrics: + list[~azure.mgmt.servicefabric.models.ServiceLoadMetricDescription] + :keyword service_placement_policies: A list that describes the correlation of the service with + other services. + :paramtype service_placement_policies: + list[~azure.mgmt.servicefabric.models.ServicePlacementPolicyDescription] + :keyword default_move_cost: Specifies the move cost for the service. Known values are: "Zero", + "Low", "Medium", "High". + :paramtype default_move_cost: str or ~azure.mgmt.servicefabric.models.MoveCost + :keyword service_type_name: The name of the service type. + :paramtype service_type_name: str + :keyword partition_description: Describes how the service is partitioned. + :paramtype partition_description: ~azure.mgmt.servicefabric.models.PartitionSchemeDescription + :keyword service_package_activation_mode: The activation Mode of the service package. Known + values are: "SharedProcess", "ExclusiveProcess". + :paramtype service_package_activation_mode: str or + ~azure.mgmt.servicefabric.models.ArmServicePackageActivationMode + :keyword service_dns_name: Dns name used for the service. If this is specified, then the + service can be accessed via its DNS name instead of service name. + :paramtype service_dns_name: str + """ super(ServiceResource, self).__init__(location=location, tags=tags, **kwargs) self.placement_constraints = placement_constraints self.correlation_scheme = correlation_scheme @@ -2896,8 +3798,8 @@ class ServiceResourceList(msrest.serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. - :param value: - :type value: list[~azure.mgmt.servicefabric.models.ServiceResource] + :ivar value: + :vartype value: list[~azure.mgmt.servicefabric.models.ServiceResource] :ivar next_link: URL to get the next set of service list results if there are any. :vartype next_link: str """ @@ -2914,9 +3816,13 @@ class ServiceResourceList(msrest.serialization.Model): def __init__( self, *, - value: Optional[List["ServiceResource"]] = None, + value: Optional[List["_models.ServiceResource"]] = None, **kwargs ): + """ + :keyword value: + :paramtype value: list[~azure.mgmt.servicefabric.models.ServiceResource] + """ super(ServiceResourceList, self).__init__(**kwargs) self.value = value self.next_link = None @@ -2925,24 +3831,26 @@ def __init__( class ServiceResourcePropertiesBase(msrest.serialization.Model): """The common service resource properties. - :param placement_constraints: The placement constraints as a string. Placement constraints are + :ivar placement_constraints: The placement constraints as a string. Placement constraints are boolean expressions on node properties and allow for restricting a service to particular nodes based on the service requirements. For example, to place a service on nodes where NodeType is blue specify the following: "NodeColor == blue)". - :type placement_constraints: str - :param correlation_scheme: A list that describes the correlation of the service with other + :vartype placement_constraints: str + :ivar correlation_scheme: A list that describes the correlation of the service with other services. - :type correlation_scheme: list[~azure.mgmt.servicefabric.models.ServiceCorrelationDescription] - :param service_load_metrics: The service load metrics is given as an array of + :vartype correlation_scheme: + list[~azure.mgmt.servicefabric.models.ServiceCorrelationDescription] + :ivar service_load_metrics: The service load metrics is given as an array of ServiceLoadMetricDescription objects. - :type service_load_metrics: list[~azure.mgmt.servicefabric.models.ServiceLoadMetricDescription] - :param service_placement_policies: A list that describes the correlation of the service with + :vartype service_load_metrics: + list[~azure.mgmt.servicefabric.models.ServiceLoadMetricDescription] + :ivar service_placement_policies: A list that describes the correlation of the service with other services. - :type service_placement_policies: + :vartype service_placement_policies: list[~azure.mgmt.servicefabric.models.ServicePlacementPolicyDescription] - :param default_move_cost: Specifies the move cost for the service. Possible values include: - "Zero", "Low", "Medium", "High". - :type default_move_cost: str or ~azure.mgmt.servicefabric.models.MoveCost + :ivar default_move_cost: Specifies the move cost for the service. Known values are: "Zero", + "Low", "Medium", "High". + :vartype default_move_cost: str or ~azure.mgmt.servicefabric.models.MoveCost """ _attribute_map = { @@ -2957,12 +3865,34 @@ def __init__( self, *, placement_constraints: Optional[str] = None, - correlation_scheme: Optional[List["ServiceCorrelationDescription"]] = None, - service_load_metrics: Optional[List["ServiceLoadMetricDescription"]] = None, - service_placement_policies: Optional[List["ServicePlacementPolicyDescription"]] = None, - default_move_cost: Optional[Union[str, "MoveCost"]] = None, + correlation_scheme: Optional[List["_models.ServiceCorrelationDescription"]] = None, + service_load_metrics: Optional[List["_models.ServiceLoadMetricDescription"]] = None, + service_placement_policies: Optional[List["_models.ServicePlacementPolicyDescription"]] = None, + default_move_cost: Optional[Union[str, "_models.MoveCost"]] = None, **kwargs ): + """ + :keyword placement_constraints: The placement constraints as a string. Placement constraints + are boolean expressions on node properties and allow for restricting a service to particular + nodes based on the service requirements. For example, to place a service on nodes where + NodeType is blue specify the following: "NodeColor == blue)". + :paramtype placement_constraints: str + :keyword correlation_scheme: A list that describes the correlation of the service with other + services. + :paramtype correlation_scheme: + list[~azure.mgmt.servicefabric.models.ServiceCorrelationDescription] + :keyword service_load_metrics: The service load metrics is given as an array of + ServiceLoadMetricDescription objects. + :paramtype service_load_metrics: + list[~azure.mgmt.servicefabric.models.ServiceLoadMetricDescription] + :keyword service_placement_policies: A list that describes the correlation of the service with + other services. + :paramtype service_placement_policies: + list[~azure.mgmt.servicefabric.models.ServicePlacementPolicyDescription] + :keyword default_move_cost: Specifies the move cost for the service. Known values are: "Zero", + "Low", "Medium", "High". + :paramtype default_move_cost: str or ~azure.mgmt.servicefabric.models.MoveCost + """ super(ServiceResourcePropertiesBase, self).__init__(**kwargs) self.placement_constraints = placement_constraints self.correlation_scheme = correlation_scheme @@ -2981,41 +3911,43 @@ class ServiceResourceProperties(ServiceResourcePropertiesBase): All required parameters must be populated in order to send to Azure. - :param placement_constraints: The placement constraints as a string. Placement constraints are + :ivar placement_constraints: The placement constraints as a string. Placement constraints are boolean expressions on node properties and allow for restricting a service to particular nodes based on the service requirements. For example, to place a service on nodes where NodeType is blue specify the following: "NodeColor == blue)". - :type placement_constraints: str - :param correlation_scheme: A list that describes the correlation of the service with other + :vartype placement_constraints: str + :ivar correlation_scheme: A list that describes the correlation of the service with other services. - :type correlation_scheme: list[~azure.mgmt.servicefabric.models.ServiceCorrelationDescription] - :param service_load_metrics: The service load metrics is given as an array of + :vartype correlation_scheme: + list[~azure.mgmt.servicefabric.models.ServiceCorrelationDescription] + :ivar service_load_metrics: The service load metrics is given as an array of ServiceLoadMetricDescription objects. - :type service_load_metrics: list[~azure.mgmt.servicefabric.models.ServiceLoadMetricDescription] - :param service_placement_policies: A list that describes the correlation of the service with + :vartype service_load_metrics: + list[~azure.mgmt.servicefabric.models.ServiceLoadMetricDescription] + :ivar service_placement_policies: A list that describes the correlation of the service with other services. - :type service_placement_policies: + :vartype service_placement_policies: list[~azure.mgmt.servicefabric.models.ServicePlacementPolicyDescription] - :param default_move_cost: Specifies the move cost for the service. Possible values include: - "Zero", "Low", "Medium", "High". - :type default_move_cost: str or ~azure.mgmt.servicefabric.models.MoveCost + :ivar default_move_cost: Specifies the move cost for the service. Known values are: "Zero", + "Low", "Medium", "High". + :vartype default_move_cost: str or ~azure.mgmt.servicefabric.models.MoveCost :ivar provisioning_state: The current deployment or provisioning state, which only appears in the response. :vartype provisioning_state: str - :param service_kind: Required. The kind of service (Stateless or Stateful).Constant filled by - server. Possible values include: "Invalid", "Stateless", "Stateful". - :type service_kind: str or ~azure.mgmt.servicefabric.models.ServiceKind - :param service_type_name: The name of the service type. - :type service_type_name: str - :param partition_description: Describes how the service is partitioned. - :type partition_description: ~azure.mgmt.servicefabric.models.PartitionSchemeDescription - :param service_package_activation_mode: The activation Mode of the service package. Possible - values include: "SharedProcess", "ExclusiveProcess". - :type service_package_activation_mode: str or + :ivar service_kind: Required. The kind of service (Stateless or Stateful).Constant filled by + server. Known values are: "Invalid", "Stateless", "Stateful". + :vartype service_kind: str or ~azure.mgmt.servicefabric.models.ServiceKind + :ivar service_type_name: The name of the service type. + :vartype service_type_name: str + :ivar partition_description: Describes how the service is partitioned. + :vartype partition_description: ~azure.mgmt.servicefabric.models.PartitionSchemeDescription + :ivar service_package_activation_mode: The activation Mode of the service package. Known values + are: "SharedProcess", "ExclusiveProcess". + :vartype service_package_activation_mode: str or ~azure.mgmt.servicefabric.models.ArmServicePackageActivationMode - :param service_dns_name: Dns name used for the service. If this is specified, then the service + :ivar service_dns_name: Dns name used for the service. If this is specified, then the service can be accessed via its DNS name instead of service name. - :type service_dns_name: str + :vartype service_dns_name: str """ _validation = { @@ -3045,16 +3977,49 @@ def __init__( self, *, placement_constraints: Optional[str] = None, - correlation_scheme: Optional[List["ServiceCorrelationDescription"]] = None, - service_load_metrics: Optional[List["ServiceLoadMetricDescription"]] = None, - service_placement_policies: Optional[List["ServicePlacementPolicyDescription"]] = None, - default_move_cost: Optional[Union[str, "MoveCost"]] = None, + correlation_scheme: Optional[List["_models.ServiceCorrelationDescription"]] = None, + service_load_metrics: Optional[List["_models.ServiceLoadMetricDescription"]] = None, + service_placement_policies: Optional[List["_models.ServicePlacementPolicyDescription"]] = None, + default_move_cost: Optional[Union[str, "_models.MoveCost"]] = None, service_type_name: Optional[str] = None, - partition_description: Optional["PartitionSchemeDescription"] = None, - service_package_activation_mode: Optional[Union[str, "ArmServicePackageActivationMode"]] = None, + partition_description: Optional["_models.PartitionSchemeDescription"] = None, + service_package_activation_mode: Optional[Union[str, "_models.ArmServicePackageActivationMode"]] = None, service_dns_name: Optional[str] = None, **kwargs ): + """ + :keyword placement_constraints: The placement constraints as a string. Placement constraints + are boolean expressions on node properties and allow for restricting a service to particular + nodes based on the service requirements. For example, to place a service on nodes where + NodeType is blue specify the following: "NodeColor == blue)". + :paramtype placement_constraints: str + :keyword correlation_scheme: A list that describes the correlation of the service with other + services. + :paramtype correlation_scheme: + list[~azure.mgmt.servicefabric.models.ServiceCorrelationDescription] + :keyword service_load_metrics: The service load metrics is given as an array of + ServiceLoadMetricDescription objects. + :paramtype service_load_metrics: + list[~azure.mgmt.servicefabric.models.ServiceLoadMetricDescription] + :keyword service_placement_policies: A list that describes the correlation of the service with + other services. + :paramtype service_placement_policies: + list[~azure.mgmt.servicefabric.models.ServicePlacementPolicyDescription] + :keyword default_move_cost: Specifies the move cost for the service. Known values are: "Zero", + "Low", "Medium", "High". + :paramtype default_move_cost: str or ~azure.mgmt.servicefabric.models.MoveCost + :keyword service_type_name: The name of the service type. + :paramtype service_type_name: str + :keyword partition_description: Describes how the service is partitioned. + :paramtype partition_description: ~azure.mgmt.servicefabric.models.PartitionSchemeDescription + :keyword service_package_activation_mode: The activation Mode of the service package. Known + values are: "SharedProcess", "ExclusiveProcess". + :paramtype service_package_activation_mode: str or + ~azure.mgmt.servicefabric.models.ArmServicePackageActivationMode + :keyword service_dns_name: Dns name used for the service. If this is specified, then the + service can be accessed via its DNS name instead of service name. + :paramtype service_dns_name: str + """ super(ServiceResourceProperties, self).__init__(placement_constraints=placement_constraints, correlation_scheme=correlation_scheme, service_load_metrics=service_load_metrics, service_placement_policies=service_placement_policies, default_move_cost=default_move_cost, **kwargs) self.provisioning_state = None self.service_kind = 'ServiceResourceProperties' # type: str @@ -3075,36 +4040,38 @@ class ServiceResourceUpdate(ProxyResource): :vartype name: str :ivar type: Azure resource type. :vartype type: str - :param location: It will be deprecated in New API, resource location depends on the parent + :ivar location: It will be deprecated in New API, resource location depends on the parent resource. - :type location: str - :param tags: A set of tags. Azure resource tags. - :type tags: dict[str, str] + :vartype location: str + :ivar tags: A set of tags. Azure resource tags. + :vartype tags: dict[str, str] :ivar etag: Azure resource etag. :vartype etag: str :ivar system_data: Metadata pertaining to creation and last modification of the resource. :vartype system_data: ~azure.mgmt.servicefabric.models.SystemData - :param placement_constraints: The placement constraints as a string. Placement constraints are + :ivar placement_constraints: The placement constraints as a string. Placement constraints are boolean expressions on node properties and allow for restricting a service to particular nodes based on the service requirements. For example, to place a service on nodes where NodeType is blue specify the following: "NodeColor == blue)". - :type placement_constraints: str - :param correlation_scheme: A list that describes the correlation of the service with other + :vartype placement_constraints: str + :ivar correlation_scheme: A list that describes the correlation of the service with other services. - :type correlation_scheme: list[~azure.mgmt.servicefabric.models.ServiceCorrelationDescription] - :param service_load_metrics: The service load metrics is given as an array of + :vartype correlation_scheme: + list[~azure.mgmt.servicefabric.models.ServiceCorrelationDescription] + :ivar service_load_metrics: The service load metrics is given as an array of ServiceLoadMetricDescription objects. - :type service_load_metrics: list[~azure.mgmt.servicefabric.models.ServiceLoadMetricDescription] - :param service_placement_policies: A list that describes the correlation of the service with + :vartype service_load_metrics: + list[~azure.mgmt.servicefabric.models.ServiceLoadMetricDescription] + :ivar service_placement_policies: A list that describes the correlation of the service with other services. - :type service_placement_policies: + :vartype service_placement_policies: list[~azure.mgmt.servicefabric.models.ServicePlacementPolicyDescription] - :param default_move_cost: Specifies the move cost for the service. Possible values include: - "Zero", "Low", "Medium", "High". - :type default_move_cost: str or ~azure.mgmt.servicefabric.models.MoveCost - :param service_kind: The kind of service (Stateless or Stateful).Constant filled by server. - Possible values include: "Invalid", "Stateless", "Stateful". - :type service_kind: str or ~azure.mgmt.servicefabric.models.ServiceKind + :ivar default_move_cost: Specifies the move cost for the service. Known values are: "Zero", + "Low", "Medium", "High". + :vartype default_move_cost: str or ~azure.mgmt.servicefabric.models.MoveCost + :ivar service_kind: The kind of service (Stateless or Stateful).Constant filled by server. + Known values are: "Invalid", "Stateless", "Stateful". + :vartype service_kind: str or ~azure.mgmt.servicefabric.models.ServiceKind """ _validation = { @@ -3137,12 +4104,39 @@ def __init__( location: Optional[str] = None, tags: Optional[Dict[str, str]] = None, placement_constraints: Optional[str] = None, - correlation_scheme: Optional[List["ServiceCorrelationDescription"]] = None, - service_load_metrics: Optional[List["ServiceLoadMetricDescription"]] = None, - service_placement_policies: Optional[List["ServicePlacementPolicyDescription"]] = None, - default_move_cost: Optional[Union[str, "MoveCost"]] = None, + correlation_scheme: Optional[List["_models.ServiceCorrelationDescription"]] = None, + service_load_metrics: Optional[List["_models.ServiceLoadMetricDescription"]] = None, + service_placement_policies: Optional[List["_models.ServicePlacementPolicyDescription"]] = None, + default_move_cost: Optional[Union[str, "_models.MoveCost"]] = None, **kwargs ): + """ + :keyword location: It will be deprecated in New API, resource location depends on the parent + resource. + :paramtype location: str + :keyword tags: A set of tags. Azure resource tags. + :paramtype tags: dict[str, str] + :keyword placement_constraints: The placement constraints as a string. Placement constraints + are boolean expressions on node properties and allow for restricting a service to particular + nodes based on the service requirements. For example, to place a service on nodes where + NodeType is blue specify the following: "NodeColor == blue)". + :paramtype placement_constraints: str + :keyword correlation_scheme: A list that describes the correlation of the service with other + services. + :paramtype correlation_scheme: + list[~azure.mgmt.servicefabric.models.ServiceCorrelationDescription] + :keyword service_load_metrics: The service load metrics is given as an array of + ServiceLoadMetricDescription objects. + :paramtype service_load_metrics: + list[~azure.mgmt.servicefabric.models.ServiceLoadMetricDescription] + :keyword service_placement_policies: A list that describes the correlation of the service with + other services. + :paramtype service_placement_policies: + list[~azure.mgmt.servicefabric.models.ServicePlacementPolicyDescription] + :keyword default_move_cost: Specifies the move cost for the service. Known values are: "Zero", + "Low", "Medium", "High". + :paramtype default_move_cost: str or ~azure.mgmt.servicefabric.models.MoveCost + """ super(ServiceResourceUpdate, self).__init__(location=location, tags=tags, **kwargs) self.placement_constraints = placement_constraints self.correlation_scheme = correlation_scheme @@ -3160,27 +4154,29 @@ class ServiceResourceUpdateProperties(ServiceResourcePropertiesBase): All required parameters must be populated in order to send to Azure. - :param placement_constraints: The placement constraints as a string. Placement constraints are + :ivar placement_constraints: The placement constraints as a string. Placement constraints are boolean expressions on node properties and allow for restricting a service to particular nodes based on the service requirements. For example, to place a service on nodes where NodeType is blue specify the following: "NodeColor == blue)". - :type placement_constraints: str - :param correlation_scheme: A list that describes the correlation of the service with other + :vartype placement_constraints: str + :ivar correlation_scheme: A list that describes the correlation of the service with other services. - :type correlation_scheme: list[~azure.mgmt.servicefabric.models.ServiceCorrelationDescription] - :param service_load_metrics: The service load metrics is given as an array of + :vartype correlation_scheme: + list[~azure.mgmt.servicefabric.models.ServiceCorrelationDescription] + :ivar service_load_metrics: The service load metrics is given as an array of ServiceLoadMetricDescription objects. - :type service_load_metrics: list[~azure.mgmt.servicefabric.models.ServiceLoadMetricDescription] - :param service_placement_policies: A list that describes the correlation of the service with + :vartype service_load_metrics: + list[~azure.mgmt.servicefabric.models.ServiceLoadMetricDescription] + :ivar service_placement_policies: A list that describes the correlation of the service with other services. - :type service_placement_policies: + :vartype service_placement_policies: list[~azure.mgmt.servicefabric.models.ServicePlacementPolicyDescription] - :param default_move_cost: Specifies the move cost for the service. Possible values include: - "Zero", "Low", "Medium", "High". - :type default_move_cost: str or ~azure.mgmt.servicefabric.models.MoveCost - :param service_kind: Required. The kind of service (Stateless or Stateful).Constant filled by - server. Possible values include: "Invalid", "Stateless", "Stateful". - :type service_kind: str or ~azure.mgmt.servicefabric.models.ServiceKind + :ivar default_move_cost: Specifies the move cost for the service. Known values are: "Zero", + "Low", "Medium", "High". + :vartype default_move_cost: str or ~azure.mgmt.servicefabric.models.MoveCost + :ivar service_kind: Required. The kind of service (Stateless or Stateful).Constant filled by + server. Known values are: "Invalid", "Stateless", "Stateful". + :vartype service_kind: str or ~azure.mgmt.servicefabric.models.ServiceKind """ _validation = { @@ -3204,12 +4200,34 @@ def __init__( self, *, placement_constraints: Optional[str] = None, - correlation_scheme: Optional[List["ServiceCorrelationDescription"]] = None, - service_load_metrics: Optional[List["ServiceLoadMetricDescription"]] = None, - service_placement_policies: Optional[List["ServicePlacementPolicyDescription"]] = None, - default_move_cost: Optional[Union[str, "MoveCost"]] = None, + correlation_scheme: Optional[List["_models.ServiceCorrelationDescription"]] = None, + service_load_metrics: Optional[List["_models.ServiceLoadMetricDescription"]] = None, + service_placement_policies: Optional[List["_models.ServicePlacementPolicyDescription"]] = None, + default_move_cost: Optional[Union[str, "_models.MoveCost"]] = None, **kwargs ): + """ + :keyword placement_constraints: The placement constraints as a string. Placement constraints + are boolean expressions on node properties and allow for restricting a service to particular + nodes based on the service requirements. For example, to place a service on nodes where + NodeType is blue specify the following: "NodeColor == blue)". + :paramtype placement_constraints: str + :keyword correlation_scheme: A list that describes the correlation of the service with other + services. + :paramtype correlation_scheme: + list[~azure.mgmt.servicefabric.models.ServiceCorrelationDescription] + :keyword service_load_metrics: The service load metrics is given as an array of + ServiceLoadMetricDescription objects. + :paramtype service_load_metrics: + list[~azure.mgmt.servicefabric.models.ServiceLoadMetricDescription] + :keyword service_placement_policies: A list that describes the correlation of the service with + other services. + :paramtype service_placement_policies: + list[~azure.mgmt.servicefabric.models.ServicePlacementPolicyDescription] + :keyword default_move_cost: Specifies the move cost for the service. Known values are: "Zero", + "Low", "Medium", "High". + :paramtype default_move_cost: str or ~azure.mgmt.servicefabric.models.MoveCost + """ super(ServiceResourceUpdateProperties, self).__init__(placement_constraints=placement_constraints, correlation_scheme=correlation_scheme, service_load_metrics=service_load_metrics, service_placement_policies=service_placement_policies, default_move_cost=default_move_cost, **kwargs) self.service_kind = 'ServiceResourceUpdateProperties' # type: str @@ -3217,13 +4235,13 @@ def __init__( class ServiceTypeDeltaHealthPolicy(msrest.serialization.Model): """Represents the delta health policy used to evaluate the health of services belonging to a service type when upgrading the cluster. - :param max_percent_delta_unhealthy_services: The maximum allowed percentage of services health + :ivar max_percent_delta_unhealthy_services: The maximum allowed percentage of services health degradation allowed during cluster upgrades. The delta is measured between the state of the services at the beginning of upgrade and the state of the services at the time of the health evaluation. The check is performed after every upgrade domain upgrade completion to make sure the global state of the cluster is within tolerated limits. - :type max_percent_delta_unhealthy_services: int + :vartype max_percent_delta_unhealthy_services: int """ _validation = { @@ -3240,6 +4258,15 @@ def __init__( max_percent_delta_unhealthy_services: Optional[int] = 0, **kwargs ): + """ + :keyword max_percent_delta_unhealthy_services: The maximum allowed percentage of services + health degradation allowed during cluster upgrades. + The delta is measured between the state of the services at the beginning of upgrade and the + state of the services at the time of the health evaluation. + The check is performed after every upgrade domain upgrade completion to make sure the global + state of the cluster is within tolerated limits. + :paramtype max_percent_delta_unhealthy_services: int + """ super(ServiceTypeDeltaHealthPolicy, self).__init__(**kwargs) self.max_percent_delta_unhealthy_services = max_percent_delta_unhealthy_services @@ -3247,9 +4274,9 @@ def __init__( class ServiceTypeHealthPolicy(msrest.serialization.Model): """Represents the health policy used to evaluate the health of services belonging to a service type. - :param max_percent_unhealthy_services: The maximum percentage of services allowed to be + :ivar max_percent_unhealthy_services: The maximum percentage of services allowed to be unhealthy before your application is considered in error. - :type max_percent_unhealthy_services: int + :vartype max_percent_unhealthy_services: int """ _validation = { @@ -3266,6 +4293,11 @@ def __init__( max_percent_unhealthy_services: Optional[int] = 0, **kwargs ): + """ + :keyword max_percent_unhealthy_services: The maximum percentage of services allowed to be + unhealthy before your application is considered in error. + :paramtype max_percent_unhealthy_services: int + """ super(ServiceTypeHealthPolicy, self).__init__(**kwargs) self.max_percent_unhealthy_services = max_percent_unhealthy_services @@ -3275,10 +4307,10 @@ class SettingsParameterDescription(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The parameter name of fabric setting. - :type name: str - :param value: Required. The parameter value of fabric setting. - :type value: str + :ivar name: Required. The parameter name of fabric setting. + :vartype name: str + :ivar value: Required. The parameter value of fabric setting. + :vartype value: str """ _validation = { @@ -3298,6 +4330,12 @@ def __init__( value: str, **kwargs ): + """ + :keyword name: Required. The parameter name of fabric setting. + :paramtype name: str + :keyword value: Required. The parameter value of fabric setting. + :paramtype value: str + """ super(SettingsParameterDescription, self).__init__(**kwargs) self.name = name self.value = value @@ -3308,10 +4346,10 @@ class SettingsSectionDescription(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param name: Required. The section name of the fabric settings. - :type name: str - :param parameters: Required. The collection of parameters in the section. - :type parameters: list[~azure.mgmt.servicefabric.models.SettingsParameterDescription] + :ivar name: Required. The section name of the fabric settings. + :vartype name: str + :ivar parameters: Required. The collection of parameters in the section. + :vartype parameters: list[~azure.mgmt.servicefabric.models.SettingsParameterDescription] """ _validation = { @@ -3328,9 +4366,15 @@ def __init__( self, *, name: str, - parameters: List["SettingsParameterDescription"], + parameters: List["_models.SettingsParameterDescription"], **kwargs ): + """ + :keyword name: Required. The section name of the fabric settings. + :paramtype name: str + :keyword parameters: Required. The collection of parameters in the section. + :paramtype parameters: list[~azure.mgmt.servicefabric.models.SettingsParameterDescription] + """ super(SettingsSectionDescription, self).__init__(**kwargs) self.name = name self.parameters = parameters @@ -3341,9 +4385,9 @@ class SingletonPartitionSchemeDescription(PartitionSchemeDescription): All required parameters must be populated in order to send to Azure. - :param partition_scheme: Required. Specifies how the service is partitioned.Constant filled by - server. Possible values include: "Invalid", "Singleton", "UniformInt64Range", "Named". - :type partition_scheme: str or ~azure.mgmt.servicefabric.models.PartitionScheme + :ivar partition_scheme: Required. Specifies how the service is partitioned.Constant filled by + server. Known values are: "Invalid", "Singleton", "UniformInt64Range", "Named". + :vartype partition_scheme: str or ~azure.mgmt.servicefabric.models.PartitionScheme """ _validation = { @@ -3358,6 +4402,8 @@ def __init__( self, **kwargs ): + """ + """ super(SingletonPartitionSchemeDescription, self).__init__(**kwargs) self.partition_scheme = 'Singleton' # type: str @@ -3369,57 +4415,59 @@ class StatefulServiceProperties(ServiceResourceProperties): All required parameters must be populated in order to send to Azure. - :param placement_constraints: The placement constraints as a string. Placement constraints are + :ivar placement_constraints: The placement constraints as a string. Placement constraints are boolean expressions on node properties and allow for restricting a service to particular nodes based on the service requirements. For example, to place a service on nodes where NodeType is blue specify the following: "NodeColor == blue)". - :type placement_constraints: str - :param correlation_scheme: A list that describes the correlation of the service with other + :vartype placement_constraints: str + :ivar correlation_scheme: A list that describes the correlation of the service with other services. - :type correlation_scheme: list[~azure.mgmt.servicefabric.models.ServiceCorrelationDescription] - :param service_load_metrics: The service load metrics is given as an array of + :vartype correlation_scheme: + list[~azure.mgmt.servicefabric.models.ServiceCorrelationDescription] + :ivar service_load_metrics: The service load metrics is given as an array of ServiceLoadMetricDescription objects. - :type service_load_metrics: list[~azure.mgmt.servicefabric.models.ServiceLoadMetricDescription] - :param service_placement_policies: A list that describes the correlation of the service with + :vartype service_load_metrics: + list[~azure.mgmt.servicefabric.models.ServiceLoadMetricDescription] + :ivar service_placement_policies: A list that describes the correlation of the service with other services. - :type service_placement_policies: + :vartype service_placement_policies: list[~azure.mgmt.servicefabric.models.ServicePlacementPolicyDescription] - :param default_move_cost: Specifies the move cost for the service. Possible values include: - "Zero", "Low", "Medium", "High". - :type default_move_cost: str or ~azure.mgmt.servicefabric.models.MoveCost + :ivar default_move_cost: Specifies the move cost for the service. Known values are: "Zero", + "Low", "Medium", "High". + :vartype default_move_cost: str or ~azure.mgmt.servicefabric.models.MoveCost :ivar provisioning_state: The current deployment or provisioning state, which only appears in the response. :vartype provisioning_state: str - :param service_kind: Required. The kind of service (Stateless or Stateful).Constant filled by - server. Possible values include: "Invalid", "Stateless", "Stateful". - :type service_kind: str or ~azure.mgmt.servicefabric.models.ServiceKind - :param service_type_name: The name of the service type. - :type service_type_name: str - :param partition_description: Describes how the service is partitioned. - :type partition_description: ~azure.mgmt.servicefabric.models.PartitionSchemeDescription - :param service_package_activation_mode: The activation Mode of the service package. Possible - values include: "SharedProcess", "ExclusiveProcess". - :type service_package_activation_mode: str or + :ivar service_kind: Required. The kind of service (Stateless or Stateful).Constant filled by + server. Known values are: "Invalid", "Stateless", "Stateful". + :vartype service_kind: str or ~azure.mgmt.servicefabric.models.ServiceKind + :ivar service_type_name: The name of the service type. + :vartype service_type_name: str + :ivar partition_description: Describes how the service is partitioned. + :vartype partition_description: ~azure.mgmt.servicefabric.models.PartitionSchemeDescription + :ivar service_package_activation_mode: The activation Mode of the service package. Known values + are: "SharedProcess", "ExclusiveProcess". + :vartype service_package_activation_mode: str or ~azure.mgmt.servicefabric.models.ArmServicePackageActivationMode - :param service_dns_name: Dns name used for the service. If this is specified, then the service + :ivar service_dns_name: Dns name used for the service. If this is specified, then the service can be accessed via its DNS name instead of service name. - :type service_dns_name: str - :param has_persisted_state: A flag indicating whether this is a persistent service which stores + :vartype service_dns_name: str + :ivar has_persisted_state: A flag indicating whether this is a persistent service which stores states on the local disk. If it is then the value of this property is true, if not it is false. - :type has_persisted_state: bool - :param target_replica_set_size: The target replica set size as a number. - :type target_replica_set_size: int - :param min_replica_set_size: The minimum replica set size as a number. - :type min_replica_set_size: int - :param replica_restart_wait_duration: The duration between when a replica goes down and when a + :vartype has_persisted_state: bool + :ivar target_replica_set_size: The target replica set size as a number. + :vartype target_replica_set_size: int + :ivar min_replica_set_size: The minimum replica set size as a number. + :vartype min_replica_set_size: int + :ivar replica_restart_wait_duration: The duration between when a replica goes down and when a new replica is created, represented in ISO 8601 format (hh:mm:ss.s). - :type replica_restart_wait_duration: ~datetime.datetime - :param quorum_loss_wait_duration: The maximum duration for which a partition is allowed to be - in a state of quorum loss, represented in ISO 8601 format (hh:mm:ss.s). - :type quorum_loss_wait_duration: ~datetime.datetime - :param stand_by_replica_keep_duration: The definition on how long StandBy replicas should be + :vartype replica_restart_wait_duration: ~datetime.datetime + :ivar quorum_loss_wait_duration: The maximum duration for which a partition is allowed to be in + a state of quorum loss, represented in ISO 8601 format (hh:mm:ss.s). + :vartype quorum_loss_wait_duration: ~datetime.datetime + :ivar stand_by_replica_keep_duration: The definition on how long StandBy replicas should be maintained before being removed, represented in ISO 8601 format (hh:mm:ss.s). - :type stand_by_replica_keep_duration: ~datetime.datetime + :vartype stand_by_replica_keep_duration: ~datetime.datetime """ _validation = { @@ -3453,13 +4501,13 @@ def __init__( self, *, placement_constraints: Optional[str] = None, - correlation_scheme: Optional[List["ServiceCorrelationDescription"]] = None, - service_load_metrics: Optional[List["ServiceLoadMetricDescription"]] = None, - service_placement_policies: Optional[List["ServicePlacementPolicyDescription"]] = None, - default_move_cost: Optional[Union[str, "MoveCost"]] = None, + correlation_scheme: Optional[List["_models.ServiceCorrelationDescription"]] = None, + service_load_metrics: Optional[List["_models.ServiceLoadMetricDescription"]] = None, + service_placement_policies: Optional[List["_models.ServicePlacementPolicyDescription"]] = None, + default_move_cost: Optional[Union[str, "_models.MoveCost"]] = None, service_type_name: Optional[str] = None, - partition_description: Optional["PartitionSchemeDescription"] = None, - service_package_activation_mode: Optional[Union[str, "ArmServicePackageActivationMode"]] = None, + partition_description: Optional["_models.PartitionSchemeDescription"] = None, + service_package_activation_mode: Optional[Union[str, "_models.ArmServicePackageActivationMode"]] = None, service_dns_name: Optional[str] = None, has_persisted_state: Optional[bool] = None, target_replica_set_size: Optional[int] = None, @@ -3469,6 +4517,56 @@ def __init__( stand_by_replica_keep_duration: Optional[datetime.datetime] = None, **kwargs ): + """ + :keyword placement_constraints: The placement constraints as a string. Placement constraints + are boolean expressions on node properties and allow for restricting a service to particular + nodes based on the service requirements. For example, to place a service on nodes where + NodeType is blue specify the following: "NodeColor == blue)". + :paramtype placement_constraints: str + :keyword correlation_scheme: A list that describes the correlation of the service with other + services. + :paramtype correlation_scheme: + list[~azure.mgmt.servicefabric.models.ServiceCorrelationDescription] + :keyword service_load_metrics: The service load metrics is given as an array of + ServiceLoadMetricDescription objects. + :paramtype service_load_metrics: + list[~azure.mgmt.servicefabric.models.ServiceLoadMetricDescription] + :keyword service_placement_policies: A list that describes the correlation of the service with + other services. + :paramtype service_placement_policies: + list[~azure.mgmt.servicefabric.models.ServicePlacementPolicyDescription] + :keyword default_move_cost: Specifies the move cost for the service. Known values are: "Zero", + "Low", "Medium", "High". + :paramtype default_move_cost: str or ~azure.mgmt.servicefabric.models.MoveCost + :keyword service_type_name: The name of the service type. + :paramtype service_type_name: str + :keyword partition_description: Describes how the service is partitioned. + :paramtype partition_description: ~azure.mgmt.servicefabric.models.PartitionSchemeDescription + :keyword service_package_activation_mode: The activation Mode of the service package. Known + values are: "SharedProcess", "ExclusiveProcess". + :paramtype service_package_activation_mode: str or + ~azure.mgmt.servicefabric.models.ArmServicePackageActivationMode + :keyword service_dns_name: Dns name used for the service. If this is specified, then the + service can be accessed via its DNS name instead of service name. + :paramtype service_dns_name: str + :keyword has_persisted_state: A flag indicating whether this is a persistent service which + stores states on the local disk. If it is then the value of this property is true, if not it is + false. + :paramtype has_persisted_state: bool + :keyword target_replica_set_size: The target replica set size as a number. + :paramtype target_replica_set_size: int + :keyword min_replica_set_size: The minimum replica set size as a number. + :paramtype min_replica_set_size: int + :keyword replica_restart_wait_duration: The duration between when a replica goes down and when + a new replica is created, represented in ISO 8601 format (hh:mm:ss.s). + :paramtype replica_restart_wait_duration: ~datetime.datetime + :keyword quorum_loss_wait_duration: The maximum duration for which a partition is allowed to be + in a state of quorum loss, represented in ISO 8601 format (hh:mm:ss.s). + :paramtype quorum_loss_wait_duration: ~datetime.datetime + :keyword stand_by_replica_keep_duration: The definition on how long StandBy replicas should be + maintained before being removed, represented in ISO 8601 format (hh:mm:ss.s). + :paramtype stand_by_replica_keep_duration: ~datetime.datetime + """ super(StatefulServiceProperties, self).__init__(placement_constraints=placement_constraints, correlation_scheme=correlation_scheme, service_load_metrics=service_load_metrics, service_placement_policies=service_placement_policies, default_move_cost=default_move_cost, service_type_name=service_type_name, partition_description=partition_description, service_package_activation_mode=service_package_activation_mode, service_dns_name=service_dns_name, **kwargs) self.service_kind = 'Stateful' # type: str self.has_persisted_state = has_persisted_state @@ -3484,40 +4582,42 @@ class StatefulServiceUpdateProperties(ServiceResourceUpdateProperties): All required parameters must be populated in order to send to Azure. - :param placement_constraints: The placement constraints as a string. Placement constraints are + :ivar placement_constraints: The placement constraints as a string. Placement constraints are boolean expressions on node properties and allow for restricting a service to particular nodes based on the service requirements. For example, to place a service on nodes where NodeType is blue specify the following: "NodeColor == blue)". - :type placement_constraints: str - :param correlation_scheme: A list that describes the correlation of the service with other + :vartype placement_constraints: str + :ivar correlation_scheme: A list that describes the correlation of the service with other services. - :type correlation_scheme: list[~azure.mgmt.servicefabric.models.ServiceCorrelationDescription] - :param service_load_metrics: The service load metrics is given as an array of + :vartype correlation_scheme: + list[~azure.mgmt.servicefabric.models.ServiceCorrelationDescription] + :ivar service_load_metrics: The service load metrics is given as an array of ServiceLoadMetricDescription objects. - :type service_load_metrics: list[~azure.mgmt.servicefabric.models.ServiceLoadMetricDescription] - :param service_placement_policies: A list that describes the correlation of the service with + :vartype service_load_metrics: + list[~azure.mgmt.servicefabric.models.ServiceLoadMetricDescription] + :ivar service_placement_policies: A list that describes the correlation of the service with other services. - :type service_placement_policies: + :vartype service_placement_policies: list[~azure.mgmt.servicefabric.models.ServicePlacementPolicyDescription] - :param default_move_cost: Specifies the move cost for the service. Possible values include: - "Zero", "Low", "Medium", "High". - :type default_move_cost: str or ~azure.mgmt.servicefabric.models.MoveCost - :param service_kind: Required. The kind of service (Stateless or Stateful).Constant filled by - server. Possible values include: "Invalid", "Stateless", "Stateful". - :type service_kind: str or ~azure.mgmt.servicefabric.models.ServiceKind - :param target_replica_set_size: The target replica set size as a number. - :type target_replica_set_size: int - :param min_replica_set_size: The minimum replica set size as a number. - :type min_replica_set_size: int - :param replica_restart_wait_duration: The duration between when a replica goes down and when a + :ivar default_move_cost: Specifies the move cost for the service. Known values are: "Zero", + "Low", "Medium", "High". + :vartype default_move_cost: str or ~azure.mgmt.servicefabric.models.MoveCost + :ivar service_kind: Required. The kind of service (Stateless or Stateful).Constant filled by + server. Known values are: "Invalid", "Stateless", "Stateful". + :vartype service_kind: str or ~azure.mgmt.servicefabric.models.ServiceKind + :ivar target_replica_set_size: The target replica set size as a number. + :vartype target_replica_set_size: int + :ivar min_replica_set_size: The minimum replica set size as a number. + :vartype min_replica_set_size: int + :ivar replica_restart_wait_duration: The duration between when a replica goes down and when a new replica is created, represented in ISO 8601 format (hh:mm:ss.s). - :type replica_restart_wait_duration: ~datetime.datetime - :param quorum_loss_wait_duration: The maximum duration for which a partition is allowed to be - in a state of quorum loss, represented in ISO 8601 format (hh:mm:ss.s). - :type quorum_loss_wait_duration: ~datetime.datetime - :param stand_by_replica_keep_duration: The definition on how long StandBy replicas should be + :vartype replica_restart_wait_duration: ~datetime.datetime + :ivar quorum_loss_wait_duration: The maximum duration for which a partition is allowed to be in + a state of quorum loss, represented in ISO 8601 format (hh:mm:ss.s). + :vartype quorum_loss_wait_duration: ~datetime.datetime + :ivar stand_by_replica_keep_duration: The definition on how long StandBy replicas should be maintained before being removed, represented in ISO 8601 format (hh:mm:ss.s). - :type stand_by_replica_keep_duration: ~datetime.datetime + :vartype stand_by_replica_keep_duration: ~datetime.datetime """ _validation = { @@ -3544,10 +4644,10 @@ def __init__( self, *, placement_constraints: Optional[str] = None, - correlation_scheme: Optional[List["ServiceCorrelationDescription"]] = None, - service_load_metrics: Optional[List["ServiceLoadMetricDescription"]] = None, - service_placement_policies: Optional[List["ServicePlacementPolicyDescription"]] = None, - default_move_cost: Optional[Union[str, "MoveCost"]] = None, + correlation_scheme: Optional[List["_models.ServiceCorrelationDescription"]] = None, + service_load_metrics: Optional[List["_models.ServiceLoadMetricDescription"]] = None, + service_placement_policies: Optional[List["_models.ServicePlacementPolicyDescription"]] = None, + default_move_cost: Optional[Union[str, "_models.MoveCost"]] = None, target_replica_set_size: Optional[int] = None, min_replica_set_size: Optional[int] = None, replica_restart_wait_duration: Optional[datetime.datetime] = None, @@ -3555,6 +4655,41 @@ def __init__( stand_by_replica_keep_duration: Optional[datetime.datetime] = None, **kwargs ): + """ + :keyword placement_constraints: The placement constraints as a string. Placement constraints + are boolean expressions on node properties and allow for restricting a service to particular + nodes based on the service requirements. For example, to place a service on nodes where + NodeType is blue specify the following: "NodeColor == blue)". + :paramtype placement_constraints: str + :keyword correlation_scheme: A list that describes the correlation of the service with other + services. + :paramtype correlation_scheme: + list[~azure.mgmt.servicefabric.models.ServiceCorrelationDescription] + :keyword service_load_metrics: The service load metrics is given as an array of + ServiceLoadMetricDescription objects. + :paramtype service_load_metrics: + list[~azure.mgmt.servicefabric.models.ServiceLoadMetricDescription] + :keyword service_placement_policies: A list that describes the correlation of the service with + other services. + :paramtype service_placement_policies: + list[~azure.mgmt.servicefabric.models.ServicePlacementPolicyDescription] + :keyword default_move_cost: Specifies the move cost for the service. Known values are: "Zero", + "Low", "Medium", "High". + :paramtype default_move_cost: str or ~azure.mgmt.servicefabric.models.MoveCost + :keyword target_replica_set_size: The target replica set size as a number. + :paramtype target_replica_set_size: int + :keyword min_replica_set_size: The minimum replica set size as a number. + :paramtype min_replica_set_size: int + :keyword replica_restart_wait_duration: The duration between when a replica goes down and when + a new replica is created, represented in ISO 8601 format (hh:mm:ss.s). + :paramtype replica_restart_wait_duration: ~datetime.datetime + :keyword quorum_loss_wait_duration: The maximum duration for which a partition is allowed to be + in a state of quorum loss, represented in ISO 8601 format (hh:mm:ss.s). + :paramtype quorum_loss_wait_duration: ~datetime.datetime + :keyword stand_by_replica_keep_duration: The definition on how long StandBy replicas should be + maintained before being removed, represented in ISO 8601 format (hh:mm:ss.s). + :paramtype stand_by_replica_keep_duration: ~datetime.datetime + """ super(StatefulServiceUpdateProperties, self).__init__(placement_constraints=placement_constraints, correlation_scheme=correlation_scheme, service_load_metrics=service_load_metrics, service_placement_policies=service_placement_policies, default_move_cost=default_move_cost, **kwargs) self.service_kind = 'Stateful' # type: str self.target_replica_set_size = target_replica_set_size @@ -3571,51 +4706,52 @@ class StatelessServiceProperties(ServiceResourceProperties): All required parameters must be populated in order to send to Azure. - :param placement_constraints: The placement constraints as a string. Placement constraints are + :ivar placement_constraints: The placement constraints as a string. Placement constraints are boolean expressions on node properties and allow for restricting a service to particular nodes based on the service requirements. For example, to place a service on nodes where NodeType is blue specify the following: "NodeColor == blue)". - :type placement_constraints: str - :param correlation_scheme: A list that describes the correlation of the service with other + :vartype placement_constraints: str + :ivar correlation_scheme: A list that describes the correlation of the service with other services. - :type correlation_scheme: list[~azure.mgmt.servicefabric.models.ServiceCorrelationDescription] - :param service_load_metrics: The service load metrics is given as an array of + :vartype correlation_scheme: + list[~azure.mgmt.servicefabric.models.ServiceCorrelationDescription] + :ivar service_load_metrics: The service load metrics is given as an array of ServiceLoadMetricDescription objects. - :type service_load_metrics: list[~azure.mgmt.servicefabric.models.ServiceLoadMetricDescription] - :param service_placement_policies: A list that describes the correlation of the service with + :vartype service_load_metrics: + list[~azure.mgmt.servicefabric.models.ServiceLoadMetricDescription] + :ivar service_placement_policies: A list that describes the correlation of the service with other services. - :type service_placement_policies: + :vartype service_placement_policies: list[~azure.mgmt.servicefabric.models.ServicePlacementPolicyDescription] - :param default_move_cost: Specifies the move cost for the service. Possible values include: - "Zero", "Low", "Medium", "High". - :type default_move_cost: str or ~azure.mgmt.servicefabric.models.MoveCost + :ivar default_move_cost: Specifies the move cost for the service. Known values are: "Zero", + "Low", "Medium", "High". + :vartype default_move_cost: str or ~azure.mgmt.servicefabric.models.MoveCost :ivar provisioning_state: The current deployment or provisioning state, which only appears in the response. :vartype provisioning_state: str - :param service_kind: Required. The kind of service (Stateless or Stateful).Constant filled by - server. Possible values include: "Invalid", "Stateless", "Stateful". - :type service_kind: str or ~azure.mgmt.servicefabric.models.ServiceKind - :param service_type_name: The name of the service type. - :type service_type_name: str - :param partition_description: Describes how the service is partitioned. - :type partition_description: ~azure.mgmt.servicefabric.models.PartitionSchemeDescription - :param service_package_activation_mode: The activation Mode of the service package. Possible - values include: "SharedProcess", "ExclusiveProcess". - :type service_package_activation_mode: str or + :ivar service_kind: Required. The kind of service (Stateless or Stateful).Constant filled by + server. Known values are: "Invalid", "Stateless", "Stateful". + :vartype service_kind: str or ~azure.mgmt.servicefabric.models.ServiceKind + :ivar service_type_name: The name of the service type. + :vartype service_type_name: str + :ivar partition_description: Describes how the service is partitioned. + :vartype partition_description: ~azure.mgmt.servicefabric.models.PartitionSchemeDescription + :ivar service_package_activation_mode: The activation Mode of the service package. Known values + are: "SharedProcess", "ExclusiveProcess". + :vartype service_package_activation_mode: str or ~azure.mgmt.servicefabric.models.ArmServicePackageActivationMode - :param service_dns_name: Dns name used for the service. If this is specified, then the service + :ivar service_dns_name: Dns name used for the service. If this is specified, then the service can be accessed via its DNS name instead of service name. - :type service_dns_name: str - :param instance_count: The instance count. - :type instance_count: int - :param instance_close_delay_duration: Delay duration for RequestDrain feature to ensures that + :vartype service_dns_name: str + :ivar instance_count: The instance count. + :vartype instance_count: int + :ivar instance_close_delay_duration: Delay duration for RequestDrain feature to ensures that the endpoint advertised by the stateless instance is removed before the delay starts prior to closing the instance. This delay enables existing requests to drain gracefully before the instance actually goes down (https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-application-upgrade-advanced#avoid-connection-drops-during-stateless-service-planned-downtime-preview). - It is first interpreted as a string representing an ISO 8601 duration. If that fails, then it - is interpreted as a number representing the total number of milliseconds. - :type instance_close_delay_duration: str + It is represented in ISO 8601 format (hh:mm:ss.s). + :vartype instance_close_delay_duration: str """ _validation = { @@ -3644,18 +4780,60 @@ def __init__( self, *, placement_constraints: Optional[str] = None, - correlation_scheme: Optional[List["ServiceCorrelationDescription"]] = None, - service_load_metrics: Optional[List["ServiceLoadMetricDescription"]] = None, - service_placement_policies: Optional[List["ServicePlacementPolicyDescription"]] = None, - default_move_cost: Optional[Union[str, "MoveCost"]] = None, + correlation_scheme: Optional[List["_models.ServiceCorrelationDescription"]] = None, + service_load_metrics: Optional[List["_models.ServiceLoadMetricDescription"]] = None, + service_placement_policies: Optional[List["_models.ServicePlacementPolicyDescription"]] = None, + default_move_cost: Optional[Union[str, "_models.MoveCost"]] = None, service_type_name: Optional[str] = None, - partition_description: Optional["PartitionSchemeDescription"] = None, - service_package_activation_mode: Optional[Union[str, "ArmServicePackageActivationMode"]] = None, + partition_description: Optional["_models.PartitionSchemeDescription"] = None, + service_package_activation_mode: Optional[Union[str, "_models.ArmServicePackageActivationMode"]] = None, service_dns_name: Optional[str] = None, instance_count: Optional[int] = None, instance_close_delay_duration: Optional[str] = None, **kwargs ): + """ + :keyword placement_constraints: The placement constraints as a string. Placement constraints + are boolean expressions on node properties and allow for restricting a service to particular + nodes based on the service requirements. For example, to place a service on nodes where + NodeType is blue specify the following: "NodeColor == blue)". + :paramtype placement_constraints: str + :keyword correlation_scheme: A list that describes the correlation of the service with other + services. + :paramtype correlation_scheme: + list[~azure.mgmt.servicefabric.models.ServiceCorrelationDescription] + :keyword service_load_metrics: The service load metrics is given as an array of + ServiceLoadMetricDescription objects. + :paramtype service_load_metrics: + list[~azure.mgmt.servicefabric.models.ServiceLoadMetricDescription] + :keyword service_placement_policies: A list that describes the correlation of the service with + other services. + :paramtype service_placement_policies: + list[~azure.mgmt.servicefabric.models.ServicePlacementPolicyDescription] + :keyword default_move_cost: Specifies the move cost for the service. Known values are: "Zero", + "Low", "Medium", "High". + :paramtype default_move_cost: str or ~azure.mgmt.servicefabric.models.MoveCost + :keyword service_type_name: The name of the service type. + :paramtype service_type_name: str + :keyword partition_description: Describes how the service is partitioned. + :paramtype partition_description: ~azure.mgmt.servicefabric.models.PartitionSchemeDescription + :keyword service_package_activation_mode: The activation Mode of the service package. Known + values are: "SharedProcess", "ExclusiveProcess". + :paramtype service_package_activation_mode: str or + ~azure.mgmt.servicefabric.models.ArmServicePackageActivationMode + :keyword service_dns_name: Dns name used for the service. If this is specified, then the + service can be accessed via its DNS name instead of service name. + :paramtype service_dns_name: str + :keyword instance_count: The instance count. + :paramtype instance_count: int + :keyword instance_close_delay_duration: Delay duration for RequestDrain feature to ensures that + the endpoint advertised by the stateless instance is removed before the delay starts prior to + closing the instance. This delay enables existing requests to drain gracefully before the + instance actually goes down + (https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-application-upgrade-advanced#avoid-connection-drops-during-stateless-service-planned-downtime-preview). + It is represented in ISO 8601 format (hh:mm:ss.s). + :paramtype instance_close_delay_duration: str + """ super(StatelessServiceProperties, self).__init__(placement_constraints=placement_constraints, correlation_scheme=correlation_scheme, service_load_metrics=service_load_metrics, service_placement_policies=service_placement_policies, default_move_cost=default_move_cost, service_type_name=service_type_name, partition_description=partition_description, service_package_activation_mode=service_package_activation_mode, service_dns_name=service_dns_name, **kwargs) self.service_kind = 'Stateless' # type: str self.instance_count = instance_count @@ -3667,37 +4845,39 @@ class StatelessServiceUpdateProperties(ServiceResourceUpdateProperties): All required parameters must be populated in order to send to Azure. - :param placement_constraints: The placement constraints as a string. Placement constraints are + :ivar placement_constraints: The placement constraints as a string. Placement constraints are boolean expressions on node properties and allow for restricting a service to particular nodes based on the service requirements. For example, to place a service on nodes where NodeType is blue specify the following: "NodeColor == blue)". - :type placement_constraints: str - :param correlation_scheme: A list that describes the correlation of the service with other + :vartype placement_constraints: str + :ivar correlation_scheme: A list that describes the correlation of the service with other services. - :type correlation_scheme: list[~azure.mgmt.servicefabric.models.ServiceCorrelationDescription] - :param service_load_metrics: The service load metrics is given as an array of + :vartype correlation_scheme: + list[~azure.mgmt.servicefabric.models.ServiceCorrelationDescription] + :ivar service_load_metrics: The service load metrics is given as an array of ServiceLoadMetricDescription objects. - :type service_load_metrics: list[~azure.mgmt.servicefabric.models.ServiceLoadMetricDescription] - :param service_placement_policies: A list that describes the correlation of the service with + :vartype service_load_metrics: + list[~azure.mgmt.servicefabric.models.ServiceLoadMetricDescription] + :ivar service_placement_policies: A list that describes the correlation of the service with other services. - :type service_placement_policies: + :vartype service_placement_policies: list[~azure.mgmt.servicefabric.models.ServicePlacementPolicyDescription] - :param default_move_cost: Specifies the move cost for the service. Possible values include: - "Zero", "Low", "Medium", "High". - :type default_move_cost: str or ~azure.mgmt.servicefabric.models.MoveCost - :param service_kind: Required. The kind of service (Stateless or Stateful).Constant filled by - server. Possible values include: "Invalid", "Stateless", "Stateful". - :type service_kind: str or ~azure.mgmt.servicefabric.models.ServiceKind - :param instance_count: The instance count. - :type instance_count: int - :param instance_close_delay_duration: Delay duration for RequestDrain feature to ensures that + :ivar default_move_cost: Specifies the move cost for the service. Known values are: "Zero", + "Low", "Medium", "High". + :vartype default_move_cost: str or ~azure.mgmt.servicefabric.models.MoveCost + :ivar service_kind: Required. The kind of service (Stateless or Stateful).Constant filled by + server. Known values are: "Invalid", "Stateless", "Stateful". + :vartype service_kind: str or ~azure.mgmt.servicefabric.models.ServiceKind + :ivar instance_count: The instance count. + :vartype instance_count: int + :ivar instance_close_delay_duration: Delay duration for RequestDrain feature to ensures that the endpoint advertised by the stateless instance is removed before the delay starts prior to closing the instance. This delay enables existing requests to drain gracefully before the instance actually goes down (https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-application-upgrade-advanced#avoid-connection-drops-during-stateless-service-planned-downtime-preview). - It is first interpreted as a string representing an ISO 8601 duration. If that fails, then it - is interpreted as a number representing the total number of milliseconds. - :type instance_close_delay_duration: str + It is first interpreted as a string representing an ISO 8601 duration. It is represented in ISO + 8601 format (hh:mm:ss.s). + :vartype instance_close_delay_duration: str """ _validation = { @@ -3720,14 +4900,46 @@ def __init__( self, *, placement_constraints: Optional[str] = None, - correlation_scheme: Optional[List["ServiceCorrelationDescription"]] = None, - service_load_metrics: Optional[List["ServiceLoadMetricDescription"]] = None, - service_placement_policies: Optional[List["ServicePlacementPolicyDescription"]] = None, - default_move_cost: Optional[Union[str, "MoveCost"]] = None, + correlation_scheme: Optional[List["_models.ServiceCorrelationDescription"]] = None, + service_load_metrics: Optional[List["_models.ServiceLoadMetricDescription"]] = None, + service_placement_policies: Optional[List["_models.ServicePlacementPolicyDescription"]] = None, + default_move_cost: Optional[Union[str, "_models.MoveCost"]] = None, instance_count: Optional[int] = None, instance_close_delay_duration: Optional[str] = None, **kwargs ): + """ + :keyword placement_constraints: The placement constraints as a string. Placement constraints + are boolean expressions on node properties and allow for restricting a service to particular + nodes based on the service requirements. For example, to place a service on nodes where + NodeType is blue specify the following: "NodeColor == blue)". + :paramtype placement_constraints: str + :keyword correlation_scheme: A list that describes the correlation of the service with other + services. + :paramtype correlation_scheme: + list[~azure.mgmt.servicefabric.models.ServiceCorrelationDescription] + :keyword service_load_metrics: The service load metrics is given as an array of + ServiceLoadMetricDescription objects. + :paramtype service_load_metrics: + list[~azure.mgmt.servicefabric.models.ServiceLoadMetricDescription] + :keyword service_placement_policies: A list that describes the correlation of the service with + other services. + :paramtype service_placement_policies: + list[~azure.mgmt.servicefabric.models.ServicePlacementPolicyDescription] + :keyword default_move_cost: Specifies the move cost for the service. Known values are: "Zero", + "Low", "Medium", "High". + :paramtype default_move_cost: str or ~azure.mgmt.servicefabric.models.MoveCost + :keyword instance_count: The instance count. + :paramtype instance_count: int + :keyword instance_close_delay_duration: Delay duration for RequestDrain feature to ensures that + the endpoint advertised by the stateless instance is removed before the delay starts prior to + closing the instance. This delay enables existing requests to drain gracefully before the + instance actually goes down + (https://docs.microsoft.com/en-us/azure/service-fabric/service-fabric-application-upgrade-advanced#avoid-connection-drops-during-stateless-service-planned-downtime-preview). + It is first interpreted as a string representing an ISO 8601 duration. It is represented in ISO + 8601 format (hh:mm:ss.s). + :paramtype instance_close_delay_duration: str + """ super(StatelessServiceUpdateProperties, self).__init__(placement_constraints=placement_constraints, correlation_scheme=correlation_scheme, service_load_metrics=service_load_metrics, service_placement_policies=service_placement_policies, default_move_cost=default_move_cost, **kwargs) self.service_kind = 'Stateless' # type: str self.instance_count = instance_count @@ -3737,18 +4949,18 @@ def __init__( class SystemData(msrest.serialization.Model): """Metadata pertaining to creation and last modification of the resource. - :param created_by: The identity that created the resource. - :type created_by: str - :param created_by_type: The type of identity that created the resource. - :type created_by_type: str - :param created_at: The timestamp of resource creation (UTC). - :type created_at: ~datetime.datetime - :param last_modified_by: The identity that last modified the resource. - :type last_modified_by: str - :param last_modified_by_type: The type of identity that last modified the resource. - :type last_modified_by_type: str - :param last_modified_at: The timestamp of resource last modification (UTC). - :type last_modified_at: ~datetime.datetime + :ivar created_by: The identity that created the resource. + :vartype created_by: str + :ivar created_by_type: The type of identity that created the resource. + :vartype created_by_type: str + :ivar created_at: The timestamp of resource creation (UTC). + :vartype created_at: ~datetime.datetime + :ivar last_modified_by: The identity that last modified the resource. + :vartype last_modified_by: str + :ivar last_modified_by_type: The type of identity that last modified the resource. + :vartype last_modified_by_type: str + :ivar last_modified_at: The timestamp of resource last modification (UTC). + :vartype last_modified_at: ~datetime.datetime """ _attribute_map = { @@ -3771,6 +4983,20 @@ def __init__( last_modified_at: Optional[datetime.datetime] = None, **kwargs ): + """ + :keyword created_by: The identity that created the resource. + :paramtype created_by: str + :keyword created_by_type: The type of identity that created the resource. + :paramtype created_by_type: str + :keyword created_at: The timestamp of resource creation (UTC). + :paramtype created_at: ~datetime.datetime + :keyword last_modified_by: The identity that last modified the resource. + :paramtype last_modified_by: str + :keyword last_modified_by_type: The type of identity that last modified the resource. + :paramtype last_modified_by_type: str + :keyword last_modified_at: The timestamp of resource last modification (UTC). + :paramtype last_modified_at: ~datetime.datetime + """ super(SystemData, self).__init__(**kwargs) self.created_by = created_by self.created_by_type = created_by_type @@ -3785,17 +5011,17 @@ class UniformInt64RangePartitionSchemeDescription(PartitionSchemeDescription): All required parameters must be populated in order to send to Azure. - :param partition_scheme: Required. Specifies how the service is partitioned.Constant filled by - server. Possible values include: "Invalid", "Singleton", "UniformInt64Range", "Named". - :type partition_scheme: str or ~azure.mgmt.servicefabric.models.PartitionScheme - :param count: Required. The number of partitions. - :type count: int - :param low_key: Required. String indicating the lower bound of the partition key range that + :ivar partition_scheme: Required. Specifies how the service is partitioned.Constant filled by + server. Known values are: "Invalid", "Singleton", "UniformInt64Range", "Named". + :vartype partition_scheme: str or ~azure.mgmt.servicefabric.models.PartitionScheme + :ivar count: Required. The number of partitions. + :vartype count: int + :ivar low_key: Required. String indicating the lower bound of the partition key range that should be split between the partition ‘count’. - :type low_key: str - :param high_key: Required. String indicating the upper bound of the partition key range that + :vartype low_key: str + :ivar high_key: Required. String indicating the upper bound of the partition key range that should be split between the partition ‘count’. - :type high_key: str + :vartype high_key: str """ _validation = { @@ -3820,6 +5046,16 @@ def __init__( high_key: str, **kwargs ): + """ + :keyword count: Required. The number of partitions. + :paramtype count: int + :keyword low_key: Required. String indicating the lower bound of the partition key range that + should be split between the partition ‘count’. + :paramtype low_key: str + :keyword high_key: Required. String indicating the upper bound of the partition key range that + should be split between the partition ‘count’. + :paramtype high_key: str + """ super(UniformInt64RangePartitionSchemeDescription, self).__init__(**kwargs) self.partition_scheme = 'UniformInt64Range' # type: str self.count = count @@ -3830,8 +5066,8 @@ def __init__( class UpgradableVersionPathResult(msrest.serialization.Model): """The list of intermediate cluster code versions for an upgrade or downgrade. Or minimum and maximum upgradable version if no target was given. - :param supported_path: - :type supported_path: list[str] + :ivar supported_path: + :vartype supported_path: list[str] """ _attribute_map = { @@ -3844,6 +5080,10 @@ def __init__( supported_path: Optional[List[str]] = None, **kwargs ): + """ + :keyword supported_path: + :paramtype supported_path: list[str] + """ super(UpgradableVersionPathResult, self).__init__(**kwargs) self.supported_path = supported_path @@ -3853,8 +5093,8 @@ class UpgradableVersionsDescription(msrest.serialization.Model): All required parameters must be populated in order to send to Azure. - :param target_version: Required. The target code version. - :type target_version: str + :ivar target_version: Required. The target code version. + :vartype target_version: str """ _validation = { @@ -3871,6 +5111,10 @@ def __init__( target_version: str, **kwargs ): + """ + :keyword target_version: Required. The target code version. + :paramtype target_version: str + """ super(UpgradableVersionsDescription, self).__init__(**kwargs) self.target_version = target_version @@ -3900,6 +5144,8 @@ def __init__( self, **kwargs ): + """ + """ super(UserAssignedIdentity, self).__init__(**kwargs) self.principal_id = None self.client_id = None diff --git a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/models/_patch.py b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/models/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/models/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/models/_service_fabric_management_client_enums.py b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/models/_service_fabric_management_client_enums.py index 7633d775047e..2f2d5d6b146e 100644 --- a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/models/_service_fabric_management_client_enums.py +++ b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/models/_service_fabric_management_client_enums.py @@ -6,27 +6,11 @@ # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from enum import Enum, EnumMeta -from six import with_metaclass - -class _CaseInsensitiveEnumMeta(EnumMeta): - def __getitem__(self, name): - return super().__getitem__(name.upper()) - - def __getattr__(cls, name): - """Return the enum member matching `name` - We use __getattr__ instead of descriptors or inserting into the enum - class' __dict__ in order to support `name` and `value` being both - properties for enum members (which live in the class' __dict__) and - enum members themselves. - """ - try: - return cls._member_map_[name.upper()] - except KeyError: - raise AttributeError(name) - - -class AddOnFeatures(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +from enum import Enum +from azure.core import CaseInsensitiveEnumMeta + + +class AddOnFeatures(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Available cluster add-on features """ @@ -35,7 +19,7 @@ class AddOnFeatures(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): BACKUP_RESTORE_SERVICE = "BackupRestoreService" RESOURCE_MONITOR_SERVICE = "ResourceMonitorService" -class ArmServicePackageActivationMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ArmServicePackageActivationMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The activation Mode of the service package """ @@ -44,7 +28,7 @@ class ArmServicePackageActivationMode(with_metaclass(_CaseInsensitiveEnumMeta, s #: Indicates the application package activation mode will use exclusive process. EXCLUSIVE_PROCESS = "ExclusiveProcess" -class ArmUpgradeFailureAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ArmUpgradeFailureAction(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The activation Mode of the service package """ @@ -55,14 +39,14 @@ class ArmUpgradeFailureAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum #: fails. Service Fabric will not proceed to the next upgrade domain automatically. MANUAL = "Manual" -class ClusterEnvironment(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ClusterEnvironment(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Cluster operating system, the default will be Windows """ WINDOWS = "Windows" LINUX = "Linux" -class ClusterState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ClusterState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The current state of the cluster. @@ -98,7 +82,7 @@ class ClusterState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): AUTO_SCALE = "AutoScale" READY = "Ready" -class ClusterUpgradeCadence(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ClusterUpgradeCadence(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Indicates when new cluster runtime version upgrades will be applied after they are released. By default is Wave0. """ @@ -113,7 +97,12 @@ class ClusterUpgradeCadence(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)) #: clusters. WAVE2 = "Wave2" -class DurabilityLevel(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ClusterVersionsEnvironment(str, Enum, metaclass=CaseInsensitiveEnumMeta): + + WINDOWS = "Windows" + LINUX = "Linux" + +class DurabilityLevel(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The durability level of the node type. Learn about `DurabilityLevel `_. @@ -128,12 +117,7 @@ class DurabilityLevel(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): SILVER = "Silver" GOLD = "Gold" -class Enum14(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - - WINDOWS = "Windows" - LINUX = "Linux" - -class ManagedIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ManagedIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of managed identity for the resource. """ @@ -147,7 +131,7 @@ class ManagedIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: Indicates that no identity is associated with the resource. NONE = "None" -class MoveCost(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class MoveCost(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Specifies the move cost for the service. """ @@ -160,14 +144,14 @@ class MoveCost(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: Specifies the move cost of the service as High. The value is 3. HIGH = "High" -class NotificationCategory(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class NotificationCategory(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The category of notification. """ #: Notification will be regarding wave progress. WAVE_PROGRESS = "WaveProgress" -class NotificationChannel(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class NotificationChannel(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The notification channel indicates the type of receivers subscribed to the notification, either user or subscription. """ @@ -180,7 +164,7 @@ class NotificationChannel(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: notifications. EMAIL_SUBSCRIPTION = "EmailSubscription" -class NotificationLevel(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class NotificationLevel(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The level of notification. """ @@ -189,7 +173,7 @@ class NotificationLevel(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: Receive all notifications. ALL = "All" -class PartitionScheme(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class PartitionScheme(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Enumerates the ways that a service can be partitioned. """ @@ -206,7 +190,7 @@ class PartitionScheme(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: object. The value is 3. NAMED = "Named" -class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The provisioning state of the cluster resource. """ @@ -215,7 +199,7 @@ class ProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): FAILED = "Failed" CANCELED = "Canceled" -class ReliabilityLevel(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ReliabilityLevel(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The reliability level sets the replica set size of system services. Learn about `ReliabilityLevel `_. @@ -236,7 +220,7 @@ class ReliabilityLevel(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): GOLD = "Gold" PLATINUM = "Platinum" -class RollingUpgradeMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class RollingUpgradeMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The mode used to monitor health during a rolling upgrade. The values are UnmonitoredAuto, UnmonitoredManual, and Monitored. """ @@ -254,7 +238,7 @@ class RollingUpgradeMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: before proceeding. The value is 3. MONITORED = "Monitored" -class ServiceCorrelationScheme(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ServiceCorrelationScheme(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The service correlation scheme. """ @@ -273,7 +257,7 @@ class ServiceCorrelationScheme(with_metaclass(_CaseInsensitiveEnumMeta, str, Enu #: be collocated. The value is 3. NON_ALIGNED_AFFINITY = "NonAlignedAffinity" -class ServiceKind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ServiceKind(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The kind of service (Stateless or Stateful). """ @@ -286,7 +270,7 @@ class ServiceKind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: value is 2. STATEFUL = "Stateful" -class ServiceLoadMetricWeight(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ServiceLoadMetricWeight(str, Enum, metaclass=CaseInsensitiveEnumMeta): """Determines the metric weight relative to the other metrics that are configured for this service. During runtime, if two metrics end up in conflict, the Cluster Resource Manager prefers the metric with the higher weight. @@ -301,7 +285,7 @@ class ServiceLoadMetricWeight(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum #: Specifies the metric weight of the service load as High. The value is 3. HIGH = "High" -class ServicePlacementPolicyType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class ServicePlacementPolicyType(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The type of placement policy for a service fabric service. Following are the possible values. """ @@ -331,7 +315,7 @@ class ServicePlacementPolicyType(with_metaclass(_CaseInsensitiveEnumMeta, str, E #: replicas of a particular partition of the service should be placed atomically. The value is 5. NON_PARTIALLY_PLACE_SERVICE = "NonPartiallyPlaceService" -class SfZonalUpgradeMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class SfZonalUpgradeMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """This property controls the logical grouping of VMs in upgrade domains (UDs). This property can't be modified if a node type with multiple Availability Zones is already present in the cluster. @@ -348,7 +332,7 @@ class SfZonalUpgradeMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: zone. This update process is safer for the cluster and the user application. HIERARCHICAL = "Hierarchical" -class StoreName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class StoreName(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The local certificate store location. """ @@ -361,7 +345,7 @@ class StoreName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): TRUSTED_PEOPLE = "TrustedPeople" TRUSTED_PUBLISHER = "TrustedPublisher" -class UpgradeMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class UpgradeMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """The upgrade mode of the cluster when new Service Fabric runtime version is available. """ @@ -372,7 +356,7 @@ class UpgradeMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): #: The cluster is upgraded by setting the **clusterCodeVersion** property in the cluster resource. MANUAL = "Manual" -class VmssZonalUpgradeMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): +class VmssZonalUpgradeMode(str, Enum, metaclass=CaseInsensitiveEnumMeta): """This property defines the upgrade mode for the virtual machine scale set, it is mandatory if a node type with multiple Availability Zones is added. """ diff --git a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/operations/__init__.py b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/operations/__init__.py index dd0e1c0084f7..82604b38fded 100644 --- a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/operations/__init__.py +++ b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/operations/__init__.py @@ -14,6 +14,9 @@ from ._applications_operations import ApplicationsOperations from ._services_operations import ServicesOperations +from ._patch import __all__ as _patch_all +from ._patch import * # type: ignore # pylint: disable=unused-wildcard-import +from ._patch import patch_sdk as _patch_sdk __all__ = [ 'ClustersOperations', 'ClusterVersionsOperations', @@ -23,3 +26,5 @@ 'ApplicationsOperations', 'ServicesOperations', ] +__all__.extend([p for p in _patch_all if p not in __all__]) +_patch_sdk() \ No newline at end of file diff --git a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/operations/_application_type_versions_operations.py b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/operations/_application_type_versions_operations.py index 8c05d77f7518..209496bc3ef5 100644 --- a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/operations/_application_type_versions_operations.py +++ b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/operations/_application_type_versions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,56 +6,226 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +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: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}/versions/{version}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "applicationTypeName": _SERIALIZER.url("application_type_name", application_type_name, 'str'), + "version": _SERIALIZER.url("version", version, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_params, + headers=_headers, + **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: Optional[_models.ApplicationTypeVersionResource] = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}/versions/{version}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "applicationTypeName": _SERIALIZER.url("application_type_name", application_type_name, 'str'), + "version": _SERIALIZER.url("version", version, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + if content_type is not None: + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_params, + headers=_headers, + 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: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}/versions/{version}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "applicationTypeName": _SERIALIZER.url("application_type_name", application_type_name, 'str'), + "version": _SERIALIZER.url("version", version, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + application_type_name: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}/versions") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "applicationTypeName": _SERIALIZER.url("application_type_name", application_type_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + +class ApplicationTypeVersionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -class ApplicationTypeVersionsOperations(object): - """ApplicationTypeVersionsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.servicefabric.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. + Instead, you should access the following operations through + :class:`~azure.mgmt.servicefabric.ServiceFabricManagementClient`'s + :attr:`application_type_versions` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace def get( self, - resource_group_name, # type: str - cluster_name, # type: str - application_type_name, # type: str - version, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ApplicationTypeVersionResource" + resource_group_name: str, + cluster_name: str, + application_type_name: str, + version: str, + **kwargs: Any + ) -> _models.ApplicationTypeVersionResource: """Gets a Service Fabric application type version resource. Get a Service Fabric application type version resource created or in the process of being @@ -73,40 +244,42 @@ def get( :rtype: ~azure.mgmt.servicefabric.models.ApplicationTypeVersionResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationTypeVersionResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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') + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ApplicationTypeVersionResource] + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_type_name=application_type_name, + version=version, + api_version=api_version, + template_url=self.get.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ApplicationTypeVersionResource', pipeline_response) @@ -115,58 +288,59 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}/versions/{version}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}/versions/{version}"} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - cluster_name, # type: str - application_type_name, # type: str - version, # type: str - parameters, # type: "_models.ApplicationTypeVersionResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.ApplicationTypeVersionResource" - cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationTypeVersionResource"] + resource_group_name: str, + cluster_name: str, + application_type_name: str, + version: str, + parameters: _models.ApplicationTypeVersionResource, + **kwargs: Any + ) -> _models.ApplicationTypeVersionResource: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'applicationTypeName': self._serialize.url("application_type_name", application_type_name, 'str'), - 'version': self._serialize.url("version", version, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ApplicationTypeVersionResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ApplicationTypeVersionResource] + + _json = self._serialize.body(parameters, 'ApplicationTypeVersionResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_type_name=application_type_name, + version=version, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = self._deserialize('ApplicationTypeVersionResource', pipeline_response) @@ -174,18 +348,20 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}/versions/{version}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}/versions/{version}"} # type: ignore + + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - cluster_name, # type: str - application_type_name, # type: str - version, # type: str - parameters, # type: "_models.ApplicationTypeVersionResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ApplicationTypeVersionResource"] + resource_group_name: str, + cluster_name: str, + application_type_name: str, + version: str, + parameters: _models.ApplicationTypeVersionResource, + **kwargs: Any + ) -> LROPoller[_models.ApplicationTypeVersionResource]: """Creates or updates a Service Fabric application type version resource. Create or update a Service Fabric application type version resource with the specified name. @@ -202,52 +378,61 @@ def begin_create_or_update( :type parameters: ~azure.mgmt.servicefabric.models.ApplicationTypeVersionResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either ApplicationTypeVersionResource or the result of cls(response) - :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicefabric.models.ApplicationTypeVersionResource] - :raises ~azure.core.exceptions.HttpResponseError: + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ApplicationTypeVersionResource or the + result of cls(response) + :rtype: + ~azure.core.polling.LROPoller[~azure.mgmt.servicefabric.models.ApplicationTypeVersionResource] + :raises: ~azure.core.exceptions.HttpResponseError """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ApplicationTypeVersionResource] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationTypeVersionResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_name, application_type_name=application_type_name, version=version, parameters=parameters, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): deserialized = self._deserialize('ApplicationTypeVersionResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'applicationTypeName': self._serialize.url("application_type_name", application_type_name, 'str'), - 'version': self._serialize.url("version", version, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -256,69 +441,70 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}/versions/{version}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}/versions/{version}"} # type: ignore - def _delete_initial( + def _delete_initial( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - cluster_name, # type: str - application_type_name, # type: str - version, # type: str - **kwargs # type: Any - ): - # type: (...) -> None - cls = kwargs.pop('cls', None) # type: ClsType[None] + resource_group_name: str, + cluster_name: str, + application_type_name: str, + version: str, + **kwargs: Any + ) -> None: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'applicationTypeName': self._serialize.url("application_type_name", application_type_name, 'str'), - 'version': self._serialize.url("version", version, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) + error_map.update(kwargs.pop('error_map', {}) or {}) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_type_name=application_type_name, + version=version, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}/versions/{version}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}/versions/{version}"} # type: ignore + - def begin_delete( + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - cluster_name, # type: str - application_type_name, # type: str - version, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + cluster_name: str, + application_type_name: str, + version: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a Service Fabric application type version resource. Delete a Service Fabric application type version resource with the specified name. @@ -333,48 +519,54 @@ def begin_delete( :type version: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_name, application_type_name=application_type_name, version=version, + api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'applicationTypeName': self._serialize.url("application_type_name", application_type_name, 'str'), - 'version': self._serialize.url("version", version, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -383,19 +575,20 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}/versions/{version}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}/versions/{version}"} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - cluster_name, # type: str - application_type_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ApplicationTypeVersionResourceList" - """Gets the list of application type version resources created in the specified Service Fabric application type name resource. + resource_group_name: str, + cluster_name: str, + application_type_name: str, + **kwargs: Any + ) -> _models.ApplicationTypeVersionResourceList: + """Gets the list of application type version resources created in the specified Service Fabric + application type name resource. Gets all application type version resources created or in the process of being created in the Service Fabric application type name resource. @@ -411,39 +604,41 @@ def list( :rtype: ~azure.mgmt.servicefabric.models.ApplicationTypeVersionResourceList :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationTypeVersionResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'applicationTypeName': self._serialize.url("application_type_name", application_type_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ApplicationTypeVersionResourceList] + + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_type_name=application_type_name, + api_version=api_version, + template_url=self.list.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ApplicationTypeVersionResourceList', pipeline_response) @@ -452,4 +647,6 @@ def list( return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}/versions'} # type: ignore + + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}/versions"} # type: ignore + diff --git a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/operations/_application_types_operations.py b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/operations/_application_types_operations.py index 2d02f041c731..a55a9c7eb543 100644 --- a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/operations/_application_types_operations.py +++ b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/operations/_application_types_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,55 +6,217 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +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: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "applicationTypeName": _SERIALIZER.url("application_type_name", application_type_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_create_or_update_request( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + application_type_name: str, + *, + json: Optional[_models.ApplicationTypeResource] = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "applicationTypeName": _SERIALIZER.url("application_type_name", application_type_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + if content_type is not None: + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_params, + headers=_headers, + 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: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "applicationTypeName": _SERIALIZER.url("application_type_name", application_type_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + +class ApplicationTypesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -class ApplicationTypesOperations(object): - """ApplicationTypesOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.servicefabric.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. + Instead, you should access the following operations through + :class:`~azure.mgmt.servicefabric.ServiceFabricManagementClient`'s + :attr:`application_types` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace def get( self, - resource_group_name, # type: str - cluster_name, # type: str - application_type_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ApplicationTypeResource" + resource_group_name: str, + cluster_name: str, + application_type_name: str, + **kwargs: Any + ) -> _models.ApplicationTypeResource: """Gets a Service Fabric application type name resource. Get a Service Fabric application type name resource created or in the process of being created @@ -70,39 +233,41 @@ def get( :rtype: ~azure.mgmt.servicefabric.models.ApplicationTypeResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationTypeResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.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') + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ApplicationTypeResource] + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_type_name=application_type_name, + api_version=api_version, + template_url=self.get.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ApplicationTypeResource', pipeline_response) @@ -111,17 +276,19 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}"} # type: ignore + + + @distributed_trace def create_or_update( self, - resource_group_name, # type: str - cluster_name, # type: str - application_type_name, # type: str - parameters, # type: "_models.ApplicationTypeResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.ApplicationTypeResource" + resource_group_name: str, + cluster_name: str, + application_type_name: str, + parameters: _models.ApplicationTypeResource, + **kwargs: Any + ) -> _models.ApplicationTypeResource: """Creates or updates a Service Fabric application type name resource. Create or update a Service Fabric application type name resource with the specified name. @@ -139,44 +306,45 @@ def create_or_update( :rtype: ~azure.mgmt.servicefabric.models.ApplicationTypeResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationTypeResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.create_or_update.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'applicationTypeName': self._serialize.url("application_type_name", application_type_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ApplicationTypeResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ApplicationTypeResource] + + _json = self._serialize.body(parameters, 'ApplicationTypeResource') + + request = build_create_or_update_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_type_name=application_type_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.create_or_update.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ApplicationTypeResource', pipeline_response) @@ -185,64 +353,67 @@ def create_or_update( return cls(pipeline_response, deserialized, {}) return deserialized - create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}'} # type: ignore - def _delete_initial( + create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}"} # type: ignore + + + def _delete_initial( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - cluster_name, # type: str - application_type_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None - cls = kwargs.pop('cls', None) # type: ClsType[None] + resource_group_name: str, + cluster_name: str, + application_type_name: str, + **kwargs: Any + ) -> None: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'applicationTypeName': self._serialize.url("application_type_name", application_type_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) + error_map.update(kwargs.pop('error_map', {}) or {}) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_type_name=application_type_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}"} # type: ignore + - def begin_delete( + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - cluster_name, # type: str - application_type_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + cluster_name: str, + application_type_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a Service Fabric application type name resource. Delete a Service Fabric application type name resource with the specified name. @@ -255,46 +426,53 @@ def begin_delete( :type application_type_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_name, application_type_name=application_type_name, + api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'applicationTypeName': self._serialize.url("application_type_name", application_type_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -303,18 +481,19 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes/{applicationTypeName}"} # type: ignore + @distributed_trace def list( self, - resource_group_name, # type: str - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ApplicationTypeResourceList" - """Gets the list of application type name resources created in the specified Service Fabric cluster resource. + resource_group_name: str, + cluster_name: str, + **kwargs: Any + ) -> _models.ApplicationTypeResourceList: + """Gets the list of application type name resources created in the specified Service Fabric + cluster resource. Gets all application type name resources created or in the process of being created in the Service Fabric cluster resource. @@ -328,38 +507,40 @@ def list( :rtype: ~azure.mgmt.servicefabric.models.ApplicationTypeResourceList :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationTypeResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ApplicationTypeResourceList] + + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + api_version=api_version, + template_url=self.list.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ApplicationTypeResourceList', pipeline_response) @@ -368,4 +549,6 @@ def list( return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes'} # type: ignore + + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applicationTypes"} # type: ignore + diff --git a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/operations/_applications_operations.py b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/operations/_applications_operations.py index 592887a5e162..45662ee7de16 100644 --- a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/operations/_applications_operations.py +++ b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/operations/_applications_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,55 +6,264 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +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: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "applicationName": _SERIALIZER.url("application_name", application_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_create_or_update_request_initial( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + application_name: str, + *, + json: Optional[_models.ApplicationResource] = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "applicationName": _SERIALIZER.url("application_name", application_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + if content_type is not None: + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_params, + headers=_headers, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + application_name: str, + *, + json: Optional[_models.ApplicationResourceUpdate] = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "applicationName": _SERIALIZER.url("application_name", application_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + if content_type is not None: + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=_url, + params=_params, + headers=_headers, + 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: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "applicationName": _SERIALIZER.url("application_name", application_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + +class ApplicationsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -class ApplicationsOperations(object): - """ApplicationsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.servicefabric.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. + Instead, you should access the following operations through + :class:`~azure.mgmt.servicefabric.ServiceFabricManagementClient`'s + :attr:`applications` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace def get( self, - resource_group_name, # type: str - cluster_name, # type: str - application_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ApplicationResource" + resource_group_name: str, + cluster_name: str, + application_name: str, + **kwargs: Any + ) -> _models.ApplicationResource: """Gets a Service Fabric application resource. Get a Service Fabric application resource created or in the process of being created in the @@ -70,39 +280,41 @@ def get( :rtype: ~azure.mgmt.servicefabric.models.ApplicationResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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') + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ApplicationResource] + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_name=application_name, + api_version=api_version, + template_url=self.get.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ApplicationResource', pipeline_response) @@ -111,56 +323,57 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}"} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - cluster_name, # type: str - application_name, # type: str - parameters, # type: "_models.ApplicationResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.ApplicationResource" - cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationResource"] + resource_group_name: str, + cluster_name: str, + application_name: str, + parameters: _models.ApplicationResource, + **kwargs: Any + ) -> _models.ApplicationResource: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'applicationName': self._serialize.url("application_name", application_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ApplicationResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ApplicationResource] + + _json = self._serialize.body(parameters, 'ApplicationResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_name=application_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = self._deserialize('ApplicationResource', pipeline_response) @@ -168,17 +381,19 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}"} # type: ignore + + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - cluster_name, # type: str - application_name, # type: str - parameters, # type: "_models.ApplicationResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ApplicationResource"] + resource_group_name: str, + cluster_name: str, + application_name: str, + parameters: _models.ApplicationResource, + **kwargs: Any + ) -> LROPoller[_models.ApplicationResource]: """Creates or updates a Service Fabric application resource. Create or update a Service Fabric application resource with the specified name. @@ -193,50 +408,59 @@ def begin_create_or_update( :type parameters: ~azure.mgmt.servicefabric.models.ApplicationResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either ApplicationResource or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ApplicationResource or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicefabric.models.ApplicationResource] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ApplicationResource] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_name, application_name=application_name, parameters=parameters, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): deserialized = self._deserialize('ApplicationResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'applicationName': self._serialize.url("application_name", application_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -245,58 +469,57 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}"} # type: ignore def _update_initial( self, - resource_group_name, # type: str - cluster_name, # type: str - application_name, # type: str - parameters, # type: "_models.ApplicationResourceUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.ApplicationResource" - cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationResource"] + resource_group_name: str, + cluster_name: str, + application_name: str, + parameters: _models.ApplicationResourceUpdate, + **kwargs: Any + ) -> _models.ApplicationResource: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'applicationName': self._serialize.url("application_name", application_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ApplicationResourceUpdate') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ApplicationResource] + + _json = self._serialize.body(parameters, 'ApplicationResourceUpdate') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_name=application_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = self._deserialize('ApplicationResource', pipeline_response) @@ -304,17 +527,19 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}"} # type: ignore + + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - cluster_name, # type: str - application_name, # type: str - parameters, # type: "_models.ApplicationResourceUpdate" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ApplicationResource"] + resource_group_name: str, + cluster_name: str, + application_name: str, + parameters: _models.ApplicationResourceUpdate, + **kwargs: Any + ) -> LROPoller[_models.ApplicationResource]: """Updates a Service Fabric application resource. Update a Service Fabric application resource with the specified name. @@ -329,50 +554,59 @@ def begin_update( :type parameters: ~azure.mgmt.servicefabric.models.ApplicationResourceUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either ApplicationResource or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ApplicationResource or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicefabric.models.ApplicationResource] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ApplicationResource] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._update_initial( + raw_result = self._update_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_name, application_name=application_name, parameters=parameters, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): deserialized = self._deserialize('ApplicationResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'applicationName': self._serialize.url("application_name", application_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -381,66 +615,67 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _delete_initial( + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}"} # type: ignore + + def _delete_initial( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - cluster_name, # type: str - application_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None - cls = kwargs.pop('cls', None) # type: ClsType[None] + resource_group_name: str, + cluster_name: str, + application_name: str, + **kwargs: Any + ) -> None: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'applicationName': self._serialize.url("application_name", application_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_delete_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_name=application_name, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}"} # type: ignore - def begin_delete( + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - cluster_name, # type: str - application_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + cluster_name: str, + application_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a Service Fabric application resource. Delete a Service Fabric application resource with the specified name. @@ -453,46 +688,53 @@ def begin_delete( :type application_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_name, application_name=application_name, + api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'applicationName': self._serialize.url("application_name", application_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -501,18 +743,19 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}"} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ApplicationResourceList" - """Gets the list of application resources created in the specified Service Fabric cluster resource. + resource_group_name: str, + cluster_name: str, + **kwargs: Any + ) -> _models.ApplicationResourceList: + """Gets the list of application resources created in the specified Service Fabric cluster + resource. Gets all application resources created or in the process of being created in the Service Fabric cluster resource. @@ -526,38 +769,40 @@ def list( :rtype: ~azure.mgmt.servicefabric.models.ApplicationResourceList :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ApplicationResourceList] + + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + api_version=api_version, + template_url=self.list.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ApplicationResourceList', pipeline_response) @@ -566,4 +811,6 @@ def list( return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications'} # type: ignore + + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications"} # type: ignore + diff --git a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/operations/_cluster_versions_operations.py b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/operations/_cluster_versions_operations.py index 8a7096ef2a02..21dda2e14605 100644 --- a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/operations/_cluster_versions_operations.py +++ b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/operations/_cluster_versions_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,53 +6,202 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar, Union + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_get_request( + location: str, + subscription_id: str, + cluster_version: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/clusterVersions/{clusterVersion}") # pylint: disable=line-too-long + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "clusterVersion": _SERIALIZER.url("cluster_version", cluster_version, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_get_by_environment_request( + location: str, + environment: Union[str, "_models.ClusterVersionsEnvironment"], + subscription_id: str, + cluster_version: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/environments/{environment}/clusterVersions/{clusterVersion}") # pylint: disable=line-too-long + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "environment": _SERIALIZER.url("environment", environment, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "clusterVersion": _SERIALIZER.url("cluster_version", cluster_version, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_list_request( + location: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/clusterVersions") # pylint: disable=line-too-long + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_list_by_environment_request( + location: str, + environment: Union[str, "_models.ClusterVersionsEnvironment"], + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/environments/{environment}/clusterVersions") # pylint: disable=line-too-long + path_format_arguments = { + "location": _SERIALIZER.url("location", location, 'str'), + "environment": _SERIALIZER.url("environment", environment, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + +class ClusterVersionsOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -class ClusterVersionsOperations(object): - """ClusterVersionsOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.servicefabric.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. + Instead, you should access the following operations through + :class:`~azure.mgmt.servicefabric.ServiceFabricManagementClient`'s + :attr:`cluster_versions` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace def get( self, - location, # type: str - cluster_version, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ClusterCodeVersionsListResult" - """Gets information about a Service Fabric cluster code version available in the specified location. + location: str, + cluster_version: str, + **kwargs: Any + ) -> _models.ClusterCodeVersionsListResult: + """Gets information about a Service Fabric cluster code version available in the specified + location. Gets information about an available Service Fabric cluster code version. @@ -65,38 +215,40 @@ def get( :rtype: ~azure.mgmt.servicefabric.models.ClusterCodeVersionsListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ClusterCodeVersionsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get.metadata['url'] # type: ignore - path_format_arguments = { - 'location': self._serialize.url("location", location, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'clusterVersion': self._serialize.url("cluster_version", cluster_version, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ClusterCodeVersionsListResult] + + + request = build_get_request( + location=location, + subscription_id=self._config.subscription_id, + cluster_version=cluster_version, + api_version=api_version, + template_url=self.get.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ClusterCodeVersionsListResult', pipeline_response) @@ -105,17 +257,20 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/clusterVersions/{clusterVersion}'} # type: ignore + get.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/clusterVersions/{clusterVersion}"} # type: ignore + + + @distributed_trace def get_by_environment( self, - location, # type: str - environment, # type: Union[str, "_models.Enum14"] - cluster_version, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ClusterCodeVersionsListResult" - """Gets information about a Service Fabric cluster code version available for the specified environment. + location: str, + environment: Union[str, "_models.ClusterVersionsEnvironment"], + cluster_version: str, + **kwargs: Any + ) -> _models.ClusterCodeVersionsListResult: + """Gets information about a Service Fabric cluster code version available for the specified + environment. Gets information about an available Service Fabric cluster code version by environment. @@ -123,7 +278,7 @@ def get_by_environment( location. :type location: str :param environment: The operating system of the cluster. The default means all. - :type environment: str or ~azure.mgmt.servicefabric.models.Enum14 + :type environment: str or ~azure.mgmt.servicefabric.models.ClusterVersionsEnvironment :param cluster_version: The cluster code version. :type cluster_version: str :keyword callable cls: A custom type or function that will be passed the direct response @@ -131,39 +286,41 @@ def get_by_environment( :rtype: ~azure.mgmt.servicefabric.models.ClusterCodeVersionsListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ClusterCodeVersionsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.get_by_environment.metadata['url'] # type: ignore - path_format_arguments = { - 'location': self._serialize.url("location", location, 'str'), - 'environment': self._serialize.url("environment", environment, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'clusterVersion': self._serialize.url("cluster_version", cluster_version, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ClusterCodeVersionsListResult] + + + request = build_get_by_environment_request( + location=location, + environment=environment, + subscription_id=self._config.subscription_id, + cluster_version=cluster_version, + api_version=api_version, + template_url=self.get_by_environment.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ClusterCodeVersionsListResult', pipeline_response) @@ -172,14 +329,16 @@ def get_by_environment( return cls(pipeline_response, deserialized, {}) return deserialized - get_by_environment.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/environments/{environment}/clusterVersions/{clusterVersion}'} # type: ignore + get_by_environment.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/environments/{environment}/clusterVersions/{clusterVersion}"} # type: ignore + + + @distributed_trace def list( self, - location, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ClusterCodeVersionsListResult" + location: str, + **kwargs: Any + ) -> _models.ClusterCodeVersionsListResult: """Gets the list of Service Fabric cluster code versions available for the specified location. Gets all available code versions for Service Fabric cluster resources by location. @@ -192,37 +351,39 @@ def list( :rtype: ~azure.mgmt.servicefabric.models.ClusterCodeVersionsListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ClusterCodeVersionsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'location': self._serialize.url("location", location, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ClusterCodeVersionsListResult] + + + request = build_list_request( + location=location, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ClusterCodeVersionsListResult', pipeline_response) @@ -231,15 +392,17 @@ def list( return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/clusterVersions'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/clusterVersions"} # type: ignore + + + @distributed_trace def list_by_environment( self, - location, # type: str - environment, # type: Union[str, "_models.Enum14"] - **kwargs # type: Any - ): - # type: (...) -> "_models.ClusterCodeVersionsListResult" + location: str, + environment: Union[str, "_models.ClusterVersionsEnvironment"], + **kwargs: Any + ) -> _models.ClusterCodeVersionsListResult: """Gets the list of Service Fabric cluster code versions available for the specified environment. Gets all available code versions for Service Fabric cluster resources by environment. @@ -248,44 +411,46 @@ def list_by_environment( location. :type location: str :param environment: The operating system of the cluster. The default means all. - :type environment: str or ~azure.mgmt.servicefabric.models.Enum14 + :type environment: str or ~azure.mgmt.servicefabric.models.ClusterVersionsEnvironment :keyword callable cls: A custom type or function that will be passed the direct response :return: ClusterCodeVersionsListResult, or the result of cls(response) :rtype: ~azure.mgmt.servicefabric.models.ClusterCodeVersionsListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ClusterCodeVersionsListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.list_by_environment.metadata['url'] # type: ignore - path_format_arguments = { - 'location': self._serialize.url("location", location, 'str'), - 'environment': self._serialize.url("environment", environment, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ClusterCodeVersionsListResult] + + + request = build_list_by_environment_request( + location=location, + environment=environment, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_environment.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ClusterCodeVersionsListResult', pipeline_response) @@ -294,4 +459,6 @@ def list_by_environment( return cls(pipeline_response, deserialized, {}) return deserialized - list_by_environment.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/environments/{environment}/clusterVersions'} # type: ignore + + list_by_environment.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/locations/{location}/environments/{environment}/clusterVersions"} # type: ignore + diff --git a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/operations/_clusters_operations.py b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/operations/_clusters_operations.py index 9d855f07ba2b..c88a9ac6cc0f 100644 --- a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/operations/_clusters_operations.py +++ b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/operations/_clusters_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,54 +6,331 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +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: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_create_or_update_request_initial( + resource_group_name: str, + cluster_name: str, + subscription_id: str, + *, + json: Optional[_models.Cluster] = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + if content_type is not None: + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_params, + headers=_headers, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + resource_group_name: str, + cluster_name: str, + subscription_id: str, + *, + json: Optional[_models.ClusterUpdateParameters] = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + if content_type is not None: + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=_url, + params=_params, + headers=_headers, + json=json, + content=content, + **kwargs + ) + + +def build_delete_request( + resource_group_name: str, + cluster_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_list_by_resource_group_request( + resource_group_name: str, + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters") # pylint: disable=line-too-long + path_format_arguments = { + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/clusters") + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_list_upgradable_versions_request( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + *, + json: Optional[_models.UpgradableVersionsDescription] = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/listUpgradableVersions") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + if content_type is not None: + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="POST", + url=_url, + params=_params, + headers=_headers, + json=json, + content=content, + **kwargs + ) + +class ClustersOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -class ClustersOperations(object): - """ClustersOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.servicefabric.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. + Instead, you should access the following operations through + :class:`~azure.mgmt.servicefabric.ServiceFabricManagementClient`'s + :attr:`clusters` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace def get( self, - resource_group_name, # type: str - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.Cluster" + resource_group_name: str, + cluster_name: str, + **kwargs: Any + ) -> _models.Cluster: """Gets a Service Fabric cluster resource. Get a Service Fabric cluster resource created or in the process of being created in the @@ -67,38 +345,40 @@ def get( :rtype: ~azure.mgmt.servicefabric.models.Cluster :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.Cluster"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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') + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.Cluster] + + + request = build_get_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.get.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('Cluster', pipeline_response) @@ -107,54 +387,55 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}"} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - cluster_name, # type: str - parameters, # type: "_models.Cluster" - **kwargs # type: Any - ): - # type: (...) -> "_models.Cluster" - cls = kwargs.pop('cls', None) # type: ClsType["_models.Cluster"] + resource_group_name: str, + cluster_name: str, + parameters: _models.Cluster, + **kwargs: Any + ) -> _models.Cluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'Cluster') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Cluster] + + _json = self._serialize.body(parameters, 'Cluster') + + request = build_create_or_update_request_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('Cluster', pipeline_response) @@ -166,16 +447,18 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}"} # type: ignore + + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - cluster_name, # type: str - parameters, # type: "_models.Cluster" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Cluster"] + resource_group_name: str, + cluster_name: str, + parameters: _models.Cluster, + **kwargs: Any + ) -> LROPoller[_models.Cluster]: """Creates or updates a Service Fabric cluster resource. Create or update a Service Fabric cluster resource with the specified name. @@ -188,48 +471,57 @@ def begin_create_or_update( :type parameters: ~azure.mgmt.servicefabric.models.Cluster :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Cluster or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicefabric.models.Cluster] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Cluster] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.Cluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_name, parameters=parameters, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): deserialized = self._deserialize('Cluster', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -238,56 +530,55 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}"} # type: ignore def _update_initial( self, - resource_group_name, # type: str - cluster_name, # type: str - parameters, # type: "_models.ClusterUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> "_models.Cluster" - cls = kwargs.pop('cls', None) # type: ClsType["_models.Cluster"] + resource_group_name: str, + cluster_name: str, + parameters: _models.ClusterUpdateParameters, + **kwargs: Any + ) -> _models.Cluster: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ClusterUpdateParameters') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Cluster] + + _json = self._serialize.body(parameters, 'ClusterUpdateParameters') + + request = build_update_request_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if response.status_code == 200: deserialized = self._deserialize('Cluster', pipeline_response) @@ -299,16 +590,18 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}"} # type: ignore + + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - cluster_name, # type: str - parameters, # type: "_models.ClusterUpdateParameters" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.Cluster"] + resource_group_name: str, + cluster_name: str, + parameters: _models.ClusterUpdateParameters, + **kwargs: Any + ) -> LROPoller[_models.Cluster]: """Updates the configuration of a Service Fabric cluster resource. Update the configuration of a Service Fabric cluster resource with the specified name. @@ -322,48 +615,57 @@ def begin_update( :type parameters: ~azure.mgmt.servicefabric.models.ClusterUpdateParameters :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either Cluster or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicefabric.models.Cluster] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.Cluster] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.Cluster"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._update_initial( + raw_result = self._update_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_name, parameters=parameters, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): deserialized = self._deserialize('Cluster', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -372,17 +674,17 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}"} # type: ignore - def delete( + @distributed_trace + def delete( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - cluster_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None + resource_group_name: str, + cluster_name: str, + **kwargs: Any + ) -> None: """Deletes a Service Fabric cluster resource. Delete a Service Fabric cluster resource with the specified name. @@ -396,51 +698,54 @@ def delete( :rtype: None :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType[None] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.delete.metadata['url'] # type: ignore - path_format_arguments = { - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) + error_map.update(kwargs.pop('error_map', {}) or {}) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] + + + request = build_delete_request( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.delete.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}'} # type: ignore + delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}"} # type: ignore + + @distributed_trace def list_by_resource_group( self, - resource_group_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ClusterListResult" + resource_group_name: str, + **kwargs: Any + ) -> _models.ClusterListResult: """Gets the list of Service Fabric cluster resources created in the specified resource group. Gets all Service Fabric cluster resources created or in the process of being created in the @@ -453,37 +758,39 @@ def list_by_resource_group( :rtype: ~azure.mgmt.servicefabric.models.ClusterListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.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') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ClusterListResult] + + + request = build_list_by_resource_group_request( + resource_group_name=resource_group_name, + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list_by_resource_group.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ClusterListResult', pipeline_response) @@ -492,13 +799,15 @@ def list_by_resource_group( return cls(pipeline_response, deserialized, {}) return deserialized - list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters'} # type: ignore + list_by_resource_group.metadata = {'url': "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters"} # type: ignore + + + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> "_models.ClusterListResult" + **kwargs: Any + ) -> _models.ClusterListResult: """Gets the list of Service Fabric cluster resources created in the specified subscription. Gets all Service Fabric cluster resources created or in the process of being created in the @@ -509,36 +818,38 @@ def list( :rtype: ~azure.mgmt.servicefabric.models.ClusterListResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ClusterListResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ClusterListResult] - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = build_list_request( + subscription_id=self._config.subscription_id, + api_version=api_version, + template_url=self.list.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ClusterListResult', pipeline_response) @@ -547,17 +858,20 @@ def list( return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/clusters'} # type: ignore + list.metadata = {'url': "/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/clusters"} # type: ignore + + + @distributed_trace def list_upgradable_versions( self, - resource_group_name, # type: str - cluster_name, # type: str - versions_description=None, # type: Optional["_models.UpgradableVersionsDescription"] - **kwargs # type: Any - ): - # type: (...) -> "_models.UpgradableVersionPathResult" - """Operation to get the minimum and maximum upgradable version from the current cluster version, or the required path to get to the an specific target version. + resource_group_name: str, + cluster_name: str, + versions_description: Optional[_models.UpgradableVersionsDescription] = None, + **kwargs: Any + ) -> _models.UpgradableVersionPathResult: + """Operation to get the minimum and maximum upgradable version from the current cluster version, + or the required path to get to the an specific target version. If a target is not provided, it will get the minimum and maximum versions available from the current cluster version. If a target is given, it will provide the required path to get from @@ -567,53 +881,55 @@ def list_upgradable_versions( :type resource_group_name: str :param cluster_name: The name of the cluster resource. :type cluster_name: str - :param versions_description: The upgrade path description with target version. + :param versions_description: The upgrade path description with target version. Default value is + None. :type versions_description: ~azure.mgmt.servicefabric.models.UpgradableVersionsDescription :keyword callable cls: A custom type or function that will be passed the direct response :return: UpgradableVersionPathResult, or the result of cls(response) :rtype: ~azure.mgmt.servicefabric.models.UpgradableVersionPathResult :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.UpgradableVersionPathResult"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self.list_upgradable_versions.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) + error_map.update(kwargs.pop('error_map', {}) or {}) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.UpgradableVersionPathResult] - body_content_kwargs = {} # type: Dict[str, Any] if versions_description is not None: - body_content = self._serialize.body(versions_description, 'UpgradableVersionsDescription') + _json = self._serialize.body(versions_description, 'UpgradableVersionsDescription') else: - body_content = None - body_content_kwargs['content'] = body_content - request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + _json = None + + request = build_list_upgradable_versions_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self.list_upgradable_versions.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('UpgradableVersionPathResult', pipeline_response) @@ -622,4 +938,6 @@ def list_upgradable_versions( return cls(pipeline_response, deserialized, {}) return deserialized - list_upgradable_versions.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/listUpgradableVersions'} # type: ignore + + list_upgradable_versions.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/listUpgradableVersions"} # type: ignore + diff --git a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/operations/_operations.py b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/operations/_operations.py index da3cbbe1c6fc..036b4e09a922 100644 --- a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/operations/_operations.py +++ b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/operations/_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,51 +6,78 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Iterable, Optional, TypeVar + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.paging import ItemPaged from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models +from .._vendor import _convert_request +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +_SERIALIZER = Serializer() +_SERIALIZER.client_side_validation = False + +def build_list_request( + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + accept = _headers.pop('Accept', "application/json") - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + # Construct URL + _url = kwargs.pop("template_url", "/providers/Microsoft.ServiceFabric/operations") -class Operations(object): - """Operations operations. + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') - 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. + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + +class Operations: + """ + .. warning:: + **DO NOT** instantiate this class directly. - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.servicefabric.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. + Instead, you should access the following operations through + :class:`~azure.mgmt.servicefabric.ServiceFabricManagementClient`'s + :attr:`operations` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace def list( self, - **kwargs # type: Any - ): - # type: (...) -> Iterable["_models.OperationListResult"] + **kwargs: Any + ) -> Iterable[_models.OperationListResult]: """Lists all of the available Service Fabric resource provider API operations. Get the list of available Service Fabric resource provider API operations. @@ -59,35 +87,43 @@ def list( :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.servicefabric.models.OperationListResult] :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.OperationListResult"] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.OperationListResult] + error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - + error_map.update(kwargs.pop('error_map', {}) or {}) def prepare_request(next_link=None): - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - if not next_link: - # Construct URL - url = self.list.metadata['url'] # type: ignore - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = build_list_request( + api_version=api_version, + template_url=self.list.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - request = self._client.get(url, query_parameters, header_parameters) else: - url = next_link - query_parameters = {} # type: Dict[str, Any] - request = self._client.get(url, query_parameters, header_parameters) + + request = build_list_request( + api_version=api_version, + template_url=next_link, + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + request.method = "GET" return request def extract_data(pipeline_response): - deserialized = self._deserialize('OperationListResult', pipeline_response) + deserialized = self._deserialize("OperationListResult", pipeline_response) list_of_elem = deserialized.value if cls: list_of_elem = cls(list_of_elem) @@ -96,17 +132,22 @@ def extract_data(pipeline_response): def get_next(next_link=None): request = prepare_request(next_link) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) return pipeline_response + return ItemPaged( get_next, extract_data ) - list.metadata = {'url': '/providers/Microsoft.ServiceFabric/operations'} # type: ignore + list.metadata = {'url': "/providers/Microsoft.ServiceFabric/operations"} # type: ignore diff --git a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/operations/_patch.py b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/operations/_patch.py new file mode 100644 index 000000000000..0ad201a8c586 --- /dev/null +++ b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/operations/_patch.py @@ -0,0 +1,19 @@ +# ------------------------------------ +# Copyright (c) Microsoft Corporation. +# Licensed under the MIT License. +# ------------------------------------ +"""Customize generated code here. + +Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize +""" +from typing import List + +__all__: List[str] = [] # Add all objects you want publicly available to users at this package level + +def patch_sdk(): + """Do not remove from this file. + + `patch_sdk` is a last resort escape hatch that allows you to do customizations + you can't accomplish using the techniques described in + https://aka.ms/azsdk/python/dpcodegen/python/customize + """ diff --git a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/operations/_services_operations.py b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/operations/_services_operations.py index 53cdaaa58b86..f08a537add06 100644 --- a/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/operations/_services_operations.py +++ b/sdk/servicefabric/azure-mgmt-servicefabric/azure/mgmt/servicefabric/operations/_services_operations.py @@ -1,3 +1,4 @@ +# pylint: disable=too-many-lines # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. @@ -5,56 +6,275 @@ # Code generated by Microsoft (R) AutoRest Code Generator. # Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import TYPE_CHECKING -import warnings +from typing import Any, Callable, Dict, Optional, TypeVar, Union, cast + +from msrest import Serializer from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error from azure.core.pipeline import PipelineResponse -from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.pipeline.transport import HttpResponse from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.core.rest import HttpRequest +from azure.core.tracing.decorator import distributed_trace +from azure.core.utils import case_insensitive_dict from azure.mgmt.core.exceptions import ARMErrorFormat from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models +from .._vendor import _convert_request, _format_url_section +T = TypeVar('T') +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: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}/services/{serviceName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "applicationName": _SERIALIZER.url("application_name", application_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_params, + headers=_headers, + **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: Optional[_models.ServiceResource] = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}/services/{serviceName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "applicationName": _SERIALIZER.url("application_name", application_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + if content_type is not None: + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PUT", + url=_url, + params=_params, + headers=_headers, + json=json, + content=content, + **kwargs + ) + + +def build_update_request_initial( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + application_name: str, + service_name: str, + *, + json: Optional[_models.ServiceResourceUpdate] = None, + content: Any = None, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', None)) # type: Optional[str] + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}/services/{serviceName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "applicationName": _SERIALIZER.url("application_name", application_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + if content_type is not None: + _headers['Content-Type'] = _SERIALIZER.header("content_type", content_type, 'str') + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="PATCH", + url=_url, + params=_params, + headers=_headers, + 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: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}/services/{serviceName}") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "applicationName": _SERIALIZER.url("application_name", application_name, 'str'), + "serviceName": _SERIALIZER.url("service_name", service_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="DELETE", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + + +def build_list_request( + subscription_id: str, + resource_group_name: str, + cluster_name: str, + application_name: str, + **kwargs: Any +) -> HttpRequest: + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + accept = _headers.pop('Accept', "application/json") + + # Construct URL + _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}/services") # pylint: disable=line-too-long + path_format_arguments = { + "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, 'str'), + "resourceGroupName": _SERIALIZER.url("resource_group_name", resource_group_name, 'str'), + "clusterName": _SERIALIZER.url("cluster_name", cluster_name, 'str'), + "applicationName": _SERIALIZER.url("application_name", application_name, 'str'), + } + + _url = _format_url_section(_url, **path_format_arguments) + + # Construct parameters + _params['api-version'] = _SERIALIZER.query("api_version", api_version, 'str') + + # Construct headers + _headers['Accept'] = _SERIALIZER.header("accept", accept, 'str') + + return HttpRequest( + method="GET", + url=_url, + params=_params, + headers=_headers, + **kwargs + ) + +class ServicesOperations: + """ + .. warning:: + **DO NOT** instantiate this class directly. -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from typing import Any, Callable, Dict, Generic, Optional, TypeVar, Union - - T = TypeVar('T') - ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -class ServicesOperations(object): - """ServicesOperations operations. - - You should not instantiate this class directly. Instead, you should create a Client instance that - instantiates it for you and attaches it as an attribute. - - :ivar models: Alias to model classes used in this operation group. - :type models: ~azure.mgmt.servicefabric.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. + Instead, you should access the following operations through + :class:`~azure.mgmt.servicefabric.ServiceFabricManagementClient`'s + :attr:`services` attribute. """ models = _models - def __init__(self, client, config, serializer, deserializer): - self._client = client - self._serialize = serializer - self._deserialize = deserializer - self._config = config + def __init__(self, *args, **kwargs): + input_args = list(args) + self._client = input_args.pop(0) if input_args else kwargs.pop("client") + self._config = input_args.pop(0) if input_args else kwargs.pop("config") + self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") + self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") + + @distributed_trace def get( self, - resource_group_name, # type: str - cluster_name, # type: str - application_name, # type: str - service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ServiceResource" + resource_group_name: str, + cluster_name: str, + application_name: str, + service_name: str, + **kwargs: Any + ) -> _models.ServiceResource: """Gets a Service Fabric service resource. Get a Service Fabric service resource created or in the process of being created in the Service @@ -74,40 +294,42 @@ def get( :rtype: ~azure.mgmt.servicefabric.models.ServiceResource :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - 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') + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ServiceResource] + + + request = build_get_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_name=application_name, + service_name=service_name, + api_version=api_version, + template_url=self.get.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ServiceResource', pipeline_response) @@ -116,58 +338,59 @@ def get( return cls(pipeline_response, deserialized, {}) return deserialized - get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}/services/{serviceName}'} # type: ignore + + get.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}/services/{serviceName}"} # type: ignore + def _create_or_update_initial( self, - resource_group_name, # type: str - cluster_name, # type: str - application_name, # type: str - service_name, # type: str - parameters, # type: "_models.ServiceResource" - **kwargs # type: Any - ): - # type: (...) -> "_models.ServiceResource" - cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] + resource_group_name: str, + cluster_name: str, + application_name: str, + service_name: str, + parameters: _models.ServiceResource, + **kwargs: Any + ) -> _models.ServiceResource: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._create_or_update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'applicationName': self._serialize.url("application_name", application_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ServiceResource') - body_content_kwargs['content'] = body_content - request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ServiceResource] + + _json = self._serialize.body(parameters, 'ServiceResource') + + request = build_create_or_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_name=application_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._create_or_update_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = self._deserialize('ServiceResource', pipeline_response) @@ -175,18 +398,20 @@ def _create_or_update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}/services/{serviceName}'} # type: ignore + _create_or_update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}/services/{serviceName}"} # type: ignore + + + @distributed_trace def begin_create_or_update( self, - resource_group_name, # type: str - cluster_name, # type: str - application_name, # type: str - service_name, # type: str - parameters, # type: "_models.ServiceResource" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ServiceResource"] + resource_group_name: str, + cluster_name: str, + application_name: str, + service_name: str, + parameters: _models.ServiceResource, + **kwargs: Any + ) -> LROPoller[_models.ServiceResource]: """Creates or updates a Service Fabric service resource. Create or update a Service Fabric service resource with the specified name. @@ -204,52 +429,60 @@ def begin_create_or_update( :type parameters: ~azure.mgmt.servicefabric.models.ServiceResource :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either ServiceResource or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ServiceResource or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicefabric.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ServiceResource] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._create_or_update_initial( + raw_result = self._create_or_update_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_name, application_name=application_name, service_name=service_name, parameters=parameters, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): deserialized = self._deserialize('ServiceResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'applicationName': self._serialize.url("application_name", application_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -258,60 +491,59 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}/services/{serviceName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + + begin_create_or_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}/services/{serviceName}"} # type: ignore def _update_initial( self, - resource_group_name, # type: str - cluster_name, # type: str - application_name, # type: str - service_name, # type: str - parameters, # type: "_models.ServiceResourceUpdate" - **kwargs # type: Any - ): - # type: (...) -> "_models.ServiceResource" - cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] + resource_group_name: str, + cluster_name: str, + application_name: str, + service_name: str, + parameters: _models.ServiceResourceUpdate, + **kwargs: Any + ) -> _models.ServiceResource: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - content_type = kwargs.pop("content_type", "application/json") - accept = "application/json" - - # Construct URL - url = self._update_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'applicationName': self._serialize.url("application_name", application_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Content-Type'] = self._serialize.header("content_type", content_type, 'str') - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') - - body_content_kwargs = {} # type: Dict[str, Any] - body_content = self._serialize.body(parameters, 'ServiceResourceUpdate') - body_content_kwargs['content'] = body_content - request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ServiceResource] + + _json = self._serialize.body(parameters, 'ServiceResourceUpdate') + + request = build_update_request_initial( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_name=application_name, + service_name=service_name, + api_version=api_version, + content_type=content_type, + json=_json, + template_url=self._update_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore + + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) deserialized = self._deserialize('ServiceResource', pipeline_response) @@ -319,18 +551,20 @@ def _update_initial( return cls(pipeline_response, deserialized, {}) return deserialized - _update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}/services/{serviceName}'} # type: ignore + _update_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}/services/{serviceName}"} # type: ignore + + + @distributed_trace def begin_update( self, - resource_group_name, # type: str - cluster_name, # type: str - application_name, # type: str - service_name, # type: str - parameters, # type: "_models.ServiceResourceUpdate" - **kwargs # type: Any - ): - # type: (...) -> LROPoller["_models.ServiceResource"] + resource_group_name: str, + cluster_name: str, + application_name: str, + service_name: str, + parameters: _models.ServiceResourceUpdate, + **kwargs: Any + ) -> LROPoller[_models.ServiceResource]: """Updates a Service Fabric service resource. Update a Service Fabric service resource with the specified name. @@ -348,52 +582,60 @@ def begin_update( :type parameters: ~azure.mgmt.servicefabric.models.ServiceResourceUpdate :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. - :return: An instance of LROPoller that returns either ServiceResource or the result of cls(response) + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. + :return: An instance of LROPoller that returns either ServiceResource or the result of + cls(response) :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.servicefabric.models.ServiceResource] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ + _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + content_type = kwargs.pop('content_type', _headers.pop('Content-Type', "application/json")) # type: Optional[str] + cls = kwargs.pop('cls', None) # type: ClsType[_models.ServiceResource] polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] - cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._update_initial( + raw_result = self._update_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_name, application_name=application_name, service_name=service_name, parameters=parameters, + api_version=api_version, + content_type=content_type, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): deserialized = self._deserialize('ServiceResource', pipeline_response) - if cls: return cls(pipeline_response, deserialized, {}) return deserialized - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'applicationName': self._serialize.url("application_name", application_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -402,69 +644,70 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}/services/{serviceName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - def _delete_initial( + begin_update.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}/services/{serviceName}"} # type: ignore + + def _delete_initial( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - cluster_name, # type: str - application_name, # type: str - service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> None - cls = kwargs.pop('cls', None) # type: ClsType[None] + resource_group_name: str, + cluster_name: str, + application_name: str, + service_name: str, + **kwargs: Any + ) -> None: error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self._delete_initial.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'applicationName': self._serialize.url("application_name", application_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[None] - # 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, + api_version=api_version, + template_url=self._delete_initial.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - request = self._client.delete(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [202, 204]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + raise HttpResponseError(response=response, error_format=ARMErrorFormat) if cls: return cls(pipeline_response, None, {}) - _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}/services/{serviceName}'} # type: ignore + _delete_initial.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}/services/{serviceName}"} # type: ignore - def begin_delete( + + @distributed_trace + def begin_delete( # pylint: disable=inconsistent-return-statements self, - resource_group_name, # type: str - cluster_name, # type: str - application_name, # type: str - service_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> LROPoller[None] + resource_group_name: str, + cluster_name: str, + application_name: str, + service_name: str, + **kwargs: Any + ) -> LROPoller[None]: """Deletes a Service Fabric service resource. Delete a Service Fabric service resource with the specified name. @@ -480,48 +723,54 @@ def begin_delete( :type service_name: str :keyword callable cls: A custom type or function that will be passed the direct response :keyword str continuation_token: A continuation token to restart a poller from a saved state. - :keyword polling: By default, your polling method will be ARMPolling. - Pass in False for this operation to not poll, or pass in your own initialized polling object for a personal polling strategy. + :keyword polling: By default, your polling method will be ARMPolling. Pass in False for this + operation to not poll, or pass in your own initialized polling object for a personal polling + strategy. :paramtype polling: bool or ~azure.core.polling.PollingMethod - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. :return: An instance of LROPoller that returns either None or the result of cls(response) :rtype: ~azure.core.polling.LROPoller[None] - :raises ~azure.core.exceptions.HttpResponseError: + :raises: ~azure.core.exceptions.HttpResponseError """ - polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str cls = kwargs.pop('cls', None) # type: ClsType[None] + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] lro_delay = kwargs.pop( 'polling_interval', self._config.polling_interval ) cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] if cont_token is None: - raw_result = self._delete_initial( + raw_result = self._delete_initial( # type: ignore resource_group_name=resource_group_name, cluster_name=cluster_name, application_name=application_name, service_name=service_name, + api_version=api_version, cls=lambda x,y,z: x, + headers=_headers, + params=_params, **kwargs ) - kwargs.pop('error_map', None) - kwargs.pop('content_type', None) def get_long_running_output(pipeline_response): if cls: return cls(pipeline_response, None, {}) - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'applicationName': self._serialize.url("application_name", application_name, 'str'), - 'serviceName': self._serialize.url("service_name", service_name, 'str'), - } - if polling is True: polling_method = ARMPolling(lro_delay, path_format_arguments=path_format_arguments, **kwargs) - elif polling is False: polling_method = NoPolling() + if polling is True: + polling_method = cast(PollingMethod, ARMPolling( + lro_delay, + + + **kwargs + )) # type: PollingMethod + elif polling is False: polling_method = cast(PollingMethod, NoPolling()) else: polling_method = polling if cont_token: return LROPoller.from_continuation_token( @@ -530,19 +779,20 @@ def get_long_running_output(pipeline_response): client=self._client, deserialization_callback=get_long_running_output ) - else: - return LROPoller(self._client, raw_result, get_long_running_output, polling_method) - begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}/services/{serviceName}'} # type: ignore + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}/services/{serviceName}"} # type: ignore + + @distributed_trace def list( self, - resource_group_name, # type: str - cluster_name, # type: str - application_name, # type: str - **kwargs # type: Any - ): - # type: (...) -> "_models.ServiceResourceList" - """Gets the list of service resources created in the specified Service Fabric application resource. + resource_group_name: str, + cluster_name: str, + application_name: str, + **kwargs: Any + ) -> _models.ServiceResourceList: + """Gets the list of service resources created in the specified Service Fabric application + resource. Gets all service resources created or in the process of being created in the Service Fabric application resource. @@ -558,39 +808,41 @@ def list( :rtype: ~azure.mgmt.servicefabric.models.ServiceResourceList :raises: ~azure.core.exceptions.HttpResponseError """ - cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResourceList"] error_map = { 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError } - error_map.update(kwargs.pop('error_map', {})) - api_version = "2021-06-01" - accept = "application/json" - - # Construct URL - url = self.list.metadata['url'] # type: ignore - path_format_arguments = { - 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), - 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), - 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), - 'applicationName': self._serialize.url("application_name", application_name, 'str'), - } - url = self._client.format_url(url, **path_format_arguments) - - # Construct parameters - query_parameters = {} # type: Dict[str, Any] - query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') - - # Construct headers - header_parameters = {} # type: Dict[str, Any] - header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + error_map.update(kwargs.pop('error_map', {}) or {}) + + _headers = kwargs.pop("headers", {}) or {} + _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) + + api_version = kwargs.pop('api_version', _params.pop('api-version', "2021-06-01")) # type: str + cls = kwargs.pop('cls', None) # type: ClsType[_models.ServiceResourceList] + + + request = build_list_request( + subscription_id=self._config.subscription_id, + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_name=application_name, + api_version=api_version, + template_url=self.list.metadata['url'], + headers=_headers, + params=_params, + ) + request = _convert_request(request) + request.url = self._client.format_url(request.url) # type: ignore - request = self._client.get(url, query_parameters, header_parameters) - pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + pipeline_response = self._client._pipeline.run( # type: ignore # pylint: disable=protected-access + request, + stream=False, + **kwargs + ) response = pipeline_response.http_response if response.status_code not in [200]: map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorModel, response) + error = self._deserialize.failsafe_deserialize(_models.ErrorModel, pipeline_response) raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) deserialized = self._deserialize('ServiceResourceList', pipeline_response) @@ -599,4 +851,6 @@ def list( return cls(pipeline_response, deserialized, {}) return deserialized - list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}/services'} # type: ignore + + list.metadata = {'url': "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/clusters/{clusterName}/applications/{applicationName}/services"} # type: ignore +