From c6580d9ca551930967f8e807becb4876338bc938 Mon Sep 17 00:00:00 2001 From: zhangyan133 <77086185+zhangyan133@users.noreply.github.com> Date: Mon, 1 Mar 2021 10:04:13 +0800 Subject: [PATCH] T2 servicefabricmanagedclusters 2021 02 26 (#16958) * CodeGen from PR 13170 in Azure/azure-rest-api-specs changetotrack2 (#13170) * changetotrack2 * new readme.python.md * some modification Co-authored-by: Yan Zhang (WICRESOFT NORTH AMERICA LTD) * test,version,CHANGELOG * modify changelog&version * modify changelog * delete repetitive usage Co-authored-by: SDKAuto Co-authored-by: Yan Zhang (WICRESOFT NORTH AMERICA LTD) --- .../CHANGELOG.md | 5 + .../MANIFEST.in | 5 + .../README.md | 28 + .../azure/__init__.py | 1 + .../azure/mgmt/__init__.py | 1 + .../servicefabricmanagedclusters/__init__.py | 19 + .../_configuration.py | 71 + .../_metadata.json | 67 + ...bric_managed_clusters_management_client.py | 99 + .../servicefabricmanagedclusters/_version.py | 9 + .../aio/__init__.py | 10 + .../aio/_configuration.py | 67 + ...bric_managed_clusters_management_client.py | 93 + .../aio/operations/__init__.py | 25 + .../_application_type_versions_operations.py | 544 +++ .../_application_types_operations.py | 453 +++ .../operations/_applications_operations.py | 517 +++ .../_managed_clusters_operations.py | 561 +++ .../aio/operations/_node_types_operations.py | 902 +++++ .../aio/operations/_operations.py | 107 + .../aio/operations/_services_operations.py | 547 +++ .../models/__init__.py | 276 ++ .../models/_models.py | 3134 +++++++++++++++ .../models/_models_py3.py | 3442 +++++++++++++++++ ...anaged_clusters_management_client_enums.py | 231 ++ .../operations/__init__.py | 25 + .../_application_type_versions_operations.py | 555 +++ .../_application_types_operations.py | 463 +++ .../operations/_applications_operations.py | 528 +++ .../_managed_clusters_operations.py | 573 +++ .../operations/_node_types_operations.py | 919 +++++ .../operations/_operations.py | 112 + .../operations/_services_operations.py | 558 +++ .../servicefabricmanagedclusters/py.typed | 1 + .../sdk_packaging.toml | 8 + .../setup.cfg | 2 + .../setup.py | 91 + sdk/servicefabricmanagedclusters/ci.yml | 35 + 38 files changed, 15084 insertions(+) create mode 100644 sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/CHANGELOG.md create mode 100644 sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/MANIFEST.in create mode 100644 sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/README.md create mode 100644 sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/__init__.py create mode 100644 sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/__init__.py create mode 100644 sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/__init__.py create mode 100644 sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_configuration.py create mode 100644 sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_metadata.json create mode 100644 sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_service_fabric_managed_clusters_management_client.py create mode 100644 sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_version.py create mode 100644 sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/__init__.py create mode 100644 sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/_configuration.py create mode 100644 sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/_service_fabric_managed_clusters_management_client.py create mode 100644 sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/__init__.py create mode 100644 sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_application_type_versions_operations.py create mode 100644 sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_application_types_operations.py create mode 100644 sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_applications_operations.py create mode 100644 sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_managed_clusters_operations.py create mode 100644 sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_node_types_operations.py create mode 100644 sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_operations.py create mode 100644 sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_services_operations.py create mode 100644 sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/models/__init__.py create mode 100644 sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/models/_models.py create mode 100644 sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/models/_models_py3.py create mode 100644 sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/models/_service_fabric_managed_clusters_management_client_enums.py create mode 100644 sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/__init__.py create mode 100644 sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_application_type_versions_operations.py create mode 100644 sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_application_types_operations.py create mode 100644 sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_applications_operations.py create mode 100644 sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_managed_clusters_operations.py create mode 100644 sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_node_types_operations.py create mode 100644 sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_operations.py create mode 100644 sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_services_operations.py create mode 100644 sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/py.typed create mode 100644 sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/sdk_packaging.toml create mode 100644 sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/setup.cfg create mode 100644 sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/setup.py create mode 100644 sdk/servicefabricmanagedclusters/ci.yml diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/CHANGELOG.md b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/CHANGELOG.md new file mode 100644 index 000000000000..f8121c11f8af --- /dev/null +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/CHANGELOG.md @@ -0,0 +1,5 @@ +# Release History + +## 1.0.0b1 (2021-02-26) + +* Initial Release diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/MANIFEST.in b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/MANIFEST.in new file mode 100644 index 000000000000..a3cb07df8765 --- /dev/null +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/MANIFEST.in @@ -0,0 +1,5 @@ +recursive-include tests *.py *.yaml +include *.md +include azure/__init__.py +include azure/mgmt/__init__.py + diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/README.md b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/README.md new file mode 100644 index 000000000000..6f74019715d8 --- /dev/null +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/README.md @@ -0,0 +1,28 @@ +# Microsoft Azure SDK for Python + +This is the Microsoft Azure Servicefabricmanagedclusters Management Client Library. +This package has been tested with Python 2.7, 3.5, 3.6, 3.7 and 3.8. +For a more complete view of Azure libraries, see the [azure sdk python release](https://aka.ms/azsdk/python/all). + + +# Usage + + +To learn how to use this package, see the [quickstart guide](https://aka.ms/azsdk/python/mgmt) + + + +For docs and references, see [Python SDK References](https://docs.microsoft.com/python/api/overview/azure/) +Code samples for this package can be found at [Servicefabricmanagedclusters Management](https://docs.microsoft.com/samples/browse/?languages=python&term=Getting%20started%20-%20Managing&terms=Getting%20started%20-%20Managing) on docs.microsoft.com. +Additional code samples for different Azure services are available at [Samples Repo](https://aka.ms/azsdk/python/mgmt/samples) + + +# Provide Feedback + +If you encounter any bugs or have suggestions, please file an issue in the +[Issues](https://github.com/Azure/azure-sdk-for-python/issues) +section of the project. + + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-python%2Fazure-mgmt-servicefabricmanagedclusters%2FREADME.png) + diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/__init__.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/__init__.py new file mode 100644 index 000000000000..0260537a02bb --- /dev/null +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/__init__.py @@ -0,0 +1 @@ +__path__ = __import__('pkgutil').extend_path(__path__, __name__) \ No newline at end of file diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/__init__.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/__init__.py new file mode 100644 index 000000000000..0260537a02bb --- /dev/null +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/__init__.py @@ -0,0 +1 @@ +__path__ = __import__('pkgutil').extend_path(__path__, __name__) \ No newline at end of file diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/__init__.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/__init__.py new file mode 100644 index 000000000000..9a2945417823 --- /dev/null +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/__init__.py @@ -0,0 +1,19 @@ +# 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 ._service_fabric_managed_clusters_management_client import ServiceFabricManagedClustersManagementClient +from ._version import VERSION + +__version__ = VERSION +__all__ = ['ServiceFabricManagedClustersManagementClient'] + +try: + from ._patch import patch_sdk # type: ignore + patch_sdk() +except ImportError: + pass diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_configuration.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_configuration.py new file mode 100644 index 000000000000..975f57d040a5 --- /dev/null +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_configuration.py @@ -0,0 +1,71 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import 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 ServiceFabricManagedClustersManagementClientConfiguration(Configuration): + """Configuration for ServiceFabricManagedClustersManagementClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The customer subscription identifier. + :type subscription_id: str + """ + + def __init__( + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + super(ServiceFabricManagedClustersManagementClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2021-01-01-preview" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-servicefabricmanagedclusters/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs # type: Any + ): + # type: (...) -> None + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.BearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_metadata.json b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_metadata.json new file mode 100644 index 000000000000..b80565ec1466 --- /dev/null +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_metadata.json @@ -0,0 +1,67 @@ +{ + "chosen_version": "2021-01-01-preview", + "total_api_version_list": ["2021-01-01-preview"], + "client": { + "name": "ServiceFabricManagedClustersManagementClient", + "filename": "_service_fabric_managed_clusters_management_client", + "description": "Service Fabric Managed Clusters Management Client.", + "base_url": "\u0027https://management.azure.com\u0027", + "custom_base_url": null, + "azure_arm": true, + "has_lro_operations": true, + "client_side_validation": true + }, + "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, # type: \"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, # type: str", + "description": "The customer subscription identifier.", + "docstring_type": "str", + "required": true + } + }, + "constant": { + }, + "call": "credential, subscription_id" + }, + "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 + }, + "operation_groups": { + "application_types": "ApplicationTypesOperations", + "application_type_versions": "ApplicationTypeVersionsOperations", + "applications": "ApplicationsOperations", + "services": "ServicesOperations", + "managed_clusters": "ManagedClustersOperations", + "operations": "Operations", + "node_types": "NodeTypesOperations" + }, + "operation_mixins": { + }, + "sync_imports": "None", + "async_imports": "None" +} \ No newline at end of file diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_service_fabric_managed_clusters_management_client.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_service_fabric_managed_clusters_management_client.py new file mode 100644 index 000000000000..c990f1790a6d --- /dev/null +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_service_fabric_managed_clusters_management_client.py @@ -0,0 +1,99 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import 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 ._configuration import ServiceFabricManagedClustersManagementClientConfiguration +from .operations import ApplicationTypesOperations +from .operations import ApplicationTypeVersionsOperations +from .operations import ApplicationsOperations +from .operations import ServicesOperations +from .operations import ManagedClustersOperations +from .operations import Operations +from .operations import NodeTypesOperations +from . import models + + +class ServiceFabricManagedClustersManagementClient(object): + """Service Fabric Managed Clusters Management Client. + + :ivar application_types: ApplicationTypesOperations operations + :vartype application_types: service_fabric_managed_clusters_management_client.operations.ApplicationTypesOperations + :ivar application_type_versions: ApplicationTypeVersionsOperations operations + :vartype application_type_versions: service_fabric_managed_clusters_management_client.operations.ApplicationTypeVersionsOperations + :ivar applications: ApplicationsOperations operations + :vartype applications: service_fabric_managed_clusters_management_client.operations.ApplicationsOperations + :ivar services: ServicesOperations operations + :vartype services: service_fabric_managed_clusters_management_client.operations.ServicesOperations + :ivar managed_clusters: ManagedClustersOperations operations + :vartype managed_clusters: service_fabric_managed_clusters_management_client.operations.ManagedClustersOperations + :ivar operations: Operations operations + :vartype operations: service_fabric_managed_clusters_management_client.operations.Operations + :ivar node_types: NodeTypesOperations operations + :vartype node_types: service_fabric_managed_clusters_management_client.operations.NodeTypesOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials.TokenCredential + :param subscription_id: The customer subscription identifier. + :type subscription_id: str + :param str base_url: Service URL + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + """ + + def __init__( + self, + credential, # type: "TokenCredential" + subscription_id, # type: str + base_url=None, # type: Optional[str] + **kwargs # type: Any + ): + # type: (...) -> None + if not base_url: + base_url = 'https://management.azure.com' + self._config = ServiceFabricManagedClustersManagementClientConfiguration(credential, subscription_id, **kwargs) + self._client = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + self.application_types = ApplicationTypesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.application_type_versions = ApplicationTypeVersionsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.applications = ApplicationsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.services = ServicesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.managed_clusters = ManagedClustersOperations( + self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize) + self.node_types = NodeTypesOperations( + self._client, self._config, self._serialize, self._deserialize) + + def close(self): + # type: () -> None + self._client.close() + + def __enter__(self): + # type: () -> ServiceFabricManagedClustersManagementClient + self._client.__enter__() + return self + + def __exit__(self, *exc_details): + # type: (Any) -> None + self._client.__exit__(*exc_details) diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_version.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_version.py new file mode 100644 index 000000000000..e5754a47ce68 --- /dev/null +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/_version.py @@ -0,0 +1,9 @@ +# 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. +# -------------------------------------------------------------------------- + +VERSION = "1.0.0b1" diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/__init__.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/__init__.py new file mode 100644 index 000000000000..ee979dc7fea8 --- /dev/null +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/__init__.py @@ -0,0 +1,10 @@ +# 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 ._service_fabric_managed_clusters_management_client import ServiceFabricManagedClustersManagementClient +__all__ = ['ServiceFabricManagedClustersManagementClient'] diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/_configuration.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/_configuration.py new file mode 100644 index 000000000000..d7add0c2634e --- /dev/null +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/_configuration.py @@ -0,0 +1,67 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, TYPE_CHECKING + +from azure.core.configuration import Configuration +from azure.core.pipeline import policies +from azure.mgmt.core.policies import ARMHttpLoggingPolicy + +from .._version import VERSION + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from azure.core.credentials_async import AsyncTokenCredential + + +class ServiceFabricManagedClustersManagementClientConfiguration(Configuration): + """Configuration for ServiceFabricManagedClustersManagementClient. + + Note that all parameters used to create this instance are saved as instance + attributes. + + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The customer subscription identifier. + :type subscription_id: str + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + **kwargs: Any + ) -> None: + if credential is None: + raise ValueError("Parameter 'credential' must not be None.") + if subscription_id is None: + raise ValueError("Parameter 'subscription_id' must not be None.") + super(ServiceFabricManagedClustersManagementClientConfiguration, self).__init__(**kwargs) + + self.credential = credential + self.subscription_id = subscription_id + self.api_version = "2021-01-01-preview" + self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) + kwargs.setdefault('sdk_moniker', 'mgmt-servicefabricmanagedclusters/{}'.format(VERSION)) + self._configure(**kwargs) + + def _configure( + self, + **kwargs: Any + ) -> None: + self.user_agent_policy = kwargs.get('user_agent_policy') or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get('headers_policy') or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get('proxy_policy') or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get('logging_policy') or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get('http_logging_policy') or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get('retry_policy') or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get('custom_hook_policy') or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get('redirect_policy') or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get('authentication_policy') + if self.credential and not self.authentication_policy: + self.authentication_policy = policies.AsyncBearerTokenCredentialPolicy(self.credential, *self.credential_scopes, **kwargs) diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/_service_fabric_managed_clusters_management_client.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/_service_fabric_managed_clusters_management_client.py new file mode 100644 index 000000000000..64fd0b6c6a53 --- /dev/null +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/_service_fabric_managed_clusters_management_client.py @@ -0,0 +1,93 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from typing import Any, Optional, TYPE_CHECKING + +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 ._configuration import ServiceFabricManagedClustersManagementClientConfiguration +from .operations import ApplicationTypesOperations +from .operations import ApplicationTypeVersionsOperations +from .operations import ApplicationsOperations +from .operations import ServicesOperations +from .operations import ManagedClustersOperations +from .operations import Operations +from .operations import NodeTypesOperations +from .. import models + + +class ServiceFabricManagedClustersManagementClient(object): + """Service Fabric Managed Clusters Management Client. + + :ivar application_types: ApplicationTypesOperations operations + :vartype application_types: service_fabric_managed_clusters_management_client.aio.operations.ApplicationTypesOperations + :ivar application_type_versions: ApplicationTypeVersionsOperations operations + :vartype application_type_versions: service_fabric_managed_clusters_management_client.aio.operations.ApplicationTypeVersionsOperations + :ivar applications: ApplicationsOperations operations + :vartype applications: service_fabric_managed_clusters_management_client.aio.operations.ApplicationsOperations + :ivar services: ServicesOperations operations + :vartype services: service_fabric_managed_clusters_management_client.aio.operations.ServicesOperations + :ivar managed_clusters: ManagedClustersOperations operations + :vartype managed_clusters: service_fabric_managed_clusters_management_client.aio.operations.ManagedClustersOperations + :ivar operations: Operations operations + :vartype operations: service_fabric_managed_clusters_management_client.aio.operations.Operations + :ivar node_types: NodeTypesOperations operations + :vartype node_types: service_fabric_managed_clusters_management_client.aio.operations.NodeTypesOperations + :param credential: Credential needed for the client to connect to Azure. + :type credential: ~azure.core.credentials_async.AsyncTokenCredential + :param subscription_id: The customer subscription identifier. + :type subscription_id: str + :param str base_url: Service URL + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + """ + + def __init__( + self, + credential: "AsyncTokenCredential", + subscription_id: str, + base_url: Optional[str] = None, + **kwargs: Any + ) -> None: + if not base_url: + base_url = 'https://management.azure.com' + self._config = ServiceFabricManagedClustersManagementClientConfiguration(credential, subscription_id, **kwargs) + self._client = AsyncARMPipelineClient(base_url=base_url, config=self._config, **kwargs) + + client_models = {k: v for k, v in models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + + self.application_types = ApplicationTypesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.application_type_versions = ApplicationTypeVersionsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.applications = ApplicationsOperations( + self._client, self._config, self._serialize, self._deserialize) + self.services = ServicesOperations( + self._client, self._config, self._serialize, self._deserialize) + self.managed_clusters = ManagedClustersOperations( + self._client, self._config, self._serialize, self._deserialize) + self.operations = Operations( + self._client, self._config, self._serialize, self._deserialize) + self.node_types = NodeTypesOperations( + self._client, self._config, self._serialize, self._deserialize) + + async def close(self) -> None: + await self._client.close() + + async def __aenter__(self) -> "ServiceFabricManagedClustersManagementClient": + await self._client.__aenter__() + return self + + async def __aexit__(self, *exc_details) -> None: + await self._client.__aexit__(*exc_details) diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/__init__.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/__init__.py new file mode 100644 index 000000000000..613aba52b2a2 --- /dev/null +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/__init__.py @@ -0,0 +1,25 @@ +# 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 ._application_types_operations import ApplicationTypesOperations +from ._application_type_versions_operations import ApplicationTypeVersionsOperations +from ._applications_operations import ApplicationsOperations +from ._services_operations import ServicesOperations +from ._managed_clusters_operations import ManagedClustersOperations +from ._operations import Operations +from ._node_types_operations import NodeTypesOperations + +__all__ = [ + 'ApplicationTypesOperations', + 'ApplicationTypeVersionsOperations', + 'ApplicationsOperations', + 'ServicesOperations', + 'ManagedClustersOperations', + 'Operations', + 'NodeTypesOperations', +] diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_application_type_versions_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_application_type_versions_operations.py new file mode 100644 index 000000000000..2258aa3841e6 --- /dev/null +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_application_type_versions_operations.py @@ -0,0 +1,544 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +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. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~service_fabric_managed_clusters_management_client.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + resource_group_name: str, + cluster_name: str, + application_type_name: str, + version: str, + **kwargs + ) -> "_models.ApplicationTypeVersionResource": + """Gets a Service Fabric managed application type version resource. + + Get a Service Fabric managed application type version resource created or in the process of + being created in the Service Fabric managed application type name resource. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. + :type cluster_name: str + :param application_type_name: The name of the application type name resource. + :type application_type_name: str + :param version: The application type version. + :type version: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ApplicationTypeVersionResource, or the result of cls(response) + :rtype: ~service_fabric_managed_clusters_management_client.models.ApplicationTypeVersionResource + :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-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'applicationTypeName': self._serialize.url("application_type_name", application_type_name, 'str'), + 'version': self._serialize.url("version", version, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorModel, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ApplicationTypeVersionResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applicationTypes/{applicationTypeName}/versions/{version}'} # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + cluster_name: str, + application_type_name: str, + version: str, + parameters: "_models.ApplicationTypeVersionResource", + **kwargs + ) -> "_models.ApplicationTypeVersionResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationTypeVersionResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + '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) + 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(_models.ErrorModel, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ApplicationTypeVersionResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('ApplicationTypeVersionResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applicationTypes/{applicationTypeName}/versions/{version}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + cluster_name: str, + application_type_name: str, + version: str, + parameters: "_models.ApplicationTypeVersionResource", + **kwargs + ) -> AsyncLROPoller["_models.ApplicationTypeVersionResource"]: + """Creates or updates a Service Fabric managed application type version resource. + + Create or update a Service Fabric managed application type version resource with the specified + name. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. + :type cluster_name: str + :param application_type_name: The name of the application type name resource. + :type application_type_name: str + :param version: The application type version. + :type version: str + :param parameters: The application type version resource. + :type parameters: ~service_fabric_managed_clusters_management_client.models.ApplicationTypeVersionResource + :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: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ApplicationTypeVersionResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~service_fabric_managed_clusters_management_client.models.ApplicationTypeVersionResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + 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( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_type_name=application_type_name, + version=version, + parameters=parameters, + cls=lambda x,y,z: x, + **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, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applicationTypes/{applicationTypeName}/versions/{version}'} # type: ignore + + async def update( + self, + resource_group_name: str, + cluster_name: str, + application_type_name: str, + version: str, + parameters: "_models.ApplicationTypeVersionUpdateParameters", + **kwargs + ) -> "_models.ApplicationTypeVersionResource": + """Updates the tags of an application type version resource of a given managed cluster. + + Updates the tags of an application type version resource of a given managed cluster. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. + :type cluster_name: str + :param application_type_name: The name of the application type name resource. + :type application_type_name: str + :param version: The application type version. + :type version: str + :param parameters: The application type version resource updated tags. + :type parameters: ~service_fabric_managed_clusters_management_client.models.ApplicationTypeVersionUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ApplicationTypeVersionResource, or the result of cls(response) + :rtype: ~service_fabric_managed_clusters_management_client.models.ApplicationTypeVersionResource + :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-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'applicationTypeName': self._serialize.url("application_type_name", application_type_name, 'str'), + 'version': self._serialize.url("version", version, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # 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, 'ApplicationTypeVersionUpdateParameters') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorModel, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ApplicationTypeVersionResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applicationTypes/{applicationTypeName}/versions/{version}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + cluster_name: str, + application_type_name: str, + version: str, + **kwargs + ) -> 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-01-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'applicationTypeName': self._serialize.url("application_type_name", application_type_name, 'str'), + 'version': self._serialize.url("version", version, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorModel, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applicationTypes/{applicationTypeName}/versions/{version}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + cluster_name: str, + application_type_name: str, + version: str, + **kwargs + ) -> AsyncLROPoller[None]: + """Deletes a Service Fabric managed application type version resource. + + Delete a Service Fabric managed application type version resource with the specified name. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. + :type cluster_name: str + :param application_type_name: The name of the application type name resource. + :type application_type_name: str + :param version: The application type version. + :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: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_type_name=application_type_name, + version=version, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'applicationTypeName': self._serialize.url("application_type_name", application_type_name, 'str'), + 'version': self._serialize.url("version", version, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applicationTypes/{applicationTypeName}/versions/{version}'} # type: ignore + + def list_by_application_types( + self, + resource_group_name: str, + cluster_name: str, + application_type_name: str, + **kwargs + ) -> AsyncIterable["_models.ApplicationTypeVersionResourceList"]: + """Gets the list of application type version resources created in the specified Service Fabric managed application type name resource. + + Gets all application type version resources created or in the process of being created in the + Service Fabric managed application type name resource. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. + :type cluster_name: str + :param application_type_name: The name of the application type name resource. + :type application_type_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ApplicationTypeVersionResourceList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~service_fabric_managed_clusters_management_client.models.ApplicationTypeVersionResourceList] + :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-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_application_types.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'applicationTypeName': self._serialize.url("application_type_name", application_type_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ApplicationTypeVersionResourceList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(_models.ErrorModel, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_application_types.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applicationTypes/{applicationTypeName}/versions'} # type: ignore diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_application_types_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_application_types_operations.py new file mode 100644 index 000000000000..0696e474977d --- /dev/null +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_application_types_operations.py @@ -0,0 +1,453 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +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. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~service_fabric_managed_clusters_management_client.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + resource_group_name: str, + cluster_name: str, + application_type_name: str, + **kwargs + ) -> "_models.ApplicationTypeResource": + """Gets a Service Fabric managed application type name resource. + + Get a Service Fabric application type name resource created or in the process of being created + in the Service Fabric managed cluster resource. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. + :type cluster_name: str + :param application_type_name: The name of the application type name resource. + :type application_type_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ApplicationTypeResource, or the result of cls(response) + :rtype: ~service_fabric_managed_clusters_management_client.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-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'applicationTypeName': self._serialize.url("application_type_name", application_type_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorModel, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ApplicationTypeResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applicationTypes/{applicationTypeName}'} # type: ignore + + async def create_or_update( + self, + resource_group_name: str, + cluster_name: str, + application_type_name: str, + parameters: "_models.ApplicationTypeResource", + **kwargs + ) -> "_models.ApplicationTypeResource": + """Creates or updates a Service Fabric managed application type name resource. + + Create or update a Service Fabric managed application type name resource with the specified + name. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. + :type cluster_name: str + :param application_type_name: The name of the application type name resource. + :type application_type_name: str + :param parameters: The application type name resource. + :type parameters: ~service_fabric_managed_clusters_management_client.models.ApplicationTypeResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ApplicationTypeResource, or the result of cls(response) + :rtype: ~service_fabric_managed_clusters_management_client.models.ApplicationTypeResource + :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-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + '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) + 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(_models.ErrorModel, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ApplicationTypeResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applicationTypes/{applicationTypeName}'} # type: ignore + + async def update( + self, + resource_group_name: str, + cluster_name: str, + application_type_name: str, + parameters: "_models.ApplicationTypeUpdateParameters", + **kwargs + ) -> "_models.ApplicationTypeResource": + """Updates the tags of an application type resource of a given managed cluster. + + Updates the tags of an application type resource of a given managed cluster. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. + :type cluster_name: str + :param application_type_name: The name of the application type name resource. + :type application_type_name: str + :param parameters: The application type resource updated tags. + :type parameters: ~service_fabric_managed_clusters_management_client.models.ApplicationTypeUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ApplicationTypeResource, or the result of cls(response) + :rtype: ~service_fabric_managed_clusters_management_client.models.ApplicationTypeResource + :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-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'applicationTypeName': self._serialize.url("application_type_name", application_type_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # 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, 'ApplicationTypeUpdateParameters') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorModel, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ApplicationTypeResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applicationTypes/{applicationTypeName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + cluster_name: str, + application_type_name: str, + **kwargs + ) -> 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-01-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'applicationTypeName': self._serialize.url("application_type_name", application_type_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorModel, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applicationTypes/{applicationTypeName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + cluster_name: str, + application_type_name: str, + **kwargs + ) -> AsyncLROPoller[None]: + """Deletes a Service Fabric managed application type name resource. + + Delete a Service Fabric managed application type name resource with the specified name. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. + :type cluster_name: str + :param application_type_name: The name of the application type name resource. + :type application_type_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_type_name=application_type_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'applicationTypeName': self._serialize.url("application_type_name", application_type_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applicationTypes/{applicationTypeName}'} # type: ignore + + def list( + self, + resource_group_name: str, + cluster_name: str, + **kwargs + ) -> AsyncIterable["_models.ApplicationTypeResourceList"]: + """Gets the list of application type name resources created in the specified Service Fabric managed cluster resource. + + Gets all application type name resources created or in the process of being created in the + Service Fabric managed cluster resource. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. + :type cluster_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ApplicationTypeResourceList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~service_fabric_managed_clusters_management_client.models.ApplicationTypeResourceList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationTypeResourceList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ApplicationTypeResourceList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(_models.ErrorModel, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applicationTypes'} # type: ignore diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_applications_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_applications_operations.py new file mode 100644 index 000000000000..91e76a80f46b --- /dev/null +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_applications_operations.py @@ -0,0 +1,517 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +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. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~service_fabric_managed_clusters_management_client.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + resource_group_name: str, + cluster_name: str, + application_name: str, + **kwargs + ) -> "_models.ApplicationResource": + """Gets a Service Fabric managed application resource. + + Get a Service Fabric managed application resource created or in the process of being created in + the Service Fabric cluster resource. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. + :type cluster_name: str + :param application_name: The name of the application resource. + :type application_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ApplicationResource, or the result of cls(response) + :rtype: ~service_fabric_managed_clusters_management_client.models.ApplicationResource + :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-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'applicationName': self._serialize.url("application_name", application_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorModel, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ApplicationResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applications/{applicationName}'} # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + cluster_name: str, + application_name: str, + parameters: "_models.ApplicationResource", + **kwargs + ) -> "_models.ApplicationResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + '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) + 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(_models.ErrorModel, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ApplicationResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('ApplicationResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applications/{applicationName}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + cluster_name: str, + application_name: str, + parameters: "_models.ApplicationResource", + **kwargs + ) -> AsyncLROPoller["_models.ApplicationResource"]: + """Creates or updates a Service Fabric managed application resource. + + Create or update a Service Fabric managed application resource with the specified name. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. + :type cluster_name: str + :param application_name: The name of the application resource. + :type application_name: str + :param parameters: The application resource. + :type parameters: ~service_fabric_managed_clusters_management_client.models.ApplicationResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ApplicationResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~service_fabric_managed_clusters_management_client.models.ApplicationResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + 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( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_name=application_name, + parameters=parameters, + cls=lambda x,y,z: x, + **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, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applications/{applicationName}'} # type: ignore + + async def update( + self, + resource_group_name: str, + cluster_name: str, + application_name: str, + parameters: "_models.ApplicationUpdateParameters", + **kwargs + ) -> "_models.ApplicationResource": + """Updates the tags of an application resource of a given managed cluster. + + Updates the tags of an application resource of a given managed cluster. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. + :type cluster_name: str + :param application_name: The name of the application resource. + :type application_name: str + :param parameters: The application resource updated tags. + :type parameters: ~service_fabric_managed_clusters_management_client.models.ApplicationUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ApplicationResource, or the result of cls(response) + :rtype: ~service_fabric_managed_clusters_management_client.models.ApplicationResource + :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-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'applicationName': self._serialize.url("application_name", application_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # 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, 'ApplicationUpdateParameters') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorModel, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ApplicationResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applications/{applicationName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + cluster_name: str, + application_name: str, + **kwargs + ) -> 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-01-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'applicationName': self._serialize.url("application_name", application_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorModel, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applications/{applicationName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + cluster_name: str, + application_name: str, + **kwargs + ) -> AsyncLROPoller[None]: + """Deletes a Service Fabric managed application resource. + + Delete a Service Fabric managed application resource with the specified name. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. + :type cluster_name: str + :param application_name: The name of the application resource. + :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: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_name=application_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'applicationName': self._serialize.url("application_name", application_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applications/{applicationName}'} # type: ignore + + def list( + self, + resource_group_name: str, + cluster_name: str, + **kwargs + ) -> AsyncIterable["_models.ApplicationResourceList"]: + """Gets the list of managed application resources created in the specified Service Fabric cluster resource. + + Gets all managed application resources created or in the process of being created in the + Service Fabric cluster resource. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. + :type cluster_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ApplicationResourceList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~service_fabric_managed_clusters_management_client.models.ApplicationResourceList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationResourceList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ApplicationResourceList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(_models.ErrorModel, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applications'} # type: ignore diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_managed_clusters_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_managed_clusters_operations.py new file mode 100644 index 000000000000..0af10812c863 --- /dev/null +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_managed_clusters_operations.py @@ -0,0 +1,561 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class ManagedClustersOperations: + """ManagedClustersOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~service_fabric_managed_clusters_management_client.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_by_resource_group( + self, + resource_group_name: str, + **kwargs + ) -> AsyncIterable["_models.ManagedClusterListResult"]: + """Gets the list of Service Fabric cluster resources created in the specified resource group. + + Gets all Service Fabric cluster resources created or in the process of being created in the + resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ManagedClusterListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~service_fabric_managed_clusters_management_client.models.ManagedClusterListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ManagedClusterListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(_models.ErrorModel, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters'} # type: ignore + + def list_by_subscription( + self, + **kwargs + ) -> AsyncIterable["_models.ManagedClusterListResult"]: + """Gets the list of Service Fabric cluster resources created in the specified subscription. + + Gets all Service Fabric cluster resources created or in the process of being created in the + subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ManagedClusterListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~service_fabric_managed_clusters_management_client.models.ManagedClusterListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ManagedClusterListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(_models.ErrorModel, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/managedClusters'} # type: ignore + + async def get( + self, + resource_group_name: str, + cluster_name: str, + **kwargs + ) -> "_models.ManagedCluster": + """Gets a Service Fabric managed cluster resource. + + Get a Service Fabric managed cluster resource created or in the process of being created in the + specified resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. + :type cluster_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedCluster, or the result of cls(response) + :rtype: ~service_fabric_managed_clusters_management_client.models.ManagedCluster + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorModel, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ManagedCluster', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}'} # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + cluster_name: str, + parameters: "_models.ManagedCluster", + **kwargs + ) -> "_models.ManagedCluster": + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + '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, 'ManagedCluster') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorModel, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ManagedCluster', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('ManagedCluster', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + cluster_name: str, + parameters: "_models.ManagedCluster", + **kwargs + ) -> AsyncLROPoller["_models.ManagedCluster"]: + """Creates or updates a Service Fabric managed cluster resource. + + Create or update a Service Fabric managed cluster resource with the specified name. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. + :type cluster_name: str + :param parameters: The cluster resource. + :type parameters: ~service_fabric_managed_clusters_management_client.models.ManagedCluster + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ManagedCluster or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~service_fabric_managed_clusters_management_client.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('ManagedCluster', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}'} # type: ignore + + async def update( + self, + resource_group_name: str, + cluster_name: str, + parameters: "_models.ManagedClusterUpdateParameters", + **kwargs + ) -> "_models.ManagedCluster": + """Updates the tags of of a Service Fabric managed cluster resource. + + Update the tags of of a Service Fabric managed cluster resource with the specified name. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. + :type cluster_name: str + :param parameters: The managed cluster resource updated tags. + :type parameters: ~service_fabric_managed_clusters_management_client.models.ManagedClusterUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedCluster, or the result of cls(response) + :rtype: ~service_fabric_managed_clusters_management_client.models.ManagedCluster + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # 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, 'ManagedClusterUpdateParameters') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorModel, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ManagedCluster', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + cluster_name: str, + **kwargs + ) -> 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-01-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorModel, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + cluster_name: str, + **kwargs + ) -> AsyncLROPoller[None]: + """Deletes a Service Fabric managed cluster resource. + + Delete a Service Fabric managed cluster resource with the specified name. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. + :type cluster_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}'} # type: ignore diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_node_types_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_node_types_operations.py new file mode 100644 index 000000000000..6b01591baf03 --- /dev/null +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_node_types_operations.py @@ -0,0 +1,902 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class NodeTypesOperations: + """NodeTypesOperations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~service_fabric_managed_clusters_management_client.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_by_managed_clusters( + self, + resource_group_name: str, + cluster_name: str, + **kwargs + ) -> AsyncIterable["_models.NodeTypeListResult"]: + """Gets the list of Node types of the specified managed cluster. + + Gets all Node types of the specified managed cluster. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. + :type cluster_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NodeTypeListResult or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~service_fabric_managed_clusters_management_client.models.NodeTypeListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NodeTypeListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_managed_clusters.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('NodeTypeListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(_models.ErrorModel, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_managed_clusters.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/nodeTypes'} # type: ignore + + async def _restart_initial( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: "_models.NodeTypeActionParameters", + **kwargs + ) -> 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-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._restart_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'nodeTypeName': self._serialize.url("node_type_name", node_type_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # 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, 'NodeTypeActionParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorModel, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/nodeTypes/{nodeTypeName}/restart'} # type: ignore + + async def begin_restart( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: "_models.NodeTypeActionParameters", + **kwargs + ) -> AsyncLROPoller[None]: + """Restarts one or more nodes on the node type. + + Restarts one or more nodes on the node type. It will disable the fabric nodes, trigger a + restart on the VMs and activate the nodes back again. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. + :type cluster_name: str + :param node_type_name: The name of the node type. + :type node_type_name: str + :param parameters: parameters for restart action. + :type parameters: ~service_fabric_managed_clusters_management_client.models.NodeTypeActionParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._restart_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + node_type_name=node_type_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'nodeTypeName': self._serialize.url("node_type_name", node_type_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_restart.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/nodeTypes/{nodeTypeName}/restart'} # type: ignore + + async def _reimage_initial( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: "_models.NodeTypeActionParameters", + **kwargs + ) -> 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-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._reimage_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'nodeTypeName': self._serialize.url("node_type_name", node_type_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # 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, 'NodeTypeActionParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorModel, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/nodeTypes/{nodeTypeName}/reimage'} # type: ignore + + async def begin_reimage( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: "_models.NodeTypeActionParameters", + **kwargs + ) -> AsyncLROPoller[None]: + """Reimages one or more nodes on the node type. + + Reimages one or more nodes on the node type. It will disable the fabric nodes, trigger a + reimage on the VMs and activate the nodes back again. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. + :type cluster_name: str + :param node_type_name: The name of the node type. + :type node_type_name: str + :param parameters: parameters for reimage action. + :type parameters: ~service_fabric_managed_clusters_management_client.models.NodeTypeActionParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._reimage_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + node_type_name=node_type_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'nodeTypeName': self._serialize.url("node_type_name", node_type_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_reimage.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/nodeTypes/{nodeTypeName}/reimage'} # type: ignore + + async def _delete_node_initial( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: "_models.NodeTypeActionParameters", + **kwargs + ) -> 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-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._delete_node_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'nodeTypeName': self._serialize.url("node_type_name", node_type_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # 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, 'NodeTypeActionParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorModel, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_node_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/nodeTypes/{nodeTypeName}/deleteNode'} # type: ignore + + async def begin_delete_node( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: "_models.NodeTypeActionParameters", + **kwargs + ) -> AsyncLROPoller[None]: + """Deletes one or more nodes on the node type. + + Deletes one or more nodes on the node type. It will disable the fabric nodes, trigger a delete + on the VMs and removes the state from the cluster. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. + :type cluster_name: str + :param node_type_name: The name of the node type. + :type node_type_name: str + :param parameters: parameters for delete action. + :type parameters: ~service_fabric_managed_clusters_management_client.models.NodeTypeActionParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_node_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + node_type_name=node_type_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'nodeTypeName': self._serialize.url("node_type_name", node_type_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete_node.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/nodeTypes/{nodeTypeName}/deleteNode'} # type: ignore + + async def get( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + **kwargs + ) -> "_models.NodeType": + """Gets a Service Fabric node type. + + Get a Service Fabric node type of a given managed cluster. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. + :type cluster_name: str + :param node_type_name: The name of the node type. + :type node_type_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NodeType, or the result of cls(response) + :rtype: ~service_fabric_managed_clusters_management_client.models.NodeType + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NodeType"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'nodeTypeName': self._serialize.url("node_type_name", node_type_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorModel, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('NodeType', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/nodeTypes/{nodeTypeName}'} # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: "_models.NodeType", + **kwargs + ) -> "_models.NodeType": + cls = kwargs.pop('cls', None) # type: ClsType["_models.NodeType"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'nodeTypeName': self._serialize.url("node_type_name", node_type_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['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, 'NodeType') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorModel, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('NodeType', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('NodeType', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/nodeTypes/{nodeTypeName}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: "_models.NodeType", + **kwargs + ) -> AsyncLROPoller["_models.NodeType"]: + """Creates or updates a Service Fabric node type. + + Create or update a Service Fabric node type of a given managed cluster. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. + :type cluster_name: str + :param node_type_name: The name of the node type. + :type node_type_name: str + :param parameters: The node type resource. + :type parameters: ~service_fabric_managed_clusters_management_client.models.NodeType + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either NodeType or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~service_fabric_managed_clusters_management_client.models.NodeType] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.NodeType"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._create_or_update_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + node_type_name=node_type_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('NodeType', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'nodeTypeName': self._serialize.url("node_type_name", node_type_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/nodeTypes/{nodeTypeName}'} # type: ignore + + async def update( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + parameters: "_models.NodeTypeUpdateParameters", + **kwargs + ) -> "_models.NodeType": + """Update the tags of a node type resource of a given managed cluster. + + Update the configuration of a node type of a given managed cluster, only updating tags. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. + :type cluster_name: str + :param node_type_name: The name of the node type. + :type node_type_name: str + :param parameters: The parameters to update the node type configuration. + :type parameters: ~service_fabric_managed_clusters_management_client.models.NodeTypeUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NodeType, or the result of cls(response) + :rtype: ~service_fabric_managed_clusters_management_client.models.NodeType + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NodeType"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'nodeTypeName': self._serialize.url("node_type_name", node_type_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # 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, 'NodeTypeUpdateParameters') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorModel, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('NodeType', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/nodeTypes/{nodeTypeName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + **kwargs + ) -> 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-01-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'nodeTypeName': self._serialize.url("node_type_name", node_type_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorModel, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/nodeTypes/{nodeTypeName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + cluster_name: str, + node_type_name: str, + **kwargs + ) -> AsyncLROPoller[None]: + """Deletes a Service Fabric node type. + + Delete a Service Fabric node type of a given managed cluster. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. + :type cluster_name: str + :param node_type_name: The name of the node type. + :type node_type_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + node_type_name=node_type_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'nodeTypeName': self._serialize.url("node_type_name", node_type_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/nodeTypes/{nodeTypeName}'} # type: ignore diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_operations.py new file mode 100644 index 000000000000..5cf43c5c972a --- /dev/null +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_operations.py @@ -0,0 +1,107 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.mgmt.core.exceptions import ARMErrorFormat + +from ... import models as _models + +T = TypeVar('T') +ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] + +class Operations: + """Operations async operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~service_fabric_managed_clusters_management_client.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + **kwargs + ) -> 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[~service_fabric_managed_clusters_management_client.models.OperationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('OperationListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(_models.ErrorModel, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + 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 diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_services_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_services_operations.py new file mode 100644 index 000000000000..eabcaf551deb --- /dev/null +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/aio/operations/_services_operations.py @@ -0,0 +1,547 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import Any, AsyncIterable, Callable, Dict, Generic, Optional, TypeVar, Union +import warnings + +from azure.core.async_paging import AsyncItemPaged, AsyncList +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import AsyncHttpResponse, HttpRequest +from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling + +from ... import models as _models + +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. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~service_fabric_managed_clusters_management_client.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer) -> None: + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + async def get( + self, + resource_group_name: str, + cluster_name: str, + application_name: str, + service_name: str, + **kwargs + ) -> "_models.ServiceResource": + """Gets a Service Fabric managed service resource. + + Get a Service Fabric service resource created or in the process of being created in the Service + Fabric managed application resource. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. + :type cluster_name: str + :param application_name: The name of the application resource. + :type application_name: str + :param service_name: The name of the service resource in the format of + {applicationName}~{serviceName}. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ServiceResource, or the result of cls(response) + :rtype: ~service_fabric_managed_clusters_management_client.models.ServiceResource + :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-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'applicationName': self._serialize.url("application_name", application_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorModel, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ServiceResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applications/{applicationName}/services/{serviceName}'} # type: ignore + + async def _create_or_update_initial( + self, + resource_group_name: str, + cluster_name: str, + application_name: str, + service_name: str, + parameters: "_models.ServiceResource", + **kwargs + ) -> "_models.ServiceResource": + cls = kwargs.pop('cls', None) # type: ClsType["_models.ServiceResource"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + '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) + 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(_models.ErrorModel, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ServiceResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('ServiceResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applications/{applicationName}/services/{serviceName}'} # type: ignore + + async def begin_create_or_update( + self, + resource_group_name: str, + cluster_name: str, + application_name: str, + service_name: str, + parameters: "_models.ServiceResource", + **kwargs + ) -> AsyncLROPoller["_models.ServiceResource"]: + """Creates or updates a Service Fabric managed service resource. + + Create or update a Service Fabric managed service resource with the specified name. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. + :type cluster_name: str + :param application_name: The name of the application resource. + :type application_name: str + :param service_name: The name of the service resource in the format of + {applicationName}~{serviceName}. + :type service_name: str + :param parameters: The service resource. + :type parameters: ~service_fabric_managed_clusters_management_client.models.ServiceResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either ServiceResource or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[~service_fabric_managed_clusters_management_client.models.ServiceResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + 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( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_name=application_name, + service_name=service_name, + parameters=parameters, + cls=lambda x,y,z: x, + **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, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applications/{applicationName}/services/{serviceName}'} # type: ignore + + async def update( + self, + resource_group_name: str, + cluster_name: str, + application_name: str, + service_name: str, + parameters: "_models.ServiceUpdateParameters", + **kwargs + ) -> "_models.ServiceResource": + """Updates the tags of a service resource of a given managed cluster. + + Updates the tags of a service resource of a given managed cluster. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. + :type cluster_name: str + :param application_name: The name of the application resource. + :type application_name: str + :param service_name: The name of the service resource in the format of + {applicationName}~{serviceName}. + :type service_name: str + :param parameters: The service resource updated tags. + :type parameters: ~service_fabric_managed_clusters_management_client.models.ServiceUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ServiceResource, or the result of cls(response) + :rtype: ~service_fabric_managed_clusters_management_client.models.ServiceResource + :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-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'applicationName': self._serialize.url("application_name", application_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # 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, 'ServiceUpdateParameters') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorModel, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ServiceResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applications/{applicationName}/services/{serviceName}'} # type: ignore + + async def _delete_initial( + self, + resource_group_name: str, + cluster_name: str, + application_name: str, + service_name: str, + **kwargs + ) -> 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-01-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'applicationName': self._serialize.url("application_name", application_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorModel, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applications/{applicationName}/services/{serviceName}'} # type: ignore + + async def begin_delete( + self, + resource_group_name: str, + cluster_name: str, + application_name: str, + service_name: str, + **kwargs + ) -> AsyncLROPoller[None]: + """Deletes a Service Fabric managed service resource. + + Delete a Service Fabric managed service resource with the specified name. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. + :type cluster_name: str + :param application_name: The name of the application resource. + :type application_name: str + :param service_name: The name of the service resource in the format of + {applicationName}~{serviceName}. + :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: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of AsyncLROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.AsyncLROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, AsyncPollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = await self._delete_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_name=application_name, + service_name=service_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'applicationName': self._serialize.url("application_name", application_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + + if polling is True: polling_method = AsyncARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = AsyncNoPolling() + else: polling_method = polling + if cont_token: + return AsyncLROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applications/{applicationName}/services/{serviceName}'} # type: ignore + + def list_by_applications( + self, + resource_group_name: str, + cluster_name: str, + application_name: str, + **kwargs + ) -> AsyncIterable["_models.ServiceResourceList"]: + """Gets the list of service resources created in the specified Service Fabric managed application resource. + + Gets all service resources created or in the process of being created in the Service Fabric + managed application resource. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. + :type cluster_name: str + :param application_name: The name of the application resource. + :type application_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ServiceResourceList or the result of cls(response) + :rtype: ~azure.core.async_paging.AsyncItemPaged[~service_fabric_managed_clusters_management_client.models.ServiceResourceList] + :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-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_applications.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'applicationName': self._serialize.url("application_name", application_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + async def extract_data(pipeline_response): + deserialized = self._deserialize('ServiceResourceList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, AsyncList(list_of_elem) + + async def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = await self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(_models.ErrorModel, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return AsyncItemPaged( + get_next, extract_data + ) + list_by_applications.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applications/{applicationName}/services'} # type: ignore diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/models/__init__.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/models/__init__.py new file mode 100644 index 000000000000..bc02491d4d47 --- /dev/null +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/models/__init__.py @@ -0,0 +1,276 @@ +# 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. +# -------------------------------------------------------------------------- + +try: + from ._models_py3 import AddRemoveIncrementalNamedPartitionScalingMechanism + from ._models_py3 import ApplicationHealthPolicy + from ._models_py3 import ApplicationResource + from ._models_py3 import ApplicationResourceList + from ._models_py3 import ApplicationTypeResource + from ._models_py3 import ApplicationTypeResourceList + from ._models_py3 import ApplicationTypeUpdateParameters + from ._models_py3 import ApplicationTypeVersionResource + from ._models_py3 import ApplicationTypeVersionResourceList + from ._models_py3 import ApplicationTypeVersionUpdateParameters + from ._models_py3 import ApplicationTypeVersionsCleanupPolicy + from ._models_py3 import ApplicationUpdateParameters + from ._models_py3 import ApplicationUpgradePolicy + from ._models_py3 import ApplicationUserAssignedIdentity + from ._models_py3 import AvailableOperationDisplay + from ._models_py3 import AveragePartitionLoadScalingTrigger + from ._models_py3 import AverageServiceLoadScalingTrigger + from ._models_py3 import AzureActiveDirectory + from ._models_py3 import ClientCertificate + from ._models_py3 import EndpointRangeDescription + from ._models_py3 import ErrorModel + from ._models_py3 import ErrorModelError + from ._models_py3 import LoadBalancingRule + from ._models_py3 import ManagedCluster + from ._models_py3 import ManagedClusterListResult + from ._models_py3 import ManagedClusterUpdateParameters + from ._models_py3 import ManagedIdentity + from ._models_py3 import ManagedProxyResource + from ._models_py3 import NamedPartitionScheme + from ._models_py3 import NetworkSecurityRule + from ._models_py3 import NodeType + from ._models_py3 import NodeTypeActionParameters + from ._models_py3 import NodeTypeListResult + from ._models_py3 import NodeTypeUpdateParameters + from ._models_py3 import OperationListResult + from ._models_py3 import OperationResult + from ._models_py3 import Partition + from ._models_py3 import PartitionInstanceCountScaleMechanism + from ._models_py3 import ProxyResource + from ._models_py3 import Resource + from ._models_py3 import RollingUpgradeMonitoringPolicy + from ._models_py3 import ScalingMechanism + from ._models_py3 import ScalingPolicy + from ._models_py3 import ScalingTrigger + from ._models_py3 import ServiceCorrelation + from ._models_py3 import ServiceLoadMetric + from ._models_py3 import ServicePlacementInvalidDomainPolicy + from ._models_py3 import ServicePlacementNonPartiallyPlaceServicePolicy + from ._models_py3 import ServicePlacementPolicy + from ._models_py3 import ServicePlacementPreferPrimaryDomainPolicy + from ._models_py3 import ServicePlacementRequireDomainDistributionPolicy + from ._models_py3 import ServicePlacementRequiredDomainPolicy + from ._models_py3 import ServiceResource + from ._models_py3 import ServiceResourceList + from ._models_py3 import ServiceResourceProperties + from ._models_py3 import ServiceResourcePropertiesBase + from ._models_py3 import ServiceTypeHealthPolicy + from ._models_py3 import ServiceUpdateParameters + from ._models_py3 import SettingsParameterDescription + from ._models_py3 import SettingsSectionDescription + from ._models_py3 import SingletonPartitionScheme + from ._models_py3 import Sku + from ._models_py3 import StatefulServiceProperties + from ._models_py3 import StatelessServiceProperties + from ._models_py3 import SubResource + from ._models_py3 import SystemData + from ._models_py3 import UniformInt64RangePartitionScheme + from ._models_py3 import UserAssignedIdentity + from ._models_py3 import VMSSExtension + from ._models_py3 import VaultCertificate + from ._models_py3 import VaultSecretGroup + from ._models_py3 import VmManagedIdentity +except (SyntaxError, ImportError): + from ._models import AddRemoveIncrementalNamedPartitionScalingMechanism # type: ignore + from ._models import ApplicationHealthPolicy # type: ignore + from ._models import ApplicationResource # type: ignore + from ._models import ApplicationResourceList # type: ignore + from ._models import ApplicationTypeResource # type: ignore + from ._models import ApplicationTypeResourceList # type: ignore + from ._models import ApplicationTypeUpdateParameters # type: ignore + from ._models import ApplicationTypeVersionResource # type: ignore + from ._models import ApplicationTypeVersionResourceList # type: ignore + from ._models import ApplicationTypeVersionUpdateParameters # type: ignore + from ._models import ApplicationTypeVersionsCleanupPolicy # type: ignore + from ._models import ApplicationUpdateParameters # type: ignore + from ._models import ApplicationUpgradePolicy # type: ignore + from ._models import ApplicationUserAssignedIdentity # type: ignore + from ._models import AvailableOperationDisplay # type: ignore + from ._models import AveragePartitionLoadScalingTrigger # type: ignore + from ._models import AverageServiceLoadScalingTrigger # type: ignore + from ._models import AzureActiveDirectory # type: ignore + from ._models import ClientCertificate # type: ignore + from ._models import EndpointRangeDescription # type: ignore + from ._models import ErrorModel # type: ignore + from ._models import ErrorModelError # type: ignore + from ._models import LoadBalancingRule # type: ignore + from ._models import ManagedCluster # type: ignore + from ._models import ManagedClusterListResult # type: ignore + from ._models import ManagedClusterUpdateParameters # type: ignore + from ._models import ManagedIdentity # type: ignore + from ._models import ManagedProxyResource # type: ignore + from ._models import NamedPartitionScheme # type: ignore + from ._models import NetworkSecurityRule # type: ignore + from ._models import NodeType # type: ignore + from ._models import NodeTypeActionParameters # type: ignore + from ._models import NodeTypeListResult # type: ignore + from ._models import NodeTypeUpdateParameters # type: ignore + from ._models import OperationListResult # type: ignore + from ._models import OperationResult # type: ignore + from ._models import Partition # type: ignore + from ._models import PartitionInstanceCountScaleMechanism # type: ignore + from ._models import ProxyResource # type: ignore + from ._models import Resource # type: ignore + from ._models import RollingUpgradeMonitoringPolicy # type: ignore + from ._models import ScalingMechanism # type: ignore + from ._models import ScalingPolicy # type: ignore + from ._models import ScalingTrigger # type: ignore + from ._models import ServiceCorrelation # type: ignore + from ._models import ServiceLoadMetric # type: ignore + from ._models import ServicePlacementInvalidDomainPolicy # type: ignore + from ._models import ServicePlacementNonPartiallyPlaceServicePolicy # type: ignore + from ._models import ServicePlacementPolicy # type: ignore + from ._models import ServicePlacementPreferPrimaryDomainPolicy # type: ignore + from ._models import ServicePlacementRequireDomainDistributionPolicy # type: ignore + from ._models import ServicePlacementRequiredDomainPolicy # type: ignore + from ._models import ServiceResource # type: ignore + from ._models import ServiceResourceList # type: ignore + from ._models import ServiceResourceProperties # type: ignore + from ._models import ServiceResourcePropertiesBase # type: ignore + from ._models import ServiceTypeHealthPolicy # type: ignore + from ._models import ServiceUpdateParameters # type: ignore + from ._models import SettingsParameterDescription # type: ignore + from ._models import SettingsSectionDescription # type: ignore + from ._models import SingletonPartitionScheme # type: ignore + from ._models import Sku # type: ignore + from ._models import StatefulServiceProperties # type: ignore + from ._models import StatelessServiceProperties # type: ignore + from ._models import SubResource # type: ignore + from ._models import SystemData # type: ignore + from ._models import UniformInt64RangePartitionScheme # type: ignore + from ._models import UserAssignedIdentity # type: ignore + from ._models import VMSSExtension # type: ignore + from ._models import VaultCertificate # type: ignore + from ._models import VaultSecretGroup # type: ignore + from ._models import VmManagedIdentity # type: ignore + +from ._service_fabric_managed_clusters_management_client_enums import ( + Access, + ClusterState, + ClusterUpgradeCadence, + Direction, + FailureAction, + ManagedClusterAddOnFeature, + ManagedIdentityType, + ManagedResourceProvisioningState, + MoveCost, + NsgProtocol, + PartitionScheme, + ProbeProtocol, + Protocol, + RollingUpgradeMode, + ServiceCorrelationScheme, + ServiceKind, + ServiceLoadMetricWeight, + ServicePackageActivationMode, + ServicePlacementPolicyType, + ServiceScalingMechanismKind, + ServiceScalingTriggerKind, + SkuName, +) + +__all__ = [ + 'AddRemoveIncrementalNamedPartitionScalingMechanism', + 'ApplicationHealthPolicy', + 'ApplicationResource', + 'ApplicationResourceList', + 'ApplicationTypeResource', + 'ApplicationTypeResourceList', + 'ApplicationTypeUpdateParameters', + 'ApplicationTypeVersionResource', + 'ApplicationTypeVersionResourceList', + 'ApplicationTypeVersionUpdateParameters', + 'ApplicationTypeVersionsCleanupPolicy', + 'ApplicationUpdateParameters', + 'ApplicationUpgradePolicy', + 'ApplicationUserAssignedIdentity', + 'AvailableOperationDisplay', + 'AveragePartitionLoadScalingTrigger', + 'AverageServiceLoadScalingTrigger', + 'AzureActiveDirectory', + 'ClientCertificate', + 'EndpointRangeDescription', + 'ErrorModel', + 'ErrorModelError', + 'LoadBalancingRule', + 'ManagedCluster', + 'ManagedClusterListResult', + 'ManagedClusterUpdateParameters', + 'ManagedIdentity', + 'ManagedProxyResource', + 'NamedPartitionScheme', + 'NetworkSecurityRule', + 'NodeType', + 'NodeTypeActionParameters', + 'NodeTypeListResult', + 'NodeTypeUpdateParameters', + 'OperationListResult', + 'OperationResult', + 'Partition', + 'PartitionInstanceCountScaleMechanism', + 'ProxyResource', + 'Resource', + 'RollingUpgradeMonitoringPolicy', + 'ScalingMechanism', + 'ScalingPolicy', + 'ScalingTrigger', + 'ServiceCorrelation', + 'ServiceLoadMetric', + 'ServicePlacementInvalidDomainPolicy', + 'ServicePlacementNonPartiallyPlaceServicePolicy', + 'ServicePlacementPolicy', + 'ServicePlacementPreferPrimaryDomainPolicy', + 'ServicePlacementRequireDomainDistributionPolicy', + 'ServicePlacementRequiredDomainPolicy', + 'ServiceResource', + 'ServiceResourceList', + 'ServiceResourceProperties', + 'ServiceResourcePropertiesBase', + 'ServiceTypeHealthPolicy', + 'ServiceUpdateParameters', + 'SettingsParameterDescription', + 'SettingsSectionDescription', + 'SingletonPartitionScheme', + 'Sku', + 'StatefulServiceProperties', + 'StatelessServiceProperties', + 'SubResource', + 'SystemData', + 'UniformInt64RangePartitionScheme', + 'UserAssignedIdentity', + 'VMSSExtension', + 'VaultCertificate', + 'VaultSecretGroup', + 'VmManagedIdentity', + 'Access', + 'ClusterState', + 'ClusterUpgradeCadence', + 'Direction', + 'FailureAction', + 'ManagedClusterAddOnFeature', + 'ManagedIdentityType', + 'ManagedResourceProvisioningState', + 'MoveCost', + 'NsgProtocol', + 'PartitionScheme', + 'ProbeProtocol', + 'Protocol', + 'RollingUpgradeMode', + 'ServiceCorrelationScheme', + 'ServiceKind', + 'ServiceLoadMetricWeight', + 'ServicePackageActivationMode', + 'ServicePlacementPolicyType', + 'ServiceScalingMechanismKind', + 'ServiceScalingTriggerKind', + 'SkuName', +] diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/models/_models.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/models/_models.py new file mode 100644 index 000000000000..cba99fcf4e05 --- /dev/null +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/models/_models.py @@ -0,0 +1,3134 @@ +# 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 ScalingMechanism(msrest.serialization.Model): + """Describes the mechanism for performing a scaling operation. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: AddRemoveIncrementalNamedPartitionScalingMechanism, PartitionInstanceCountScaleMechanism. + + All required parameters must be populated in order to send to Azure. + + :param kind: Required. Specifies the mechanism associated with this scaling policy.Constant + filled by server. Possible values include: "ScalePartitionInstanceCount", + "AddRemoveIncrementalNamedPartition". + :type kind: str or + ~service_fabric_managed_clusters_management_client.models.ServiceScalingMechanismKind + """ + + _validation = { + 'kind': {'required': True}, + } + + _attribute_map = { + 'kind': {'key': 'kind', 'type': 'str'}, + } + + _subtype_map = { + 'kind': {'AddRemoveIncrementalNamedPartition': 'AddRemoveIncrementalNamedPartitionScalingMechanism', 'ScalePartitionInstanceCount': 'PartitionInstanceCountScaleMechanism'} + } + + def __init__( + self, + **kwargs + ): + super(ScalingMechanism, self).__init__(**kwargs) + self.kind = None # type: Optional[str] + + +class AddRemoveIncrementalNamedPartitionScalingMechanism(ScalingMechanism): + """Represents a scaling mechanism for adding or removing named partitions of a stateless service. Partition names are in the format '0','1'...'N-1'. + + All required parameters must be populated in order to send to Azure. + + :param kind: Required. Specifies the mechanism associated with this scaling policy.Constant + filled by server. Possible values include: "ScalePartitionInstanceCount", + "AddRemoveIncrementalNamedPartition". + :type kind: str or + ~service_fabric_managed_clusters_management_client.models.ServiceScalingMechanismKind + :param min_partition_count: Required. Minimum number of named partitions of the service. + :type min_partition_count: int + :param max_partition_count: Required. Maximum number of named partitions of the service. + :type max_partition_count: int + :param scale_increment: Required. The number of instances to add or remove during a scaling + operation. + :type scale_increment: int + """ + + _validation = { + 'kind': {'required': True}, + 'min_partition_count': {'required': True}, + 'max_partition_count': {'required': True}, + 'scale_increment': {'required': True}, + } + + _attribute_map = { + 'kind': {'key': 'kind', 'type': 'str'}, + 'min_partition_count': {'key': 'minPartitionCount', 'type': 'int'}, + 'max_partition_count': {'key': 'maxPartitionCount', 'type': 'int'}, + 'scale_increment': {'key': 'scaleIncrement', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(AddRemoveIncrementalNamedPartitionScalingMechanism, self).__init__(**kwargs) + self.kind = 'AddRemoveIncrementalNamedPartition' # type: str + self.min_partition_count = kwargs['min_partition_count'] + self.max_partition_count = kwargs['max_partition_count'] + self.scale_increment = kwargs['scale_increment'] + + +class ApplicationHealthPolicy(msrest.serialization.Model): + """Defines a health policy used to evaluate the health of an application or one of its children entities. + + All required parameters must be populated in order to send to Azure. + + :param consider_warning_as_error: Required. Indicates whether warnings are treated with the + same severity as errors. + :type consider_warning_as_error: bool + :param max_percent_unhealthy_deployed_applications: Required. The maximum allowed percentage of + 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: + ~service_fabric_managed_clusters_management_client.models.ServiceTypeHealthPolicy + :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, + ~service_fabric_managed_clusters_management_client.models.ServiceTypeHealthPolicy] + """ + + _validation = { + 'consider_warning_as_error': {'required': True}, + 'max_percent_unhealthy_deployed_applications': {'required': True}, + } + + _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': 'ServiceTypeHealthPolicy'}, + 'service_type_health_policy_map': {'key': 'serviceTypeHealthPolicyMap', 'type': '{ServiceTypeHealthPolicy}'}, + } + + def __init__( + self, + **kwargs + ): + super(ApplicationHealthPolicy, self).__init__(**kwargs) + self.consider_warning_as_error = kwargs['consider_warning_as_error'] + self.max_percent_unhealthy_deployed_applications = kwargs['max_percent_unhealthy_deployed_applications'] + 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 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: 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 system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~service_fabric_managed_clusters_management_client.models.SystemData + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', '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.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: 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 system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~service_fabric_managed_clusters_management_client.models.SystemData + :param identity: Describes the managed identities for an Azure resource. + :type identity: ~service_fabric_managed_clusters_management_client.models.ManagedIdentity + :ivar provisioning_state: The current deployment or provisioning state, which only appears in + the response. + :vartype provisioning_state: str + :param version: The version of the application type as defined in the application manifest. + This name must be the full Arm Resource ID for the referenced application type version. + :type version: str + :param parameters: List of application parameters with overridden values from their default + 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: + ~service_fabric_managed_clusters_management_client.models.ApplicationUpgradePolicy + :param managed_identities: List of user assigned identities for the application, each mapped to + a friendly name. + :type managed_identities: + list[~service_fabric_managed_clusters_management_client.models.ApplicationUserAssignedIdentity] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'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}'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'identity': {'key': 'identity', 'type': 'ManagedIdentity'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'version': {'key': 'properties.version', 'type': 'str'}, + 'parameters': {'key': 'properties.parameters', 'type': '{str}'}, + 'upgrade_policy': {'key': 'properties.upgradePolicy', 'type': 'ApplicationUpgradePolicy'}, + 'managed_identities': {'key': 'properties.managedIdentities', 'type': '[ApplicationUserAssignedIdentity]'}, + } + + def __init__( + self, + **kwargs + ): + super(ApplicationResource, self).__init__(**kwargs) + self.identity = kwargs.get('identity', None) + self.provisioning_state = None + self.version = kwargs.get('version', None) + self.parameters = kwargs.get('parameters', None) + self.upgrade_policy = kwargs.get('upgrade_policy', None) + self.managed_identities = kwargs.get('managed_identities', 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[~service_fabric_managed_clusters_management_client.models.ApplicationResource] + :ivar next_link: URL to get the next set of application list results if there are any. + :vartype next_link: str + """ + + _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 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: 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 system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~service_fabric_managed_clusters_management_client.models.SystemData + :ivar provisioning_state: The current deployment or provisioning state, which only appears in + the response. + :vartype provisioning_state: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'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}'}, + '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[~service_fabric_managed_clusters_management_client.models.ApplicationTypeResource] + :ivar next_link: URL to get the next set of application type list results if there are any. + :vartype next_link: str + """ + + _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 ApplicationTypeUpdateParameters(msrest.serialization.Model): + """Application type update request. + + :param tags: A set of tags. Application type update parameters. + :type tags: dict[str, str] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + **kwargs + ): + super(ApplicationTypeUpdateParameters, self).__init__(**kwargs) + self.tags = kwargs.get('tags', 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: 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 system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~service_fabric_managed_clusters_management_client.models.SystemData + :ivar provisioning_state: The current deployment or provisioning state, which only appears in + the response. + :vartype provisioning_state: str + :param app_package_url: The URL to the application package. + :type app_package_url: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'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}'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'app_package_url': {'key': 'properties.appPackageUrl', '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) + + +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[~service_fabric_managed_clusters_management_client.models.ApplicationTypeVersionResource] + :ivar next_link: URL to get the next set of application type version list results if there are + any. + :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): + """The policy used to clean up unused versions. + + 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: int + """ + + _validation = { + 'max_unused_versions_to_keep': {'required': True, 'minimum': 0}, + } + + _attribute_map = { + 'max_unused_versions_to_keep': {'key': 'maxUnusedVersionsToKeep', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(ApplicationTypeVersionsCleanupPolicy, self).__init__(**kwargs) + self.max_unused_versions_to_keep = kwargs['max_unused_versions_to_keep'] + + +class ApplicationTypeVersionUpdateParameters(msrest.serialization.Model): + """Application type version update request. + + :param tags: A set of tags. Application type version update parameters. + :type tags: dict[str, str] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + **kwargs + ): + super(ApplicationTypeVersionUpdateParameters, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + + +class ApplicationUpdateParameters(msrest.serialization.Model): + """Application update request. + + :param tags: A set of tags. Application update parameters. + :type tags: dict[str, str] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + **kwargs + ): + super(ApplicationUpdateParameters, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + + +class ApplicationUpgradePolicy(msrest.serialization.Model): + """Describes the policy for a monitored application upgrade. + + :param application_health_policy: Defines a health policy used to evaluate the health of an + application or one of its children entities. + :type application_health_policy: + ~service_fabric_managed_clusters_management_client.models.ApplicationHealthPolicy + :param force_restart: If true, then processes are forcefully restarted during upgrade even when + 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: + ~service_fabric_managed_clusters_management_client.models.RollingUpgradeMonitoringPolicy + :param instance_close_delay_duration: Duration in seconds, to wait before a stateless instance + is closed, to allow the active requests to drain gracefully. This would be effective when the + instance is closing during the application/cluster upgrade, only for those instances which have + a non-zero delay duration configured in the service description. See + InstanceCloseDelayDurationSeconds property in StatelessServiceDescription for details. Note, + the default value of InstanceCloseDelayDurationInSeconds is 4294967295, which indicates that + the behavior will entirely depend on the delay configured in the stateless service description. + :type instance_close_delay_duration: long + :param upgrade_mode: The mode used to monitor health during a rolling upgrade. The values are + Monitored, and UnmonitoredAuto. Possible values include: "Monitored", "UnmonitoredAuto". + :type upgrade_mode: str or + ~service_fabric_managed_clusters_management_client.models.RollingUpgradeMode + :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: long + :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. + :type recreate_application: bool + """ + + _attribute_map = { + 'application_health_policy': {'key': 'applicationHealthPolicy', 'type': 'ApplicationHealthPolicy'}, + 'force_restart': {'key': 'forceRestart', 'type': 'bool'}, + 'rolling_upgrade_monitoring_policy': {'key': 'rollingUpgradeMonitoringPolicy', 'type': 'RollingUpgradeMonitoringPolicy'}, + 'instance_close_delay_duration': {'key': 'instanceCloseDelayDuration', 'type': 'long'}, + 'upgrade_mode': {'key': 'upgradeMode', 'type': 'str'}, + 'upgrade_replica_set_check_timeout': {'key': 'upgradeReplicaSetCheckTimeout', 'type': 'long'}, + 'recreate_application': {'key': 'recreateApplication', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(ApplicationUpgradePolicy, self).__init__(**kwargs) + self.application_health_policy = kwargs.get('application_health_policy', None) + self.force_restart = kwargs.get('force_restart', False) + self.rolling_upgrade_monitoring_policy = kwargs.get('rolling_upgrade_monitoring_policy', None) + self.instance_close_delay_duration = kwargs.get('instance_close_delay_duration', None) + self.upgrade_mode = kwargs.get('upgrade_mode', None) + self.upgrade_replica_set_check_timeout = kwargs.get('upgrade_replica_set_check_timeout', None) + 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 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 ScalingTrigger(msrest.serialization.Model): + """Describes the trigger for performing a scaling operation. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: AveragePartitionLoadScalingTrigger, AverageServiceLoadScalingTrigger. + + All required parameters must be populated in order to send to Azure. + + :param kind: Required. Specifies the trigger associated with this scaling policy.Constant + filled by server. Possible values include: "AveragePartitionLoad", "AverageServiceLoad". + :type kind: str or + ~service_fabric_managed_clusters_management_client.models.ServiceScalingTriggerKind + """ + + _validation = { + 'kind': {'required': True}, + } + + _attribute_map = { + 'kind': {'key': 'kind', 'type': 'str'}, + } + + _subtype_map = { + 'kind': {'AveragePartitionLoadTrigger': 'AveragePartitionLoadScalingTrigger', 'AverageServiceLoadTrigger': 'AverageServiceLoadScalingTrigger'} + } + + def __init__( + self, + **kwargs + ): + super(ScalingTrigger, self).__init__(**kwargs) + self.kind = None # type: Optional[str] + + +class AveragePartitionLoadScalingTrigger(ScalingTrigger): + """Represents a scaling trigger related to an average load of a metric/resource of a partition. + + All required parameters must be populated in order to send to Azure. + + :param kind: Required. Specifies the trigger associated with this scaling policy.Constant + filled by server. Possible values include: "AveragePartitionLoad", "AverageServiceLoad". + :type kind: str or + ~service_fabric_managed_clusters_management_client.models.ServiceScalingTriggerKind + :param metric_name: Required. The name of the metric for which usage should be tracked. + :type metric_name: str + :param lower_load_threshold: Required. The lower limit of the load below which a scale in + operation should be performed. + :type lower_load_threshold: float + :param upper_load_threshold: Required. The upper limit of the load beyond which a scale out + operation should be performed. + :type upper_load_threshold: float + :param scale_interval: Required. The period in seconds on which a decision is made whether to + scale or not. This property should come in ISO 8601 format "hh:mm:ss". + :type scale_interval: str + """ + + _validation = { + 'kind': {'required': True}, + 'metric_name': {'required': True}, + 'lower_load_threshold': {'required': True}, + 'upper_load_threshold': {'required': True}, + 'scale_interval': {'required': True}, + } + + _attribute_map = { + 'kind': {'key': 'kind', 'type': 'str'}, + 'metric_name': {'key': 'metricName', 'type': 'str'}, + 'lower_load_threshold': {'key': 'lowerLoadThreshold', 'type': 'float'}, + 'upper_load_threshold': {'key': 'upperLoadThreshold', 'type': 'float'}, + 'scale_interval': {'key': 'scaleInterval', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AveragePartitionLoadScalingTrigger, self).__init__(**kwargs) + self.kind = 'AveragePartitionLoadTrigger' # type: str + self.metric_name = kwargs['metric_name'] + self.lower_load_threshold = kwargs['lower_load_threshold'] + self.upper_load_threshold = kwargs['upper_load_threshold'] + self.scale_interval = kwargs['scale_interval'] + + +class AverageServiceLoadScalingTrigger(ScalingTrigger): + """Represents a scaling policy related to an average load of a metric/resource of a service. + + All required parameters must be populated in order to send to Azure. + + :param kind: Required. Specifies the trigger associated with this scaling policy.Constant + filled by server. Possible values include: "AveragePartitionLoad", "AverageServiceLoad". + :type kind: str or + ~service_fabric_managed_clusters_management_client.models.ServiceScalingTriggerKind + :param metric_name: Required. The name of the metric for which usage should be tracked. + :type metric_name: str + :param lower_load_threshold: Required. The lower limit of the load below which a scale in + operation should be performed. + :type lower_load_threshold: float + :param upper_load_threshold: Required. The upper limit of the load beyond which a scale out + operation should be performed. + :type upper_load_threshold: float + :param scale_interval: Required. The period in seconds on which a decision is made whether to + scale or not. This property should come in ISO 8601 format "hh:mm:ss". + :type scale_interval: str + """ + + _validation = { + 'kind': {'required': True}, + 'metric_name': {'required': True}, + 'lower_load_threshold': {'required': True}, + 'upper_load_threshold': {'required': True}, + 'scale_interval': {'required': True}, + } + + _attribute_map = { + 'kind': {'key': 'kind', 'type': 'str'}, + 'metric_name': {'key': 'metricName', 'type': 'str'}, + 'lower_load_threshold': {'key': 'lowerLoadThreshold', 'type': 'float'}, + 'upper_load_threshold': {'key': 'upperLoadThreshold', 'type': 'float'}, + 'scale_interval': {'key': 'scaleInterval', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(AverageServiceLoadScalingTrigger, self).__init__(**kwargs) + self.kind = 'AverageServiceLoadTrigger' # type: str + self.metric_name = kwargs['metric_name'] + self.lower_load_threshold = kwargs['lower_load_threshold'] + self.upper_load_threshold = kwargs['upper_load_threshold'] + self.scale_interval = kwargs['scale_interval'] + + +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 ClientCertificate(msrest.serialization.Model): + """Client certificate definition. + + 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 thumbprint: Certificate thumbprint. + :type thumbprint: str + :param common_name: Certificate common name. + :type common_name: str + :param issuer_thumbprint: Issuer thumbprint for the certificate. Only used together with + CommonName. + :type issuer_thumbprint: str + """ + + _validation = { + 'is_admin': {'required': True}, + } + + _attribute_map = { + 'is_admin': {'key': 'isAdmin', 'type': 'bool'}, + 'thumbprint': {'key': 'thumbprint', 'type': 'str'}, + 'common_name': {'key': 'commonName', 'type': 'str'}, + 'issuer_thumbprint': {'key': 'issuerThumbprint', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ClientCertificate, self).__init__(**kwargs) + self.is_admin = kwargs['is_admin'] + self.thumbprint = kwargs.get('thumbprint', None) + self.common_name = kwargs.get('common_name', None) + self.issuer_thumbprint = kwargs.get('issuer_thumbprint', None) + + +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: ~service_fabric_managed_clusters_management_client.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 LoadBalancingRule(msrest.serialization.Model): + """Describes a load balancing rule. + + All required parameters must be populated in order to send to Azure. + + :param frontend_port: Required. The port for the external endpoint. Port numbers for each rule + must be unique within the Load Balancer. Acceptable values are between 1 and 65534. + :type frontend_port: int + :param backend_port: Required. The port used for internal connections on the endpoint. + Acceptable values are between 1 and 65535. + :type backend_port: int + :param protocol: Required. The reference to the transport protocol used by the load balancing + rule. Possible values include: "tcp", "udp". + :type protocol: str or ~service_fabric_managed_clusters_management_client.models.Protocol + :param probe_protocol: Required. the reference to the load balancer probe used by the load + balancing rule. Possible values include: "tcp", "http", "https". + :type probe_protocol: str or + ~service_fabric_managed_clusters_management_client.models.ProbeProtocol + :param probe_request_path: The probe request path. Only supported for HTTP/HTTPS probes. + :type probe_request_path: str + """ + + _validation = { + 'frontend_port': {'required': True, 'maximum': 65534, 'minimum': 1}, + 'backend_port': {'required': True, 'maximum': 65534, 'minimum': 1}, + 'protocol': {'required': True}, + 'probe_protocol': {'required': True}, + } + + _attribute_map = { + 'frontend_port': {'key': 'frontendPort', 'type': 'int'}, + 'backend_port': {'key': 'backendPort', 'type': 'int'}, + 'protocol': {'key': 'protocol', 'type': 'str'}, + 'probe_protocol': {'key': 'probeProtocol', 'type': 'str'}, + 'probe_request_path': {'key': 'probeRequestPath', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(LoadBalancingRule, self).__init__(**kwargs) + self.frontend_port = kwargs['frontend_port'] + self.backend_port = kwargs['backend_port'] + self.protocol = kwargs['protocol'] + self.probe_protocol = kwargs['probe_protocol'] + self.probe_request_path = kwargs.get('probe_request_path', None) + + +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: ~service_fabric_managed_clusters_management_client.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 ManagedCluster(Resource): + """The manged 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: ~service_fabric_managed_clusters_management_client.models.SystemData + :param sku: The sku of the managed cluster. + :type sku: ~service_fabric_managed_clusters_management_client.models.Sku + :param dns_name: The cluster dns name. + :type dns_name: str + :ivar fqdn: The fully qualified domain name associated with the public load balancer of the + cluster. + :vartype fqdn: str + :ivar ipv4_address: The IPv4 address associated with the public load balancer of the cluster. + :vartype ipv4_address: 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. Possible values include: + "WaitingForNodes", "Deploying", "BaselineUpgrade", "Upgrading", "UpgradeFailed", "Ready". + :vartype cluster_state: str or + ~service_fabric_managed_clusters_management_client.models.ClusterState + :ivar cluster_certificate_thumbprints: List of thumbprints of the cluster certificates. + :vartype cluster_certificate_thumbprints: list[str] + :param client_connection_port: The port used for client connections to the cluster. + :type client_connection_port: int + :param http_gateway_connection_port: The port used for HTTP connections to the cluster. + :type http_gateway_connection_port: int + :param admin_user_name: VM admin user name. + :type admin_user_name: str + :param admin_password: VM admin user password. + :type admin_password: str + :param load_balancing_rules: Load balancing rules that are applied to the public load balancer + of the cluster. + :type load_balancing_rules: + list[~service_fabric_managed_clusters_management_client.models.LoadBalancingRule] + :param allow_rdp_access: Setting this to true enables RDP access to the VM. The default NSG + rule opens RDP port to internet which can be overridden with custom Network Security Rules. The + default value for this setting is false. + :type allow_rdp_access: bool + :param network_security_rules: Custom Network Security Rules that are applied to the virtual + network of the cluster. + :type network_security_rules: + list[~service_fabric_managed_clusters_management_client.models.NetworkSecurityRule] + :param clients: Client certificates that are allowed to manage the cluster. + :type clients: + list[~service_fabric_managed_clusters_management_client.models.ClientCertificate] + :param azure_active_directory: The AAD authentication settings of the cluster. + :type azure_active_directory: + ~service_fabric_managed_clusters_management_client.models.AzureActiveDirectory + :param fabric_settings: The list of custom fabric settings to configure the cluster. + :type fabric_settings: + list[~service_fabric_managed_clusters_management_client.models.SettingsSectionDescription] + :ivar provisioning_state: The provisioning state of the managed cluster resource. Possible + values include: "None", "Creating", "Created", "Updating", "Succeeded", "Failed", "Canceled", + "Deleting", "Deleted", "Other". + :vartype provisioning_state: str or + ~service_fabric_managed_clusters_management_client.models.ManagedResourceProvisioningState + :param cluster_code_version: The Service Fabric runtime version of the cluster. This property + 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 cluster_upgrade_cadence: Indicates when new cluster runtime version upgrades will be + applied after they are released. By default is Wave0. Possible values include: "Wave0", + "Wave1", "Wave2". + :type cluster_upgrade_cadence: str or + ~service_fabric_managed_clusters_management_client.models.ClusterUpgradeCadence + :param addon_features: List of add-on features to enable on the cluster. + :type addon_features: list[str or + ~service_fabric_managed_clusters_management_client.models.ManagedClusterAddOnFeature] + :param enable_auto_os_upgrade: Setting this to true enables automatic OS upgrade for the node + types that are created using any platform OS image with version 'latest'. The default value for + this setting is false. + :type enable_auto_os_upgrade: bool + :param application_type_versions_cleanup_policy: The policy used to clean up unused versions. + :type application_type_versions_cleanup_policy: + ~service_fabric_managed_clusters_management_client.models.ApplicationTypeVersionsCleanupPolicy + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'etag': {'readonly': True}, + 'system_data': {'readonly': True}, + 'fqdn': {'readonly': True}, + 'ipv4_address': {'readonly': True}, + 'cluster_id': {'readonly': True}, + 'cluster_state': {'readonly': True}, + 'cluster_certificate_thumbprints': {'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'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'dns_name': {'key': 'properties.dnsName', 'type': 'str'}, + 'fqdn': {'key': 'properties.fqdn', 'type': 'str'}, + 'ipv4_address': {'key': 'properties.ipv4Address', 'type': 'str'}, + 'cluster_id': {'key': 'properties.clusterId', 'type': 'str'}, + 'cluster_state': {'key': 'properties.clusterState', 'type': 'str'}, + 'cluster_certificate_thumbprints': {'key': 'properties.clusterCertificateThumbprints', 'type': '[str]'}, + 'client_connection_port': {'key': 'properties.clientConnectionPort', 'type': 'int'}, + 'http_gateway_connection_port': {'key': 'properties.httpGatewayConnectionPort', 'type': 'int'}, + 'admin_user_name': {'key': 'properties.adminUserName', 'type': 'str'}, + 'admin_password': {'key': 'properties.adminPassword', 'type': 'str'}, + 'load_balancing_rules': {'key': 'properties.loadBalancingRules', 'type': '[LoadBalancingRule]'}, + 'allow_rdp_access': {'key': 'properties.allowRdpAccess', 'type': 'bool'}, + 'network_security_rules': {'key': 'properties.networkSecurityRules', 'type': '[NetworkSecurityRule]'}, + 'clients': {'key': 'properties.clients', 'type': '[ClientCertificate]'}, + 'azure_active_directory': {'key': 'properties.azureActiveDirectory', 'type': 'AzureActiveDirectory'}, + 'fabric_settings': {'key': 'properties.fabricSettings', 'type': '[SettingsSectionDescription]'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'cluster_code_version': {'key': 'properties.clusterCodeVersion', 'type': 'str'}, + 'cluster_upgrade_cadence': {'key': 'properties.clusterUpgradeCadence', 'type': 'str'}, + 'addon_features': {'key': 'properties.addonFeatures', 'type': '[str]'}, + 'enable_auto_os_upgrade': {'key': 'properties.enableAutoOSUpgrade', 'type': 'bool'}, + 'application_type_versions_cleanup_policy': {'key': 'properties.applicationTypeVersionsCleanupPolicy', 'type': 'ApplicationTypeVersionsCleanupPolicy'}, + } + + def __init__( + self, + **kwargs + ): + super(ManagedCluster, self).__init__(**kwargs) + self.sku = kwargs.get('sku', None) + self.dns_name = kwargs.get('dns_name', None) + self.fqdn = None + self.ipv4_address = None + self.cluster_id = None + self.cluster_state = None + self.cluster_certificate_thumbprints = None + self.client_connection_port = kwargs.get('client_connection_port', 19000) + self.http_gateway_connection_port = kwargs.get('http_gateway_connection_port', 19080) + self.admin_user_name = kwargs.get('admin_user_name', None) + self.admin_password = kwargs.get('admin_password', None) + self.load_balancing_rules = kwargs.get('load_balancing_rules', None) + self.allow_rdp_access = kwargs.get('allow_rdp_access', None) + self.network_security_rules = kwargs.get('network_security_rules', None) + self.clients = kwargs.get('clients', None) + self.azure_active_directory = kwargs.get('azure_active_directory', None) + self.fabric_settings = kwargs.get('fabric_settings', None) + self.provisioning_state = None + self.cluster_code_version = kwargs.get('cluster_code_version', None) + self.cluster_upgrade_cadence = kwargs.get('cluster_upgrade_cadence', None) + self.addon_features = kwargs.get('addon_features', None) + self.enable_auto_os_upgrade = kwargs.get('enable_auto_os_upgrade', None) + self.application_type_versions_cleanup_policy = kwargs.get('application_type_versions_cleanup_policy', None) + + +class ManagedClusterListResult(msrest.serialization.Model): + """Managed Cluster list results. + + :param value: + :type value: list[~service_fabric_managed_clusters_management_client.models.ManagedCluster] + :param next_link: The URL to use for getting the next set of results. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ManagedCluster]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ManagedClusterListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class ManagedClusterUpdateParameters(msrest.serialization.Model): + """Managed cluster update request. + + :param tags: A set of tags. Managed cluster update parameters. + :type tags: dict[str, str] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + **kwargs + ): + super(ManagedClusterUpdateParameters, self).__init__(**kwargs) + self.tags = kwargs.get('tags', 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: "None", + "SystemAssigned", "UserAssigned", "SystemAssigned, UserAssigned". + :type type: str or + ~service_fabric_managed_clusters_management_client.models.ManagedIdentityType + :param user_assigned_identities: The list of user identities associated with the resource. The + 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, + ~service_fabric_managed_clusters_management_client.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 ManagedProxyResource(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 tags: A set of tags. Azure resource tags. + :type tags: dict[str, str] + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~service_fabric_managed_clusters_management_client.models.SystemData + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + } + + def __init__( + self, + **kwargs + ): + super(ManagedProxyResource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.tags = kwargs.get('tags', None) + self.system_data = None + + +class Partition(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: NamedPartitionScheme, SingletonPartitionScheme, UniformInt64RangePartitionScheme. + + All required parameters must be populated in order to send to Azure. + + :param partition_scheme: Required. Specifies how the service is partitioned.Constant filled by + server. Possible values include: "Singleton", "UniformInt64Range", "Named". + :type partition_scheme: str or + ~service_fabric_managed_clusters_management_client.models.PartitionScheme + """ + + _validation = { + 'partition_scheme': {'required': True}, + } + + _attribute_map = { + 'partition_scheme': {'key': 'partitionScheme', 'type': 'str'}, + } + + _subtype_map = { + 'partition_scheme': {'Named': 'NamedPartitionScheme', 'Singleton': 'SingletonPartitionScheme', 'UniformInt64Range': 'UniformInt64RangePartitionScheme'} + } + + def __init__( + self, + **kwargs + ): + super(Partition, self).__init__(**kwargs) + self.partition_scheme = None # type: Optional[str] + + +class NamedPartitionScheme(Partition): + """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: "Singleton", "UniformInt64Range", "Named". + :type partition_scheme: str or + ~service_fabric_managed_clusters_management_client.models.PartitionScheme + :param names: Required. Array for the names of the partitions. + :type names: list[str] + """ + + _validation = { + 'partition_scheme': {'required': True}, + 'names': {'required': True}, + } + + _attribute_map = { + 'partition_scheme': {'key': 'partitionScheme', 'type': 'str'}, + 'names': {'key': 'names', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(NamedPartitionScheme, self).__init__(**kwargs) + self.partition_scheme = 'Named' # type: str + self.names = kwargs['names'] + + +class NetworkSecurityRule(msrest.serialization.Model): + """Describes a network security rule. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Network security rule name. + :type name: str + :param description: Network security rule description. + :type description: str + :param protocol: Required. Network protocol this rule applies to. Possible values include: + "http", "https", "tcp", "udp", "icmp", "ah", "esp". + :type protocol: str or ~service_fabric_managed_clusters_management_client.models.NsgProtocol + :param source_address_prefixes: The CIDR or source IP ranges. + :type source_address_prefixes: list[str] + :param destination_address_prefixes: The destination address prefixes. CIDR or destination IP + ranges. + :type destination_address_prefixes: list[str] + :param source_port_ranges: The source port ranges. + :type source_port_ranges: list[str] + :param destination_port_ranges: The destination port ranges. + :type destination_port_ranges: list[str] + :param access: Required. The network traffic is allowed or denied. Possible values include: + "allow", "deny". + :type access: str or ~service_fabric_managed_clusters_management_client.models.Access + :param priority: Required. The priority of the rule. The value can be in the range 1000 to + 3000. Values outside this range are reserved for Service Fabric ManagerCluster Resource + Provider. The priority number must be unique for each rule in the collection. The lower the + priority number, the higher the priority of the rule. + :type priority: int + :param direction: Required. Network security rule direction. Possible values include: + "inbound", "outbound". + :type direction: str or ~service_fabric_managed_clusters_management_client.models.Direction + """ + + _validation = { + 'name': {'required': True}, + 'protocol': {'required': True}, + 'access': {'required': True}, + 'priority': {'required': True, 'maximum': 3000, 'minimum': 1000}, + 'direction': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'protocol': {'key': 'protocol', 'type': 'str'}, + 'source_address_prefixes': {'key': 'sourceAddressPrefixes', 'type': '[str]'}, + 'destination_address_prefixes': {'key': 'destinationAddressPrefixes', 'type': '[str]'}, + 'source_port_ranges': {'key': 'sourcePortRanges', 'type': '[str]'}, + 'destination_port_ranges': {'key': 'destinationPortRanges', 'type': '[str]'}, + 'access': {'key': 'access', 'type': 'str'}, + 'priority': {'key': 'priority', 'type': 'int'}, + 'direction': {'key': 'direction', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(NetworkSecurityRule, self).__init__(**kwargs) + self.name = kwargs['name'] + self.description = kwargs.get('description', None) + self.protocol = kwargs['protocol'] + self.source_address_prefixes = kwargs.get('source_address_prefixes', None) + self.destination_address_prefixes = kwargs.get('destination_address_prefixes', None) + self.source_port_ranges = kwargs.get('source_port_ranges', None) + self.destination_port_ranges = kwargs.get('destination_port_ranges', None) + self.access = kwargs['access'] + self.priority = kwargs['priority'] + self.direction = kwargs['direction'] + + +class NodeType(ManagedProxyResource): + """Describes a node type in the cluster, each node type represents sub set of nodes in the cluster. + + 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 tags: A set of tags. Azure resource tags. + :type tags: dict[str, str] + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~service_fabric_managed_clusters_management_client.models.SystemData + :param is_primary: The node type on which system services will run. Only one node type should + be marked as primary. Primary node type cannot be deleted or changed for existing clusters. + :type is_primary: bool + :param vm_instance_count: The number of nodes in the node type. + :type vm_instance_count: int + :param data_disk_size_gb: Disk size for each vm in the node type in GBs. + :type data_disk_size_gb: int + :param placement_properties: The placement tags applied to nodes in the node type, which can be + used to indicate where certain services (workload) should run. + :type placement_properties: dict[str, str] + :param capacities: The capacity tags applied to the nodes in the node type, the cluster + resource manager uses these tags to understand how much resource a node has. + :type capacities: dict[str, str] + :param application_ports: The range of ports from which cluster assigned port to Service Fabric + applications. + :type application_ports: + ~service_fabric_managed_clusters_management_client.models.EndpointRangeDescription + :param ephemeral_ports: The range of ephemeral ports that nodes in this node type should be + configured with. + :type ephemeral_ports: + ~service_fabric_managed_clusters_management_client.models.EndpointRangeDescription + :param vm_size: The size of virtual machines in the pool. All virtual machines in a pool are + the same size. For example, Standard_D3. + :type vm_size: str + :param vm_image_publisher: The publisher of the Azure Virtual Machines Marketplace image. For + example, Canonical or MicrosoftWindowsServer. + :type vm_image_publisher: str + :param vm_image_offer: The offer type of the Azure Virtual Machines Marketplace image. For + example, UbuntuServer or WindowsServer. + :type vm_image_offer: str + :param vm_image_sku: The SKU of the Azure Virtual Machines Marketplace image. For example, + 14.04.0-LTS or 2012-R2-Datacenter. + :type vm_image_sku: str + :param vm_image_version: The version of the Azure Virtual Machines Marketplace image. A value + of 'latest' can be specified to select the latest version of an image. If omitted, the default + is 'latest'. + :type vm_image_version: str + :param vm_secrets: The secrets to install in the virtual machines. + :type vm_secrets: + list[~service_fabric_managed_clusters_management_client.models.VaultSecretGroup] + :param vm_extensions: Set of extensions that should be installed onto the virtual machines. + :type vm_extensions: + list[~service_fabric_managed_clusters_management_client.models.VMSSExtension] + :param vm_managed_identity: Identities for the virtual machine scale set under the node type. + :type vm_managed_identity: + ~service_fabric_managed_clusters_management_client.models.VmManagedIdentity + :ivar provisioning_state: The provisioning state of the managed cluster resource. Possible + values include: "None", "Creating", "Created", "Updating", "Succeeded", "Failed", "Canceled", + "Deleting", "Deleted", "Other". + :vartype provisioning_state: str or + ~service_fabric_managed_clusters_management_client.models.ManagedResourceProvisioningState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'vm_instance_count': {'maximum': 2147483647, 'minimum': 1}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'is_primary': {'key': 'properties.isPrimary', 'type': 'bool'}, + 'vm_instance_count': {'key': 'properties.vmInstanceCount', 'type': 'int'}, + 'data_disk_size_gb': {'key': 'properties.dataDiskSizeGB', 'type': 'int'}, + 'placement_properties': {'key': 'properties.placementProperties', 'type': '{str}'}, + 'capacities': {'key': 'properties.capacities', 'type': '{str}'}, + 'application_ports': {'key': 'properties.applicationPorts', 'type': 'EndpointRangeDescription'}, + 'ephemeral_ports': {'key': 'properties.ephemeralPorts', 'type': 'EndpointRangeDescription'}, + 'vm_size': {'key': 'properties.vmSize', 'type': 'str'}, + 'vm_image_publisher': {'key': 'properties.vmImagePublisher', 'type': 'str'}, + 'vm_image_offer': {'key': 'properties.vmImageOffer', 'type': 'str'}, + 'vm_image_sku': {'key': 'properties.vmImageSku', 'type': 'str'}, + 'vm_image_version': {'key': 'properties.vmImageVersion', 'type': 'str'}, + 'vm_secrets': {'key': 'properties.vmSecrets', 'type': '[VaultSecretGroup]'}, + 'vm_extensions': {'key': 'properties.vmExtensions', 'type': '[VMSSExtension]'}, + 'vm_managed_identity': {'key': 'properties.vmManagedIdentity', 'type': 'VmManagedIdentity'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(NodeType, self).__init__(**kwargs) + self.is_primary = kwargs.get('is_primary', None) + self.vm_instance_count = kwargs.get('vm_instance_count', None) + self.data_disk_size_gb = kwargs.get('data_disk_size_gb', None) + self.placement_properties = kwargs.get('placement_properties', None) + self.capacities = kwargs.get('capacities', None) + self.application_ports = kwargs.get('application_ports', None) + self.ephemeral_ports = kwargs.get('ephemeral_ports', None) + self.vm_size = kwargs.get('vm_size', None) + self.vm_image_publisher = kwargs.get('vm_image_publisher', None) + self.vm_image_offer = kwargs.get('vm_image_offer', None) + self.vm_image_sku = kwargs.get('vm_image_sku', None) + self.vm_image_version = kwargs.get('vm_image_version', None) + self.vm_secrets = kwargs.get('vm_secrets', None) + self.vm_extensions = kwargs.get('vm_extensions', None) + self.vm_managed_identity = kwargs.get('vm_managed_identity', None) + self.provisioning_state = None + + +class NodeTypeActionParameters(msrest.serialization.Model): + """Parameters for Node type action. + + All required parameters must be populated in order to send to Azure. + + :param nodes: Required. List of node names from the node type. + :type nodes: list[str] + :param force: Force the action to go through. + :type force: bool + """ + + _validation = { + 'nodes': {'required': True}, + } + + _attribute_map = { + 'nodes': {'key': 'nodes', 'type': '[str]'}, + 'force': {'key': 'force', 'type': 'bool'}, + } + + def __init__( + self, + **kwargs + ): + super(NodeTypeActionParameters, self).__init__(**kwargs) + self.nodes = kwargs['nodes'] + self.force = kwargs.get('force', None) + + +class NodeTypeListResult(msrest.serialization.Model): + """Node type list results. + + :param value: The list of node types. + :type value: list[~service_fabric_managed_clusters_management_client.models.NodeType] + :param next_link: The URL to use for getting the next set of results. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[NodeType]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(NodeTypeListResult, self).__init__(**kwargs) + self.value = kwargs.get('value', None) + self.next_link = kwargs.get('next_link', None) + + +class NodeTypeUpdateParameters(msrest.serialization.Model): + """Node type update request. + + :param tags: A set of tags. Node type update parameters. + :type tags: dict[str, str] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + **kwargs + ): + super(NodeTypeUpdateParameters, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + + +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[~service_fabric_managed_clusters_management_client.models.OperationResult] + :ivar next_link: URL to get the next set of operation list results if there are any. + :vartype next_link: str + """ + + _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: + ~service_fabric_managed_clusters_management_client.models.AvailableOperationDisplay + :param origin: Origin result. + :type origin: str + :param next_link: The URL to use for getting the next set of results. + :type next_link: str + """ + + _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 PartitionInstanceCountScaleMechanism(ScalingMechanism): + """Represents a scaling mechanism for adding or removing instances of stateless service partition. + + All required parameters must be populated in order to send to Azure. + + :param kind: Required. Specifies the mechanism associated with this scaling policy.Constant + filled by server. Possible values include: "ScalePartitionInstanceCount", + "AddRemoveIncrementalNamedPartition". + :type kind: str or + ~service_fabric_managed_clusters_management_client.models.ServiceScalingMechanismKind + :param min_instance_count: Required. Minimum number of instances of the partition. + :type min_instance_count: int + :param max_instance_count: Required. Maximum number of instances of the partition. + :type max_instance_count: int + :param scale_increment: Required. The number of instances to add or remove during a scaling + operation. + :type scale_increment: int + """ + + _validation = { + 'kind': {'required': True}, + 'min_instance_count': {'required': True}, + 'max_instance_count': {'required': True}, + 'scale_increment': {'required': True}, + } + + _attribute_map = { + 'kind': {'key': 'kind', 'type': 'str'}, + 'min_instance_count': {'key': 'minInstanceCount', 'type': 'int'}, + 'max_instance_count': {'key': 'maxInstanceCount', 'type': 'int'}, + 'scale_increment': {'key': 'scaleIncrement', 'type': 'int'}, + } + + def __init__( + self, + **kwargs + ): + super(PartitionInstanceCountScaleMechanism, self).__init__(**kwargs) + self.kind = 'ScalePartitionInstanceCount' # type: str + self.min_instance_count = kwargs['min_instance_count'] + self.max_instance_count = kwargs['max_instance_count'] + self.scale_increment = kwargs['scale_increment'] + + +class RollingUpgradeMonitoringPolicy(msrest.serialization.Model): + """The policy used for monitoring the application upgrade. + + All required parameters must be populated in order to send to Azure. + + :param failure_action: Required. The compensating action to perform when a Monitored upgrade + encounters monitoring policy or health policy violations. Invalid indicates the failure action + is invalid. Rollback specifies that the upgrade will start rolling back automatically. Manual + indicates that the upgrade will switch to UnmonitoredManual upgrade mode. Possible values + include: "Rollback", "Manual". + :type failure_action: str or + ~service_fabric_managed_clusters_management_client.models.FailureAction + :param health_check_wait_duration: Required. The amount of time to wait after completing an + upgrade domain before applying health policies. It is interpreted as a string representing an + ISO 8601 duration with following format "hh:mm:ss.fff". + :type health_check_wait_duration: str + :param health_check_stable_duration: Required. The amount of time that the application or + cluster must remain healthy before the upgrade proceeds to the next upgrade domain. It is + interpreted as a string representing an ISO 8601 duration with following format "hh:mm:ss.fff". + :type health_check_stable_duration: str + :param health_check_retry_timeout: Required. The amount of time to retry health evaluation when + the application or cluster is unhealthy before FailureAction is executed. It is interpreted as + a string representing an ISO 8601 duration with following format "hh:mm:ss.fff". + :type health_check_retry_timeout: str + :param upgrade_timeout: Required. The amount of time the overall upgrade has to complete before + FailureAction is executed. Cannot be larger than 12 hours. It is interpreted as a string + representing an ISO 8601 duration with following format "hh:mm:ss.fff". + :type upgrade_timeout: str + :param upgrade_domain_timeout: Required. The amount of time each upgrade domain has to complete + before FailureAction is executed. Cannot be larger than 12 hours. It is interpreted as a string + representing an ISO 8601 duration with following format "hh:mm:ss.fff". + :type upgrade_domain_timeout: str + """ + + _validation = { + 'failure_action': {'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}, + } + + _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(RollingUpgradeMonitoringPolicy, self).__init__(**kwargs) + self.failure_action = kwargs['failure_action'] + 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'] + + +class ScalingPolicy(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 scaling_mechanism: Required. Specifies the mechanism associated with this scaling + policy. + :type scaling_mechanism: + ~service_fabric_managed_clusters_management_client.models.ScalingMechanism + :param scaling_trigger: Required. Specifies the trigger associated with this scaling policy. + :type scaling_trigger: ~service_fabric_managed_clusters_management_client.models.ScalingTrigger + """ + + _validation = { + 'scaling_mechanism': {'required': True}, + 'scaling_trigger': {'required': True}, + } + + _attribute_map = { + 'scaling_mechanism': {'key': 'scalingMechanism', 'type': 'ScalingMechanism'}, + 'scaling_trigger': {'key': 'scalingTrigger', 'type': 'ScalingTrigger'}, + } + + def __init__( + self, + **kwargs + ): + super(ScalingPolicy, self).__init__(**kwargs) + self.scaling_mechanism = kwargs['scaling_mechanism'] + self.scaling_trigger = kwargs['scaling_trigger'] + + +class ServiceCorrelation(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: + "AlignedAffinity", "NonAlignedAffinity". + :type scheme: str or + ~service_fabric_managed_clusters_management_client.models.ServiceCorrelationScheme + :param service_name: Required. The Arm Resource ID of the service that the correlation + 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(ServiceCorrelation, self).__init__(**kwargs) + self.scheme = kwargs['scheme'] + self.service_name = kwargs['service_name'] + + +class ServiceLoadMetric(msrest.serialization.Model): + """Specifies a metric to load balance a service during runtime. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the metric. If the service chooses to report load during + 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 + ~service_fabric_managed_clusters_management_client.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(ServiceLoadMetric, 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 ServicePlacementPolicy(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: ServicePlacementInvalidDomainPolicy, ServicePlacementNonPartiallyPlaceServicePolicy, ServicePlacementPreferPrimaryDomainPolicy, ServicePlacementRequiredDomainPolicy, ServicePlacementRequireDomainDistributionPolicy. + + All required parameters must be populated in order to send to Azure. + + :param type: Required. The type of placement policy for a service fabric service. Following are + the possible values.Constant filled by server. Possible values include: "InvalidDomain", + "RequiredDomain", "PreferredPrimaryDomain", "RequiredDomainDistribution", + "NonPartiallyPlaceService". + :type type: str or + ~service_fabric_managed_clusters_management_client.models.ServicePlacementPolicyType + """ + + _validation = { + 'type': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + } + + _subtype_map = { + 'type': {'InvalidDomain': 'ServicePlacementInvalidDomainPolicy', 'NonPartiallyPlaceService': 'ServicePlacementNonPartiallyPlaceServicePolicy', 'PreferredPrimaryDomain': 'ServicePlacementPreferPrimaryDomainPolicy', 'RequiredDomain': 'ServicePlacementRequiredDomainPolicy', 'RequiredDomainDistribution': 'ServicePlacementRequireDomainDistributionPolicy'} + } + + def __init__( + self, + **kwargs + ): + super(ServicePlacementPolicy, self).__init__(**kwargs) + self.type = None # type: Optional[str] + + +class ServicePlacementInvalidDomainPolicy(ServicePlacementPolicy): + """Describes the policy to be used for placement of a Service Fabric service where a particular fault or upgrade domain should not be used for placement of the instances or replicas of that service. + + All required parameters must be populated in order to send to Azure. + + :param type: Required. The type of placement policy for a service fabric service. Following are + the possible values.Constant filled by server. Possible values include: "InvalidDomain", + "RequiredDomain", "PreferredPrimaryDomain", "RequiredDomainDistribution", + "NonPartiallyPlaceService". + :type type: str or + ~service_fabric_managed_clusters_management_client.models.ServicePlacementPolicyType + :param domain_name: Required. The name of the domain that should not be used for placement. + :type domain_name: str + """ + + _validation = { + 'type': {'required': True}, + 'domain_name': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'domain_name': {'key': 'domainName', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ServicePlacementInvalidDomainPolicy, self).__init__(**kwargs) + self.type = 'InvalidDomain' # type: str + self.domain_name = kwargs['domain_name'] + + +class ServicePlacementNonPartiallyPlaceServicePolicy(ServicePlacementPolicy): + """ServicePlacementNonPartiallyPlaceServicePolicy. + + All required parameters must be populated in order to send to Azure. + + :param type: Required. The type of placement policy for a service fabric service. Following are + the possible values.Constant filled by server. Possible values include: "InvalidDomain", + "RequiredDomain", "PreferredPrimaryDomain", "RequiredDomainDistribution", + "NonPartiallyPlaceService". + :type type: str or + ~service_fabric_managed_clusters_management_client.models.ServicePlacementPolicyType + """ + + _validation = { + 'type': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ServicePlacementNonPartiallyPlaceServicePolicy, self).__init__(**kwargs) + self.type = 'NonPartiallyPlaceService' # type: str + + +class ServicePlacementPreferPrimaryDomainPolicy(ServicePlacementPolicy): + """Describes the policy to be used for placement of a Service Fabric service where the service's +Primary replicas should optimally be placed in a particular domain. + +This placement policy is usually used with fault domains in scenarios where the Service Fabric +cluster is geographically distributed in order to indicate that a service's primary replica should +be located in a particular fault domain, which in geo-distributed scenarios usually aligns with regional +or datacenter boundaries. Note that since this is an optimization it is possible that the Primary replica +may not end up located in this domain due to failures, capacity limits, or other constraints. + + All required parameters must be populated in order to send to Azure. + + :param type: Required. The type of placement policy for a service fabric service. Following are + the possible values.Constant filled by server. Possible values include: "InvalidDomain", + "RequiredDomain", "PreferredPrimaryDomain", "RequiredDomainDistribution", + "NonPartiallyPlaceService". + :type type: str or + ~service_fabric_managed_clusters_management_client.models.ServicePlacementPolicyType + :param domain_name: Required. The name of the domain that should used for placement as per this + policy. + :type domain_name: str + """ + + _validation = { + 'type': {'required': True}, + 'domain_name': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'domain_name': {'key': 'domainName', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ServicePlacementPreferPrimaryDomainPolicy, self).__init__(**kwargs) + self.type = 'PreferredPrimaryDomain' # type: str + self.domain_name = kwargs['domain_name'] + + +class ServicePlacementRequiredDomainPolicy(ServicePlacementPolicy): + """Describes the policy to be used for placement of a Service Fabric service where the instances or replicas of that service must be placed in a particular domain. + + All required parameters must be populated in order to send to Azure. + + :param type: Required. The type of placement policy for a service fabric service. Following are + the possible values.Constant filled by server. Possible values include: "InvalidDomain", + "RequiredDomain", "PreferredPrimaryDomain", "RequiredDomainDistribution", + "NonPartiallyPlaceService". + :type type: str or + ~service_fabric_managed_clusters_management_client.models.ServicePlacementPolicyType + :param domain_name: Required. The name of the domain that should used for placement as per this + policy. + :type domain_name: str + """ + + _validation = { + 'type': {'required': True}, + 'domain_name': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'domain_name': {'key': 'domainName', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ServicePlacementRequiredDomainPolicy, self).__init__(**kwargs) + self.type = 'RequiredDomain' # type: str + self.domain_name = kwargs['domain_name'] + + +class ServicePlacementRequireDomainDistributionPolicy(ServicePlacementPolicy): + """Describes the policy to be used for placement of a Service Fabric service where two replicas +from the same partition should never be placed in the same fault or upgrade domain. + +While this is not common it can expose the service to an increased risk of concurrent failures +due to unplanned outages or other cases of subsequent/concurrent failures. As an example, consider +a case where replicas are deployed across different data center, with one replica per location. +In the event that one of the datacenters goes offline, normally the replica that was placed in that +datacenter will be packed into one of the remaining datacenters. If this is not desirable then this +policy should be set. + + All required parameters must be populated in order to send to Azure. + + :param type: Required. The type of placement policy for a service fabric service. Following are + the possible values.Constant filled by server. Possible values include: "InvalidDomain", + "RequiredDomain", "PreferredPrimaryDomain", "RequiredDomainDistribution", + "NonPartiallyPlaceService". + :type type: str or + ~service_fabric_managed_clusters_management_client.models.ServicePlacementPolicyType + :param domain_name: Required. The name of the domain that should used for placement as per this + policy. + :type domain_name: str + """ + + _validation = { + 'type': {'required': True}, + 'domain_name': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'domain_name': {'key': 'domainName', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ServicePlacementRequireDomainDistributionPolicy, self).__init__(**kwargs) + self.type = 'RequiredDomainDistribution' # type: str + self.domain_name = kwargs['domain_name'] + + +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: 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 system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~service_fabric_managed_clusters_management_client.models.SystemData + :param properties: The service resource properties. + :type properties: + ~service_fabric_managed_clusters_management_client.models.ServiceResourceProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'properties': {'key': 'properties', 'type': 'ServiceResourceProperties'}, + } + + def __init__( + self, + **kwargs + ): + super(ServiceResource, self).__init__(**kwargs) + self.properties = kwargs.get('properties', 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[~service_fabric_managed_clusters_management_client.models.ServiceResource] + :ivar next_link: URL to get the next set of service list results if there are any. + :vartype next_link: str + """ + + _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[~service_fabric_managed_clusters_management_client.models.ServiceCorrelation] + :param service_load_metrics: The service load metrics is given as an array of ServiceLoadMetric + objects. + :type service_load_metrics: + list[~service_fabric_managed_clusters_management_client.models.ServiceLoadMetric] + :param service_placement_policies: A list that describes the correlation of the service with + other services. + :type service_placement_policies: + list[~service_fabric_managed_clusters_management_client.models.ServicePlacementPolicy] + :param default_move_cost: Specifies the move cost for the service. Possible values include: + "Zero", "Low", "Medium", "High". + :type default_move_cost: str or + ~service_fabric_managed_clusters_management_client.models.MoveCost + :param scaling_policies: Scaling policies for this service. + :type scaling_policies: + list[~service_fabric_managed_clusters_management_client.models.ScalingPolicy] + """ + + _attribute_map = { + 'placement_constraints': {'key': 'placementConstraints', 'type': 'str'}, + 'correlation_scheme': {'key': 'correlationScheme', 'type': '[ServiceCorrelation]'}, + 'service_load_metrics': {'key': 'serviceLoadMetrics', 'type': '[ServiceLoadMetric]'}, + 'service_placement_policies': {'key': 'servicePlacementPolicies', 'type': '[ServicePlacementPolicy]'}, + 'default_move_cost': {'key': 'defaultMoveCost', 'type': 'str'}, + 'scaling_policies': {'key': 'scalingPolicies', 'type': '[ScalingPolicy]'}, + } + + 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) + self.scaling_policies = kwargs.get('scaling_policies', 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[~service_fabric_managed_clusters_management_client.models.ServiceCorrelation] + :param service_load_metrics: The service load metrics is given as an array of ServiceLoadMetric + objects. + :type service_load_metrics: + list[~service_fabric_managed_clusters_management_client.models.ServiceLoadMetric] + :param service_placement_policies: A list that describes the correlation of the service with + other services. + :type service_placement_policies: + list[~service_fabric_managed_clusters_management_client.models.ServicePlacementPolicy] + :param default_move_cost: Specifies the move cost for the service. Possible values include: + "Zero", "Low", "Medium", "High". + :type default_move_cost: str or + ~service_fabric_managed_clusters_management_client.models.MoveCost + :param scaling_policies: Scaling policies for this service. + :type scaling_policies: + list[~service_fabric_managed_clusters_management_client.models.ScalingPolicy] + :ivar provisioning_state: The current deployment or provisioning state, which only appears in + the response. + :vartype provisioning_state: str + :param service_kind: Required. The kind of service (Stateless or Stateful).Constant filled by + server. Possible values include: "Stateless", "Stateful". + :type service_kind: str or + ~service_fabric_managed_clusters_management_client.models.ServiceKind + :param service_type_name: Required. The name of the service type. + :type service_type_name: str + :param partition_description: Required. Describes how the service is partitioned. + :type partition_description: + ~service_fabric_managed_clusters_management_client.models.Partition + :param service_package_activation_mode: The activation Mode of the service package. Possible + values include: "SharedProcess", "ExclusiveProcess". + :type service_package_activation_mode: str or + ~service_fabric_managed_clusters_management_client.models.ServicePackageActivationMode + :param service_dns_name: The DNS name of the service. It requires the DNS system service to be + enabled in Service Fabric cluster. + :type service_dns_name: str + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'service_kind': {'required': True}, + 'service_type_name': {'required': True}, + 'partition_description': {'required': True}, + } + + _attribute_map = { + 'placement_constraints': {'key': 'placementConstraints', 'type': 'str'}, + 'correlation_scheme': {'key': 'correlationScheme', 'type': '[ServiceCorrelation]'}, + 'service_load_metrics': {'key': 'serviceLoadMetrics', 'type': '[ServiceLoadMetric]'}, + 'service_placement_policies': {'key': 'servicePlacementPolicies', 'type': '[ServicePlacementPolicy]'}, + 'default_move_cost': {'key': 'defaultMoveCost', 'type': 'str'}, + 'scaling_policies': {'key': 'scalingPolicies', 'type': '[ScalingPolicy]'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'service_kind': {'key': 'serviceKind', 'type': 'str'}, + 'service_type_name': {'key': 'serviceTypeName', 'type': 'str'}, + 'partition_description': {'key': 'partitionDescription', 'type': 'Partition'}, + '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['service_type_name'] + self.partition_description = kwargs['partition_description'] + self.service_package_activation_mode = kwargs.get('service_package_activation_mode', None) + self.service_dns_name = kwargs.get('service_dns_name', None) + + +class ServiceTypeHealthPolicy(msrest.serialization.Model): + """Represents the health policy used to evaluate the health of services belonging to a service type. + + All required parameters must be populated in order to send to Azure. + + :param max_percent_unhealthy_services: Required. The maximum allowed percentage of unhealthy + services. + + The percentage represents the maximum tolerated percentage of services that can be unhealthy + before the application is considered in error. + If the percentage is respected but there is at least one unhealthy service, the health is + evaluated as Warning. + This is calculated by dividing the number of unhealthy services of the specific service type + over the total number of services of the specific service type. + The computation rounds up to tolerate one failure on small numbers of services. + :type max_percent_unhealthy_services: int + :param max_percent_unhealthy_partitions_per_service: Required. The maximum allowed percentage + of unhealthy partitions per service. + + The percentage represents the maximum tolerated percentage of partitions that can be unhealthy + before the service is considered in error. + If the percentage is respected but there is at least one unhealthy partition, the health is + evaluated as Warning. + The percentage is calculated by dividing the number of unhealthy partitions over the total + number of partitions in the service. + The computation rounds up to tolerate one failure on small numbers of partitions. + :type max_percent_unhealthy_partitions_per_service: int + :param max_percent_unhealthy_replicas_per_partition: Required. The maximum allowed percentage + of unhealthy replicas per partition. + + The percentage represents the maximum tolerated percentage of replicas that can be unhealthy + before the partition is considered in error. + If the percentage is respected but there is at least one unhealthy replica, the health is + evaluated as Warning. + The percentage is calculated by dividing the number of unhealthy replicas over the total + number of replicas in the partition. + The computation rounds up to tolerate one failure on small numbers of replicas. + :type max_percent_unhealthy_replicas_per_partition: int + """ + + _validation = { + 'max_percent_unhealthy_services': {'required': True, 'maximum': 100, 'minimum': 0}, + 'max_percent_unhealthy_partitions_per_service': {'required': True, 'maximum': 100, 'minimum': 0}, + 'max_percent_unhealthy_replicas_per_partition': {'required': True, '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(ServiceTypeHealthPolicy, self).__init__(**kwargs) + self.max_percent_unhealthy_services = kwargs['max_percent_unhealthy_services'] + self.max_percent_unhealthy_partitions_per_service = kwargs['max_percent_unhealthy_partitions_per_service'] + self.max_percent_unhealthy_replicas_per_partition = kwargs['max_percent_unhealthy_replicas_per_partition'] + + +class ServiceUpdateParameters(msrest.serialization.Model): + """Service update request. + + :param tags: A set of tags. Service update parameters. + :type tags: dict[str, str] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + **kwargs + ): + super(ServiceUpdateParameters, self).__init__(**kwargs) + self.tags = kwargs.get('tags', None) + + +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[~service_fabric_managed_clusters_management_client.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 SingletonPartitionScheme(Partition): + """SingletonPartitionScheme. + + All required parameters must be populated in order to send to Azure. + + :param partition_scheme: Required. Specifies how the service is partitioned.Constant filled by + server. Possible values include: "Singleton", "UniformInt64Range", "Named". + :type partition_scheme: str or + ~service_fabric_managed_clusters_management_client.models.PartitionScheme + """ + + _validation = { + 'partition_scheme': {'required': True}, + } + + _attribute_map = { + 'partition_scheme': {'key': 'partitionScheme', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SingletonPartitionScheme, self).__init__(**kwargs) + self.partition_scheme = 'Singleton' # type: str + + +class Sku(msrest.serialization.Model): + """Service Fabric managed cluster Sku definition. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Sku Name. Possible values include: "Basic", "Standard". + :type name: str or ~service_fabric_managed_clusters_management_client.models.SkuName + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(Sku, self).__init__(**kwargs) + self.name = kwargs['name'] + + +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[~service_fabric_managed_clusters_management_client.models.ServiceCorrelation] + :param service_load_metrics: The service load metrics is given as an array of ServiceLoadMetric + objects. + :type service_load_metrics: + list[~service_fabric_managed_clusters_management_client.models.ServiceLoadMetric] + :param service_placement_policies: A list that describes the correlation of the service with + other services. + :type service_placement_policies: + list[~service_fabric_managed_clusters_management_client.models.ServicePlacementPolicy] + :param default_move_cost: Specifies the move cost for the service. Possible values include: + "Zero", "Low", "Medium", "High". + :type default_move_cost: str or + ~service_fabric_managed_clusters_management_client.models.MoveCost + :param scaling_policies: Scaling policies for this service. + :type scaling_policies: + list[~service_fabric_managed_clusters_management_client.models.ScalingPolicy] + :ivar provisioning_state: The current deployment or provisioning state, which only appears in + the response. + :vartype provisioning_state: str + :param service_kind: Required. The kind of service (Stateless or Stateful).Constant filled by + server. Possible values include: "Stateless", "Stateful". + :type service_kind: str or + ~service_fabric_managed_clusters_management_client.models.ServiceKind + :param service_type_name: Required. The name of the service type. + :type service_type_name: str + :param partition_description: Required. Describes how the service is partitioned. + :type partition_description: + ~service_fabric_managed_clusters_management_client.models.Partition + :param service_package_activation_mode: The activation Mode of the service package. Possible + values include: "SharedProcess", "ExclusiveProcess". + :type service_package_activation_mode: str or + ~service_fabric_managed_clusters_management_client.models.ServicePackageActivationMode + :param service_dns_name: The DNS name of the service. It requires the DNS system service to be + enabled in Service Fabric cluster. + :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". + :type replica_restart_wait_duration: str + :param quorum_loss_wait_duration: The maximum duration for which a partition is allowed to be + in a state of quorum loss, represented in ISO 8601 format "hh:mm:ss". + :type quorum_loss_wait_duration: str + :param stand_by_replica_keep_duration: The definition on how long StandBy replicas should be + maintained before being removed, represented in ISO 8601 format "hh:mm:ss". + :type stand_by_replica_keep_duration: str + :param service_placement_time_limit: The duration for which replicas can stay InBuild before + reporting that build is stuck, represented in ISO 8601 format "hh:mm:ss". + :type service_placement_time_limit: str + :param drop_source_replica_on_move: Indicates whether to drop source Secondary replica even if + the target replica has not finished build. If desired behavior is to drop it as soon as + possible the value of this property is true, if not it is false. + :type drop_source_replica_on_move: bool + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'service_kind': {'required': True}, + 'service_type_name': {'required': True}, + 'partition_description': {'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': '[ServiceCorrelation]'}, + 'service_load_metrics': {'key': 'serviceLoadMetrics', 'type': '[ServiceLoadMetric]'}, + 'service_placement_policies': {'key': 'servicePlacementPolicies', 'type': '[ServicePlacementPolicy]'}, + 'default_move_cost': {'key': 'defaultMoveCost', 'type': 'str'}, + 'scaling_policies': {'key': 'scalingPolicies', 'type': '[ScalingPolicy]'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'service_kind': {'key': 'serviceKind', 'type': 'str'}, + 'service_type_name': {'key': 'serviceTypeName', 'type': 'str'}, + 'partition_description': {'key': 'partitionDescription', 'type': 'Partition'}, + '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': 'str'}, + 'quorum_loss_wait_duration': {'key': 'quorumLossWaitDuration', 'type': 'str'}, + 'stand_by_replica_keep_duration': {'key': 'standByReplicaKeepDuration', 'type': 'str'}, + 'service_placement_time_limit': {'key': 'servicePlacementTimeLimit', 'type': 'str'}, + 'drop_source_replica_on_move': {'key': 'dropSourceReplicaOnMove', 'type': 'bool'}, + } + + 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) + self.service_placement_time_limit = kwargs.get('service_placement_time_limit', None) + self.drop_source_replica_on_move = kwargs.get('drop_source_replica_on_move', 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[~service_fabric_managed_clusters_management_client.models.ServiceCorrelation] + :param service_load_metrics: The service load metrics is given as an array of ServiceLoadMetric + objects. + :type service_load_metrics: + list[~service_fabric_managed_clusters_management_client.models.ServiceLoadMetric] + :param service_placement_policies: A list that describes the correlation of the service with + other services. + :type service_placement_policies: + list[~service_fabric_managed_clusters_management_client.models.ServicePlacementPolicy] + :param default_move_cost: Specifies the move cost for the service. Possible values include: + "Zero", "Low", "Medium", "High". + :type default_move_cost: str or + ~service_fabric_managed_clusters_management_client.models.MoveCost + :param scaling_policies: Scaling policies for this service. + :type scaling_policies: + list[~service_fabric_managed_clusters_management_client.models.ScalingPolicy] + :ivar provisioning_state: The current deployment or provisioning state, which only appears in + the response. + :vartype provisioning_state: str + :param service_kind: Required. The kind of service (Stateless or Stateful).Constant filled by + server. Possible values include: "Stateless", "Stateful". + :type service_kind: str or + ~service_fabric_managed_clusters_management_client.models.ServiceKind + :param service_type_name: Required. The name of the service type. + :type service_type_name: str + :param partition_description: Required. Describes how the service is partitioned. + :type partition_description: + ~service_fabric_managed_clusters_management_client.models.Partition + :param service_package_activation_mode: The activation Mode of the service package. Possible + values include: "SharedProcess", "ExclusiveProcess". + :type service_package_activation_mode: str or + ~service_fabric_managed_clusters_management_client.models.ServicePackageActivationMode + :param service_dns_name: The DNS name of the service. It requires the DNS system service to be + enabled in Service Fabric cluster. + :type service_dns_name: str + :param instance_count: Required. The instance count. + :type instance_count: int + :param min_instance_count: MinInstanceCount is the minimum number of instances that must be up + to meet the EnsureAvailability safety check during operations like upgrade or deactivate node. + The actual number that is used is max( MinInstanceCount, ceil( MinInstancePercentage/100.0 * + InstanceCount) ). Note, if InstanceCount is set to -1, during MinInstanceCount computation -1 + is first converted into the number of nodes on which the instances are allowed to be placed + according to the placement constraints on the service. + :type min_instance_count: int + :param min_instance_percentage: MinInstancePercentage is the minimum percentage of + InstanceCount that must be up to meet the EnsureAvailability safety check during operations + like upgrade or deactivate node. The actual number that is used is max( MinInstanceCount, ceil( + MinInstancePercentage/100.0 * InstanceCount) ). Note, if InstanceCount is set to -1, during + MinInstancePercentage computation, -1 is first converted into the number of nodes on which the + instances are allowed to be placed according to the placement constraints on the service. + :type min_instance_percentage: int + :param instance_close_delay_duration: Duration represented in ISO 8601 format "hh:mm:ss", to + wait before a stateless instance is closed, to allow the active requests to drain gracefully. + This would be effective when the instance is closing during the application/cluster upgrade and + disabling node. The endpoint exposed on this instance is removed prior to starting the delay, + which prevents new connections to this instance. In addition, clients that have subscribed to + service endpoint change + events(https://docs.microsoft.com/dotnet/api/system.fabric.fabricclient.servicemanagementclient.registerservicenotificationfilterasync), + can do the following upon receiving the endpoint removal notification: - Stop sending new + requests to this instance. - Close existing connections after in-flight requests have + completed. - Connect to a different instance of the service partition for future requests. + Note, the default value of InstanceCloseDelayDuration is 0, which indicates that there won't be + any delay or removal of the endpoint prior to closing the instance. + :type instance_close_delay_duration: str + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'service_kind': {'required': True}, + 'service_type_name': {'required': True}, + 'partition_description': {'required': True}, + 'instance_count': {'required': True, 'minimum': -1}, + } + + _attribute_map = { + 'placement_constraints': {'key': 'placementConstraints', 'type': 'str'}, + 'correlation_scheme': {'key': 'correlationScheme', 'type': '[ServiceCorrelation]'}, + 'service_load_metrics': {'key': 'serviceLoadMetrics', 'type': '[ServiceLoadMetric]'}, + 'service_placement_policies': {'key': 'servicePlacementPolicies', 'type': '[ServicePlacementPolicy]'}, + 'default_move_cost': {'key': 'defaultMoveCost', 'type': 'str'}, + 'scaling_policies': {'key': 'scalingPolicies', 'type': '[ScalingPolicy]'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'service_kind': {'key': 'serviceKind', 'type': 'str'}, + 'service_type_name': {'key': 'serviceTypeName', 'type': 'str'}, + 'partition_description': {'key': 'partitionDescription', 'type': 'Partition'}, + 'service_package_activation_mode': {'key': 'servicePackageActivationMode', 'type': 'str'}, + 'service_dns_name': {'key': 'serviceDnsName', 'type': 'str'}, + 'instance_count': {'key': 'instanceCount', 'type': 'int'}, + 'min_instance_count': {'key': 'minInstanceCount', 'type': 'int'}, + 'min_instance_percentage': {'key': 'minInstancePercentage', '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['instance_count'] + self.min_instance_count = kwargs.get('min_instance_count', None) + self.min_instance_percentage = kwargs.get('min_instance_percentage', None) + self.instance_close_delay_duration = kwargs.get('instance_close_delay_duration', "0") + + +class SubResource(msrest.serialization.Model): + """Azure resource identifier. + + :param id: Azure resource identifier. + :type id: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SubResource, self).__init__(**kwargs) + self.id = kwargs.get('id', 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 UniformInt64RangePartitionScheme(Partition): + """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: "Singleton", "UniformInt64Range", "Named". + :type partition_scheme: str or + ~service_fabric_managed_clusters_management_client.models.PartitionScheme + :param count: Required. The number of partitions. + :type count: int + :param low_key: Required. The lower bound of the partition key range that + should be split between the partition ‘Count’. + :type low_key: long + :param high_key: Required. The upper bound of the partition key range that + should be split between the partition ‘Count’. + :type high_key: long + """ + + _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': 'long'}, + 'high_key': {'key': 'highKey', 'type': 'long'}, + } + + def __init__( + self, + **kwargs + ): + super(UniformInt64RangePartitionScheme, 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 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 + + +class VaultCertificate(msrest.serialization.Model): + """Describes a single certificate reference in a Key Vault, and where the certificate should reside on the VM. + + All required parameters must be populated in order to send to Azure. + + :param certificate_url: Required. This is the URL of a certificate that has been uploaded to + Key Vault as a secret. For adding a secret to the Key Vault, see `Add a key or secret to the + key vault `_. In this + case, your certificate needs to be It is the Base64 encoding of the following JSON Object which + is encoded in UTF-8: :code:`
`:code:`
` {:code:`
` "data":":code:``",:code:`
` "dataType":"pfx",:code:`
` "password":":code:``":code:`
`}. + :type certificate_url: str + :param certificate_store: Required. For Windows VMs, specifies the certificate store on the + Virtual Machine to which the certificate should be added. The specified certificate store is + implicitly in the LocalMachine account. :code:`
`:code:`
`For Linux VMs, the certificate + file is placed under the /var/lib/waagent directory, with the file name + :code:``.crt for the X509 certificate file and + :code:``.prv for private key. Both of these files are .pem formatted. + :type certificate_store: str + """ + + _validation = { + 'certificate_url': {'required': True}, + 'certificate_store': {'required': True}, + } + + _attribute_map = { + 'certificate_url': {'key': 'certificateUrl', 'type': 'str'}, + 'certificate_store': {'key': 'certificateStore', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(VaultCertificate, self).__init__(**kwargs) + self.certificate_url = kwargs['certificate_url'] + self.certificate_store = kwargs['certificate_store'] + + +class VaultSecretGroup(msrest.serialization.Model): + """Specifies set of certificates that should be installed onto the virtual machines. + + All required parameters must be populated in order to send to Azure. + + :param source_vault: Required. The relative URL of the Key Vault containing all of the + certificates in VaultCertificates. + :type source_vault: ~service_fabric_managed_clusters_management_client.models.SubResource + :param vault_certificates: Required. The list of key vault references in SourceVault which + contain certificates. + :type vault_certificates: + list[~service_fabric_managed_clusters_management_client.models.VaultCertificate] + """ + + _validation = { + 'source_vault': {'required': True}, + 'vault_certificates': {'required': True}, + } + + _attribute_map = { + 'source_vault': {'key': 'sourceVault', 'type': 'SubResource'}, + 'vault_certificates': {'key': 'vaultCertificates', 'type': '[VaultCertificate]'}, + } + + def __init__( + self, + **kwargs + ): + super(VaultSecretGroup, self).__init__(**kwargs) + self.source_vault = kwargs['source_vault'] + self.vault_certificates = kwargs['vault_certificates'] + + +class VmManagedIdentity(msrest.serialization.Model): + """Identities for the virtual machine scale set under the node type. + + :param user_assigned_identities: The list of user identities associated with the virtual + machine scale set under the node type. Each entry will be an ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + :type user_assigned_identities: list[str] + """ + + _attribute_map = { + 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '[str]'}, + } + + def __init__( + self, + **kwargs + ): + super(VmManagedIdentity, self).__init__(**kwargs) + self.user_assigned_identities = kwargs.get('user_assigned_identities', None) + + +class VMSSExtension(msrest.serialization.Model): + """Specifies set of extensions that should be installed onto the virtual machines. + + 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 name: Required. The name of the extension. + :type name: str + :param publisher: Required. The name of the extension handler publisher. + :type publisher: str + :param type: Required. Specifies the type of the extension; an example is + "CustomScriptExtension". + :type type: str + :param type_handler_version: Required. Specifies the version of the script handler. + :type type_handler_version: str + :param auto_upgrade_minor_version: Indicates whether the extension should use a newer minor + version if one is available at deployment time. Once deployed, however, the extension will not + upgrade minor versions unless redeployed, even with this property set to true. + :type auto_upgrade_minor_version: bool + :param settings: Json formatted public settings for the extension. + :type settings: object + :param protected_settings: The extension can contain either protectedSettings or + protectedSettingsFromKeyVault or no protected settings at all. + :type protected_settings: object + :param force_update_tag: If a value is provided and is different from the previous value, the + extension handler will be forced to update even if the extension configuration has not changed. + :type force_update_tag: str + :param provision_after_extensions: Collection of extension names after which this extension + needs to be provisioned. + :type provision_after_extensions: list[str] + :ivar provisioning_state: The provisioning state, which only appears in the response. + :vartype provisioning_state: str + """ + + _validation = { + 'name': {'required': True}, + 'publisher': {'required': True}, + 'type': {'required': True}, + 'type_handler_version': {'required': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'publisher': {'key': 'properties.publisher', 'type': 'str'}, + 'type': {'key': 'properties.type', 'type': 'str'}, + 'type_handler_version': {'key': 'properties.typeHandlerVersion', 'type': 'str'}, + 'auto_upgrade_minor_version': {'key': 'properties.autoUpgradeMinorVersion', 'type': 'bool'}, + 'settings': {'key': 'properties.settings', 'type': 'object'}, + 'protected_settings': {'key': 'properties.protectedSettings', 'type': 'object'}, + 'force_update_tag': {'key': 'properties.forceUpdateTag', 'type': 'str'}, + 'provision_after_extensions': {'key': 'properties.provisionAfterExtensions', 'type': '[str]'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(VMSSExtension, self).__init__(**kwargs) + self.name = kwargs['name'] + self.publisher = kwargs['publisher'] + self.type = kwargs['type'] + self.type_handler_version = kwargs['type_handler_version'] + self.auto_upgrade_minor_version = kwargs.get('auto_upgrade_minor_version', None) + self.settings = kwargs.get('settings', None) + self.protected_settings = kwargs.get('protected_settings', None) + self.force_update_tag = kwargs.get('force_update_tag', None) + self.provision_after_extensions = kwargs.get('provision_after_extensions', None) + self.provisioning_state = None diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/models/_models_py3.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/models/_models_py3.py new file mode 100644 index 000000000000..7cc55bc46409 --- /dev/null +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/models/_models_py3.py @@ -0,0 +1,3442 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +import datetime +from typing import Dict, List, Optional, Union + +from azure.core.exceptions import HttpResponseError +import msrest.serialization + +from ._service_fabric_managed_clusters_management_client_enums import * + + +class ScalingMechanism(msrest.serialization.Model): + """Describes the mechanism for performing a scaling operation. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: AddRemoveIncrementalNamedPartitionScalingMechanism, PartitionInstanceCountScaleMechanism. + + All required parameters must be populated in order to send to Azure. + + :param kind: Required. Specifies the mechanism associated with this scaling policy.Constant + filled by server. Possible values include: "ScalePartitionInstanceCount", + "AddRemoveIncrementalNamedPartition". + :type kind: str or + ~service_fabric_managed_clusters_management_client.models.ServiceScalingMechanismKind + """ + + _validation = { + 'kind': {'required': True}, + } + + _attribute_map = { + 'kind': {'key': 'kind', 'type': 'str'}, + } + + _subtype_map = { + 'kind': {'AddRemoveIncrementalNamedPartition': 'AddRemoveIncrementalNamedPartitionScalingMechanism', 'ScalePartitionInstanceCount': 'PartitionInstanceCountScaleMechanism'} + } + + def __init__( + self, + **kwargs + ): + super(ScalingMechanism, self).__init__(**kwargs) + self.kind = None # type: Optional[str] + + +class AddRemoveIncrementalNamedPartitionScalingMechanism(ScalingMechanism): + """Represents a scaling mechanism for adding or removing named partitions of a stateless service. Partition names are in the format '0','1'...'N-1'. + + All required parameters must be populated in order to send to Azure. + + :param kind: Required. Specifies the mechanism associated with this scaling policy.Constant + filled by server. Possible values include: "ScalePartitionInstanceCount", + "AddRemoveIncrementalNamedPartition". + :type kind: str or + ~service_fabric_managed_clusters_management_client.models.ServiceScalingMechanismKind + :param min_partition_count: Required. Minimum number of named partitions of the service. + :type min_partition_count: int + :param max_partition_count: Required. Maximum number of named partitions of the service. + :type max_partition_count: int + :param scale_increment: Required. The number of instances to add or remove during a scaling + operation. + :type scale_increment: int + """ + + _validation = { + 'kind': {'required': True}, + 'min_partition_count': {'required': True}, + 'max_partition_count': {'required': True}, + 'scale_increment': {'required': True}, + } + + _attribute_map = { + 'kind': {'key': 'kind', 'type': 'str'}, + 'min_partition_count': {'key': 'minPartitionCount', 'type': 'int'}, + 'max_partition_count': {'key': 'maxPartitionCount', 'type': 'int'}, + 'scale_increment': {'key': 'scaleIncrement', 'type': 'int'}, + } + + def __init__( + self, + *, + min_partition_count: int, + max_partition_count: int, + scale_increment: int, + **kwargs + ): + super(AddRemoveIncrementalNamedPartitionScalingMechanism, self).__init__(**kwargs) + self.kind = 'AddRemoveIncrementalNamedPartition' # type: str + self.min_partition_count = min_partition_count + self.max_partition_count = max_partition_count + self.scale_increment = scale_increment + + +class ApplicationHealthPolicy(msrest.serialization.Model): + """Defines a health policy used to evaluate the health of an application or one of its children entities. + + All required parameters must be populated in order to send to Azure. + + :param consider_warning_as_error: Required. Indicates whether warnings are treated with the + same severity as errors. + :type consider_warning_as_error: bool + :param max_percent_unhealthy_deployed_applications: Required. The maximum allowed percentage of + 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: + ~service_fabric_managed_clusters_management_client.models.ServiceTypeHealthPolicy + :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, + ~service_fabric_managed_clusters_management_client.models.ServiceTypeHealthPolicy] + """ + + _validation = { + 'consider_warning_as_error': {'required': True}, + 'max_percent_unhealthy_deployed_applications': {'required': True}, + } + + _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': 'ServiceTypeHealthPolicy'}, + 'service_type_health_policy_map': {'key': 'serviceTypeHealthPolicyMap', 'type': '{ServiceTypeHealthPolicy}'}, + } + + def __init__( + self, + *, + consider_warning_as_error: bool, + max_percent_unhealthy_deployed_applications: int, + default_service_type_health_policy: Optional["ServiceTypeHealthPolicy"] = None, + service_type_health_policy_map: Optional[Dict[str, "ServiceTypeHealthPolicy"]] = None, + **kwargs + ): + super(ApplicationHealthPolicy, self).__init__(**kwargs) + self.consider_warning_as_error = consider_warning_as_error + self.max_percent_unhealthy_deployed_applications = max_percent_unhealthy_deployed_applications + self.default_service_type_health_policy = default_service_type_health_policy + self.service_type_health_policy_map = service_type_health_policy_map + + +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: 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 system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~service_fabric_managed_clusters_management_client.models.SystemData + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(ProxyResource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = location + self.tags = tags + 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: 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 system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~service_fabric_managed_clusters_management_client.models.SystemData + :param identity: Describes the managed identities for an Azure resource. + :type identity: ~service_fabric_managed_clusters_management_client.models.ManagedIdentity + :ivar provisioning_state: The current deployment or provisioning state, which only appears in + the response. + :vartype provisioning_state: str + :param version: The version of the application type as defined in the application manifest. + This name must be the full Arm Resource ID for the referenced application type version. + :type version: str + :param parameters: List of application parameters with overridden values from their default + 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: + ~service_fabric_managed_clusters_management_client.models.ApplicationUpgradePolicy + :param managed_identities: List of user assigned identities for the application, each mapped to + a friendly name. + :type managed_identities: + list[~service_fabric_managed_clusters_management_client.models.ApplicationUserAssignedIdentity] + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'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}'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'identity': {'key': 'identity', 'type': 'ManagedIdentity'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'version': {'key': 'properties.version', 'type': 'str'}, + 'parameters': {'key': 'properties.parameters', 'type': '{str}'}, + 'upgrade_policy': {'key': 'properties.upgradePolicy', 'type': 'ApplicationUpgradePolicy'}, + 'managed_identities': {'key': 'properties.managedIdentities', 'type': '[ApplicationUserAssignedIdentity]'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + identity: Optional["ManagedIdentity"] = None, + version: Optional[str] = None, + parameters: Optional[Dict[str, str]] = None, + upgrade_policy: Optional["ApplicationUpgradePolicy"] = None, + managed_identities: Optional[List["ApplicationUserAssignedIdentity"]] = None, + **kwargs + ): + super(ApplicationResource, self).__init__(location=location, tags=tags, **kwargs) + self.identity = identity + self.provisioning_state = None + self.version = version + self.parameters = parameters + self.upgrade_policy = upgrade_policy + self.managed_identities = managed_identities + + +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[~service_fabric_managed_clusters_management_client.models.ApplicationResource] + :ivar next_link: URL to get the next set of application list results if there are any. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ApplicationResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["ApplicationResource"]] = None, + **kwargs + ): + super(ApplicationResourceList, self).__init__(**kwargs) + self.value = value + self.next_link = 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: 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 system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~service_fabric_managed_clusters_management_client.models.SystemData + :ivar provisioning_state: The current deployment or provisioning state, which only appears in + the response. + :vartype provisioning_state: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'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}'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(ApplicationTypeResource, self).__init__(location=location, tags=tags, **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[~service_fabric_managed_clusters_management_client.models.ApplicationTypeResource] + :ivar next_link: URL to get the next set of application type list results if there are any. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ApplicationTypeResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["ApplicationTypeResource"]] = None, + **kwargs + ): + super(ApplicationTypeResourceList, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class ApplicationTypeUpdateParameters(msrest.serialization.Model): + """Application type update request. + + :param tags: A set of tags. Application type update parameters. + :type tags: dict[str, str] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(ApplicationTypeUpdateParameters, self).__init__(**kwargs) + self.tags = tags + + +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: 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 system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~service_fabric_managed_clusters_management_client.models.SystemData + :ivar provisioning_state: The current deployment or provisioning state, which only appears in + the response. + :vartype provisioning_state: str + :param app_package_url: The URL to the application package. + :type app_package_url: str + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'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}'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'app_package_url': {'key': 'properties.appPackageUrl', 'type': 'str'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + app_package_url: Optional[str] = None, + **kwargs + ): + super(ApplicationTypeVersionResource, self).__init__(location=location, tags=tags, **kwargs) + self.provisioning_state = None + self.app_package_url = app_package_url + + +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[~service_fabric_managed_clusters_management_client.models.ApplicationTypeVersionResource] + :ivar next_link: URL to get the next set of application type version list results if there are + any. + :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, + *, + value: Optional[List["ApplicationTypeVersionResource"]] = None, + **kwargs + ): + super(ApplicationTypeVersionResourceList, self).__init__(**kwargs) + self.value = value + self.next_link = None + + +class ApplicationTypeVersionsCleanupPolicy(msrest.serialization.Model): + """The policy used to clean up unused versions. + + 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: int + """ + + _validation = { + 'max_unused_versions_to_keep': {'required': True, 'minimum': 0}, + } + + _attribute_map = { + 'max_unused_versions_to_keep': {'key': 'maxUnusedVersionsToKeep', 'type': 'int'}, + } + + def __init__( + self, + *, + max_unused_versions_to_keep: int, + **kwargs + ): + super(ApplicationTypeVersionsCleanupPolicy, self).__init__(**kwargs) + self.max_unused_versions_to_keep = max_unused_versions_to_keep + + +class ApplicationTypeVersionUpdateParameters(msrest.serialization.Model): + """Application type version update request. + + :param tags: A set of tags. Application type version update parameters. + :type tags: dict[str, str] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(ApplicationTypeVersionUpdateParameters, self).__init__(**kwargs) + self.tags = tags + + +class ApplicationUpdateParameters(msrest.serialization.Model): + """Application update request. + + :param tags: A set of tags. Application update parameters. + :type tags: dict[str, str] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(ApplicationUpdateParameters, self).__init__(**kwargs) + self.tags = tags + + +class ApplicationUpgradePolicy(msrest.serialization.Model): + """Describes the policy for a monitored application upgrade. + + :param application_health_policy: Defines a health policy used to evaluate the health of an + application or one of its children entities. + :type application_health_policy: + ~service_fabric_managed_clusters_management_client.models.ApplicationHealthPolicy + :param force_restart: If true, then processes are forcefully restarted during upgrade even when + 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: + ~service_fabric_managed_clusters_management_client.models.RollingUpgradeMonitoringPolicy + :param instance_close_delay_duration: Duration in seconds, to wait before a stateless instance + is closed, to allow the active requests to drain gracefully. This would be effective when the + instance is closing during the application/cluster upgrade, only for those instances which have + a non-zero delay duration configured in the service description. See + InstanceCloseDelayDurationSeconds property in StatelessServiceDescription for details. Note, + the default value of InstanceCloseDelayDurationInSeconds is 4294967295, which indicates that + the behavior will entirely depend on the delay configured in the stateless service description. + :type instance_close_delay_duration: long + :param upgrade_mode: The mode used to monitor health during a rolling upgrade. The values are + Monitored, and UnmonitoredAuto. Possible values include: "Monitored", "UnmonitoredAuto". + :type upgrade_mode: str or + ~service_fabric_managed_clusters_management_client.models.RollingUpgradeMode + :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: long + :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. + :type recreate_application: bool + """ + + _attribute_map = { + 'application_health_policy': {'key': 'applicationHealthPolicy', 'type': 'ApplicationHealthPolicy'}, + 'force_restart': {'key': 'forceRestart', 'type': 'bool'}, + 'rolling_upgrade_monitoring_policy': {'key': 'rollingUpgradeMonitoringPolicy', 'type': 'RollingUpgradeMonitoringPolicy'}, + 'instance_close_delay_duration': {'key': 'instanceCloseDelayDuration', 'type': 'long'}, + 'upgrade_mode': {'key': 'upgradeMode', 'type': 'str'}, + 'upgrade_replica_set_check_timeout': {'key': 'upgradeReplicaSetCheckTimeout', 'type': 'long'}, + 'recreate_application': {'key': 'recreateApplication', 'type': 'bool'}, + } + + def __init__( + self, + *, + application_health_policy: Optional["ApplicationHealthPolicy"] = None, + force_restart: Optional[bool] = False, + rolling_upgrade_monitoring_policy: Optional["RollingUpgradeMonitoringPolicy"] = None, + instance_close_delay_duration: Optional[int] = None, + upgrade_mode: Optional[Union[str, "RollingUpgradeMode"]] = None, + upgrade_replica_set_check_timeout: Optional[int] = None, + recreate_application: Optional[bool] = None, + **kwargs + ): + super(ApplicationUpgradePolicy, self).__init__(**kwargs) + self.application_health_policy = application_health_policy + self.force_restart = force_restart + self.rolling_upgrade_monitoring_policy = rolling_upgrade_monitoring_policy + self.instance_close_delay_duration = instance_close_delay_duration + self.upgrade_mode = upgrade_mode + self.upgrade_replica_set_check_timeout = upgrade_replica_set_check_timeout + self.recreate_application = recreate_application + + +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, + *, + name: str, + principal_id: str, + **kwargs + ): + super(ApplicationUserAssignedIdentity, self).__init__(**kwargs) + self.name = name + self.principal_id = principal_id + + +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, + *, + provider: Optional[str] = None, + resource: Optional[str] = None, + operation: Optional[str] = None, + description: Optional[str] = None, + **kwargs + ): + super(AvailableOperationDisplay, self).__init__(**kwargs) + self.provider = provider + self.resource = resource + self.operation = operation + self.description = description + + +class ScalingTrigger(msrest.serialization.Model): + """Describes the trigger for performing a scaling operation. + + You probably want to use the sub-classes and not this class directly. Known + sub-classes are: AveragePartitionLoadScalingTrigger, AverageServiceLoadScalingTrigger. + + All required parameters must be populated in order to send to Azure. + + :param kind: Required. Specifies the trigger associated with this scaling policy.Constant + filled by server. Possible values include: "AveragePartitionLoad", "AverageServiceLoad". + :type kind: str or + ~service_fabric_managed_clusters_management_client.models.ServiceScalingTriggerKind + """ + + _validation = { + 'kind': {'required': True}, + } + + _attribute_map = { + 'kind': {'key': 'kind', 'type': 'str'}, + } + + _subtype_map = { + 'kind': {'AveragePartitionLoadTrigger': 'AveragePartitionLoadScalingTrigger', 'AverageServiceLoadTrigger': 'AverageServiceLoadScalingTrigger'} + } + + def __init__( + self, + **kwargs + ): + super(ScalingTrigger, self).__init__(**kwargs) + self.kind = None # type: Optional[str] + + +class AveragePartitionLoadScalingTrigger(ScalingTrigger): + """Represents a scaling trigger related to an average load of a metric/resource of a partition. + + All required parameters must be populated in order to send to Azure. + + :param kind: Required. Specifies the trigger associated with this scaling policy.Constant + filled by server. Possible values include: "AveragePartitionLoad", "AverageServiceLoad". + :type kind: str or + ~service_fabric_managed_clusters_management_client.models.ServiceScalingTriggerKind + :param metric_name: Required. The name of the metric for which usage should be tracked. + :type metric_name: str + :param lower_load_threshold: Required. The lower limit of the load below which a scale in + operation should be performed. + :type lower_load_threshold: float + :param upper_load_threshold: Required. The upper limit of the load beyond which a scale out + operation should be performed. + :type upper_load_threshold: float + :param scale_interval: Required. The period in seconds on which a decision is made whether to + scale or not. This property should come in ISO 8601 format "hh:mm:ss". + :type scale_interval: str + """ + + _validation = { + 'kind': {'required': True}, + 'metric_name': {'required': True}, + 'lower_load_threshold': {'required': True}, + 'upper_load_threshold': {'required': True}, + 'scale_interval': {'required': True}, + } + + _attribute_map = { + 'kind': {'key': 'kind', 'type': 'str'}, + 'metric_name': {'key': 'metricName', 'type': 'str'}, + 'lower_load_threshold': {'key': 'lowerLoadThreshold', 'type': 'float'}, + 'upper_load_threshold': {'key': 'upperLoadThreshold', 'type': 'float'}, + 'scale_interval': {'key': 'scaleInterval', 'type': 'str'}, + } + + def __init__( + self, + *, + metric_name: str, + lower_load_threshold: float, + upper_load_threshold: float, + scale_interval: str, + **kwargs + ): + super(AveragePartitionLoadScalingTrigger, self).__init__(**kwargs) + self.kind = 'AveragePartitionLoadTrigger' # type: str + self.metric_name = metric_name + self.lower_load_threshold = lower_load_threshold + self.upper_load_threshold = upper_load_threshold + self.scale_interval = scale_interval + + +class AverageServiceLoadScalingTrigger(ScalingTrigger): + """Represents a scaling policy related to an average load of a metric/resource of a service. + + All required parameters must be populated in order to send to Azure. + + :param kind: Required. Specifies the trigger associated with this scaling policy.Constant + filled by server. Possible values include: "AveragePartitionLoad", "AverageServiceLoad". + :type kind: str or + ~service_fabric_managed_clusters_management_client.models.ServiceScalingTriggerKind + :param metric_name: Required. The name of the metric for which usage should be tracked. + :type metric_name: str + :param lower_load_threshold: Required. The lower limit of the load below which a scale in + operation should be performed. + :type lower_load_threshold: float + :param upper_load_threshold: Required. The upper limit of the load beyond which a scale out + operation should be performed. + :type upper_load_threshold: float + :param scale_interval: Required. The period in seconds on which a decision is made whether to + scale or not. This property should come in ISO 8601 format "hh:mm:ss". + :type scale_interval: str + """ + + _validation = { + 'kind': {'required': True}, + 'metric_name': {'required': True}, + 'lower_load_threshold': {'required': True}, + 'upper_load_threshold': {'required': True}, + 'scale_interval': {'required': True}, + } + + _attribute_map = { + 'kind': {'key': 'kind', 'type': 'str'}, + 'metric_name': {'key': 'metricName', 'type': 'str'}, + 'lower_load_threshold': {'key': 'lowerLoadThreshold', 'type': 'float'}, + 'upper_load_threshold': {'key': 'upperLoadThreshold', 'type': 'float'}, + 'scale_interval': {'key': 'scaleInterval', 'type': 'str'}, + } + + def __init__( + self, + *, + metric_name: str, + lower_load_threshold: float, + upper_load_threshold: float, + scale_interval: str, + **kwargs + ): + super(AverageServiceLoadScalingTrigger, self).__init__(**kwargs) + self.kind = 'AverageServiceLoadTrigger' # type: str + self.metric_name = metric_name + self.lower_load_threshold = lower_load_threshold + self.upper_load_threshold = upper_load_threshold + self.scale_interval = scale_interval + + +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, + *, + tenant_id: Optional[str] = None, + cluster_application: Optional[str] = None, + client_application: Optional[str] = None, + **kwargs + ): + super(AzureActiveDirectory, self).__init__(**kwargs) + self.tenant_id = tenant_id + self.cluster_application = cluster_application + self.client_application = client_application + + +class ClientCertificate(msrest.serialization.Model): + """Client certificate definition. + + 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 thumbprint: Certificate thumbprint. + :type thumbprint: str + :param common_name: Certificate common name. + :type common_name: str + :param issuer_thumbprint: Issuer thumbprint for the certificate. Only used together with + CommonName. + :type issuer_thumbprint: str + """ + + _validation = { + 'is_admin': {'required': True}, + } + + _attribute_map = { + 'is_admin': {'key': 'isAdmin', 'type': 'bool'}, + 'thumbprint': {'key': 'thumbprint', 'type': 'str'}, + 'common_name': {'key': 'commonName', 'type': 'str'}, + 'issuer_thumbprint': {'key': 'issuerThumbprint', 'type': 'str'}, + } + + def __init__( + self, + *, + is_admin: bool, + thumbprint: Optional[str] = None, + common_name: Optional[str] = None, + issuer_thumbprint: Optional[str] = None, + **kwargs + ): + super(ClientCertificate, self).__init__(**kwargs) + self.is_admin = is_admin + self.thumbprint = thumbprint + self.common_name = common_name + self.issuer_thumbprint = issuer_thumbprint + + +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, + *, + start_port: int, + end_port: int, + **kwargs + ): + super(EndpointRangeDescription, self).__init__(**kwargs) + self.start_port = start_port + self.end_port = end_port + + +class ErrorModel(msrest.serialization.Model): + """The structure of the error. + + :param error: The error details. + :type error: ~service_fabric_managed_clusters_management_client.models.ErrorModelError + """ + + _attribute_map = { + 'error': {'key': 'error', 'type': 'ErrorModelError'}, + } + + def __init__( + self, + *, + error: Optional["ErrorModelError"] = None, + **kwargs + ): + super(ErrorModel, self).__init__(**kwargs) + self.error = error + + +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, + *, + code: Optional[str] = None, + message: Optional[str] = None, + **kwargs + ): + super(ErrorModelError, self).__init__(**kwargs) + self.code = code + self.message = message + + +class LoadBalancingRule(msrest.serialization.Model): + """Describes a load balancing rule. + + All required parameters must be populated in order to send to Azure. + + :param frontend_port: Required. The port for the external endpoint. Port numbers for each rule + must be unique within the Load Balancer. Acceptable values are between 1 and 65534. + :type frontend_port: int + :param backend_port: Required. The port used for internal connections on the endpoint. + Acceptable values are between 1 and 65535. + :type backend_port: int + :param protocol: Required. The reference to the transport protocol used by the load balancing + rule. Possible values include: "tcp", "udp". + :type protocol: str or ~service_fabric_managed_clusters_management_client.models.Protocol + :param probe_protocol: Required. the reference to the load balancer probe used by the load + balancing rule. Possible values include: "tcp", "http", "https". + :type probe_protocol: str or + ~service_fabric_managed_clusters_management_client.models.ProbeProtocol + :param probe_request_path: The probe request path. Only supported for HTTP/HTTPS probes. + :type probe_request_path: str + """ + + _validation = { + 'frontend_port': {'required': True, 'maximum': 65534, 'minimum': 1}, + 'backend_port': {'required': True, 'maximum': 65534, 'minimum': 1}, + 'protocol': {'required': True}, + 'probe_protocol': {'required': True}, + } + + _attribute_map = { + 'frontend_port': {'key': 'frontendPort', 'type': 'int'}, + 'backend_port': {'key': 'backendPort', 'type': 'int'}, + 'protocol': {'key': 'protocol', 'type': 'str'}, + 'probe_protocol': {'key': 'probeProtocol', 'type': 'str'}, + 'probe_request_path': {'key': 'probeRequestPath', 'type': 'str'}, + } + + def __init__( + self, + *, + frontend_port: int, + backend_port: int, + protocol: Union[str, "Protocol"], + probe_protocol: Union[str, "ProbeProtocol"], + probe_request_path: Optional[str] = None, + **kwargs + ): + super(LoadBalancingRule, self).__init__(**kwargs) + self.frontend_port = frontend_port + self.backend_port = backend_port + self.protocol = protocol + self.probe_protocol = probe_protocol + self.probe_request_path = probe_request_path + + +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: ~service_fabric_managed_clusters_management_client.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, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(Resource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.location = location + self.tags = tags + self.etag = None + self.system_data = None + + +class ManagedCluster(Resource): + """The manged 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: ~service_fabric_managed_clusters_management_client.models.SystemData + :param sku: The sku of the managed cluster. + :type sku: ~service_fabric_managed_clusters_management_client.models.Sku + :param dns_name: The cluster dns name. + :type dns_name: str + :ivar fqdn: The fully qualified domain name associated with the public load balancer of the + cluster. + :vartype fqdn: str + :ivar ipv4_address: The IPv4 address associated with the public load balancer of the cluster. + :vartype ipv4_address: 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. Possible values include: + "WaitingForNodes", "Deploying", "BaselineUpgrade", "Upgrading", "UpgradeFailed", "Ready". + :vartype cluster_state: str or + ~service_fabric_managed_clusters_management_client.models.ClusterState + :ivar cluster_certificate_thumbprints: List of thumbprints of the cluster certificates. + :vartype cluster_certificate_thumbprints: list[str] + :param client_connection_port: The port used for client connections to the cluster. + :type client_connection_port: int + :param http_gateway_connection_port: The port used for HTTP connections to the cluster. + :type http_gateway_connection_port: int + :param admin_user_name: VM admin user name. + :type admin_user_name: str + :param admin_password: VM admin user password. + :type admin_password: str + :param load_balancing_rules: Load balancing rules that are applied to the public load balancer + of the cluster. + :type load_balancing_rules: + list[~service_fabric_managed_clusters_management_client.models.LoadBalancingRule] + :param allow_rdp_access: Setting this to true enables RDP access to the VM. The default NSG + rule opens RDP port to internet which can be overridden with custom Network Security Rules. The + default value for this setting is false. + :type allow_rdp_access: bool + :param network_security_rules: Custom Network Security Rules that are applied to the virtual + network of the cluster. + :type network_security_rules: + list[~service_fabric_managed_clusters_management_client.models.NetworkSecurityRule] + :param clients: Client certificates that are allowed to manage the cluster. + :type clients: + list[~service_fabric_managed_clusters_management_client.models.ClientCertificate] + :param azure_active_directory: The AAD authentication settings of the cluster. + :type azure_active_directory: + ~service_fabric_managed_clusters_management_client.models.AzureActiveDirectory + :param fabric_settings: The list of custom fabric settings to configure the cluster. + :type fabric_settings: + list[~service_fabric_managed_clusters_management_client.models.SettingsSectionDescription] + :ivar provisioning_state: The provisioning state of the managed cluster resource. Possible + values include: "None", "Creating", "Created", "Updating", "Succeeded", "Failed", "Canceled", + "Deleting", "Deleted", "Other". + :vartype provisioning_state: str or + ~service_fabric_managed_clusters_management_client.models.ManagedResourceProvisioningState + :param cluster_code_version: The Service Fabric runtime version of the cluster. This property + 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 cluster_upgrade_cadence: Indicates when new cluster runtime version upgrades will be + applied after they are released. By default is Wave0. Possible values include: "Wave0", + "Wave1", "Wave2". + :type cluster_upgrade_cadence: str or + ~service_fabric_managed_clusters_management_client.models.ClusterUpgradeCadence + :param addon_features: List of add-on features to enable on the cluster. + :type addon_features: list[str or + ~service_fabric_managed_clusters_management_client.models.ManagedClusterAddOnFeature] + :param enable_auto_os_upgrade: Setting this to true enables automatic OS upgrade for the node + types that are created using any platform OS image with version 'latest'. The default value for + this setting is false. + :type enable_auto_os_upgrade: bool + :param application_type_versions_cleanup_policy: The policy used to clean up unused versions. + :type application_type_versions_cleanup_policy: + ~service_fabric_managed_clusters_management_client.models.ApplicationTypeVersionsCleanupPolicy + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'location': {'required': True}, + 'etag': {'readonly': True}, + 'system_data': {'readonly': True}, + 'fqdn': {'readonly': True}, + 'ipv4_address': {'readonly': True}, + 'cluster_id': {'readonly': True}, + 'cluster_state': {'readonly': True}, + 'cluster_certificate_thumbprints': {'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'}, + 'sku': {'key': 'sku', 'type': 'Sku'}, + 'dns_name': {'key': 'properties.dnsName', 'type': 'str'}, + 'fqdn': {'key': 'properties.fqdn', 'type': 'str'}, + 'ipv4_address': {'key': 'properties.ipv4Address', 'type': 'str'}, + 'cluster_id': {'key': 'properties.clusterId', 'type': 'str'}, + 'cluster_state': {'key': 'properties.clusterState', 'type': 'str'}, + 'cluster_certificate_thumbprints': {'key': 'properties.clusterCertificateThumbprints', 'type': '[str]'}, + 'client_connection_port': {'key': 'properties.clientConnectionPort', 'type': 'int'}, + 'http_gateway_connection_port': {'key': 'properties.httpGatewayConnectionPort', 'type': 'int'}, + 'admin_user_name': {'key': 'properties.adminUserName', 'type': 'str'}, + 'admin_password': {'key': 'properties.adminPassword', 'type': 'str'}, + 'load_balancing_rules': {'key': 'properties.loadBalancingRules', 'type': '[LoadBalancingRule]'}, + 'allow_rdp_access': {'key': 'properties.allowRdpAccess', 'type': 'bool'}, + 'network_security_rules': {'key': 'properties.networkSecurityRules', 'type': '[NetworkSecurityRule]'}, + 'clients': {'key': 'properties.clients', 'type': '[ClientCertificate]'}, + 'azure_active_directory': {'key': 'properties.azureActiveDirectory', 'type': 'AzureActiveDirectory'}, + 'fabric_settings': {'key': 'properties.fabricSettings', 'type': '[SettingsSectionDescription]'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + 'cluster_code_version': {'key': 'properties.clusterCodeVersion', 'type': 'str'}, + 'cluster_upgrade_cadence': {'key': 'properties.clusterUpgradeCadence', 'type': 'str'}, + 'addon_features': {'key': 'properties.addonFeatures', 'type': '[str]'}, + 'enable_auto_os_upgrade': {'key': 'properties.enableAutoOSUpgrade', 'type': 'bool'}, + 'application_type_versions_cleanup_policy': {'key': 'properties.applicationTypeVersionsCleanupPolicy', 'type': 'ApplicationTypeVersionsCleanupPolicy'}, + } + + def __init__( + self, + *, + location: str, + tags: Optional[Dict[str, str]] = None, + sku: Optional["Sku"] = None, + dns_name: Optional[str] = None, + client_connection_port: Optional[int] = 19000, + http_gateway_connection_port: Optional[int] = 19080, + admin_user_name: Optional[str] = None, + admin_password: Optional[str] = None, + load_balancing_rules: Optional[List["LoadBalancingRule"]] = None, + allow_rdp_access: Optional[bool] = None, + network_security_rules: Optional[List["NetworkSecurityRule"]] = None, + clients: Optional[List["ClientCertificate"]] = None, + azure_active_directory: Optional["AzureActiveDirectory"] = None, + fabric_settings: Optional[List["SettingsSectionDescription"]] = None, + cluster_code_version: Optional[str] = None, + cluster_upgrade_cadence: Optional[Union[str, "ClusterUpgradeCadence"]] = None, + addon_features: Optional[List[Union[str, "ManagedClusterAddOnFeature"]]] = None, + enable_auto_os_upgrade: Optional[bool] = None, + application_type_versions_cleanup_policy: Optional["ApplicationTypeVersionsCleanupPolicy"] = None, + **kwargs + ): + super(ManagedCluster, self).__init__(location=location, tags=tags, **kwargs) + self.sku = sku + self.dns_name = dns_name + self.fqdn = None + self.ipv4_address = None + self.cluster_id = None + self.cluster_state = None + self.cluster_certificate_thumbprints = None + self.client_connection_port = client_connection_port + self.http_gateway_connection_port = http_gateway_connection_port + self.admin_user_name = admin_user_name + self.admin_password = admin_password + self.load_balancing_rules = load_balancing_rules + self.allow_rdp_access = allow_rdp_access + self.network_security_rules = network_security_rules + self.clients = clients + self.azure_active_directory = azure_active_directory + self.fabric_settings = fabric_settings + self.provisioning_state = None + self.cluster_code_version = cluster_code_version + self.cluster_upgrade_cadence = cluster_upgrade_cadence + self.addon_features = addon_features + self.enable_auto_os_upgrade = enable_auto_os_upgrade + self.application_type_versions_cleanup_policy = application_type_versions_cleanup_policy + + +class ManagedClusterListResult(msrest.serialization.Model): + """Managed Cluster list results. + + :param value: + :type value: list[~service_fabric_managed_clusters_management_client.models.ManagedCluster] + :param next_link: The URL to use for getting the next set of results. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ManagedCluster]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["ManagedCluster"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(ManagedClusterListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class ManagedClusterUpdateParameters(msrest.serialization.Model): + """Managed cluster update request. + + :param tags: A set of tags. Managed cluster update parameters. + :type tags: dict[str, str] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(ManagedClusterUpdateParameters, self).__init__(**kwargs) + self.tags = tags + + +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: "None", + "SystemAssigned", "UserAssigned", "SystemAssigned, UserAssigned". + :type type: str or + ~service_fabric_managed_clusters_management_client.models.ManagedIdentityType + :param user_assigned_identities: The list of user identities associated with the resource. The + 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, + ~service_fabric_managed_clusters_management_client.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, + *, + type: Optional[Union[str, "ManagedIdentityType"]] = None, + user_assigned_identities: Optional[Dict[str, "UserAssignedIdentity"]] = None, + **kwargs + ): + super(ManagedIdentity, self).__init__(**kwargs) + self.principal_id = None + self.tenant_id = None + self.type = type + self.user_assigned_identities = user_assigned_identities + + +class ManagedProxyResource(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 tags: A set of tags. Azure resource tags. + :type tags: dict[str, str] + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~service_fabric_managed_clusters_management_client.models.SystemData + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(ManagedProxyResource, self).__init__(**kwargs) + self.id = None + self.name = None + self.type = None + self.tags = tags + self.system_data = None + + +class Partition(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: NamedPartitionScheme, SingletonPartitionScheme, UniformInt64RangePartitionScheme. + + All required parameters must be populated in order to send to Azure. + + :param partition_scheme: Required. Specifies how the service is partitioned.Constant filled by + server. Possible values include: "Singleton", "UniformInt64Range", "Named". + :type partition_scheme: str or + ~service_fabric_managed_clusters_management_client.models.PartitionScheme + """ + + _validation = { + 'partition_scheme': {'required': True}, + } + + _attribute_map = { + 'partition_scheme': {'key': 'partitionScheme', 'type': 'str'}, + } + + _subtype_map = { + 'partition_scheme': {'Named': 'NamedPartitionScheme', 'Singleton': 'SingletonPartitionScheme', 'UniformInt64Range': 'UniformInt64RangePartitionScheme'} + } + + def __init__( + self, + **kwargs + ): + super(Partition, self).__init__(**kwargs) + self.partition_scheme = None # type: Optional[str] + + +class NamedPartitionScheme(Partition): + """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: "Singleton", "UniformInt64Range", "Named". + :type partition_scheme: str or + ~service_fabric_managed_clusters_management_client.models.PartitionScheme + :param names: Required. Array for the names of the partitions. + :type names: list[str] + """ + + _validation = { + 'partition_scheme': {'required': True}, + 'names': {'required': True}, + } + + _attribute_map = { + 'partition_scheme': {'key': 'partitionScheme', 'type': 'str'}, + 'names': {'key': 'names', 'type': '[str]'}, + } + + def __init__( + self, + *, + names: List[str], + **kwargs + ): + super(NamedPartitionScheme, self).__init__(**kwargs) + self.partition_scheme = 'Named' # type: str + self.names = names + + +class NetworkSecurityRule(msrest.serialization.Model): + """Describes a network security rule. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Network security rule name. + :type name: str + :param description: Network security rule description. + :type description: str + :param protocol: Required. Network protocol this rule applies to. Possible values include: + "http", "https", "tcp", "udp", "icmp", "ah", "esp". + :type protocol: str or ~service_fabric_managed_clusters_management_client.models.NsgProtocol + :param source_address_prefixes: The CIDR or source IP ranges. + :type source_address_prefixes: list[str] + :param destination_address_prefixes: The destination address prefixes. CIDR or destination IP + ranges. + :type destination_address_prefixes: list[str] + :param source_port_ranges: The source port ranges. + :type source_port_ranges: list[str] + :param destination_port_ranges: The destination port ranges. + :type destination_port_ranges: list[str] + :param access: Required. The network traffic is allowed or denied. Possible values include: + "allow", "deny". + :type access: str or ~service_fabric_managed_clusters_management_client.models.Access + :param priority: Required. The priority of the rule. The value can be in the range 1000 to + 3000. Values outside this range are reserved for Service Fabric ManagerCluster Resource + Provider. The priority number must be unique for each rule in the collection. The lower the + priority number, the higher the priority of the rule. + :type priority: int + :param direction: Required. Network security rule direction. Possible values include: + "inbound", "outbound". + :type direction: str or ~service_fabric_managed_clusters_management_client.models.Direction + """ + + _validation = { + 'name': {'required': True}, + 'protocol': {'required': True}, + 'access': {'required': True}, + 'priority': {'required': True, 'maximum': 3000, 'minimum': 1000}, + 'direction': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'description': {'key': 'description', 'type': 'str'}, + 'protocol': {'key': 'protocol', 'type': 'str'}, + 'source_address_prefixes': {'key': 'sourceAddressPrefixes', 'type': '[str]'}, + 'destination_address_prefixes': {'key': 'destinationAddressPrefixes', 'type': '[str]'}, + 'source_port_ranges': {'key': 'sourcePortRanges', 'type': '[str]'}, + 'destination_port_ranges': {'key': 'destinationPortRanges', 'type': '[str]'}, + 'access': {'key': 'access', 'type': 'str'}, + 'priority': {'key': 'priority', 'type': 'int'}, + 'direction': {'key': 'direction', 'type': 'str'}, + } + + def __init__( + self, + *, + name: str, + protocol: Union[str, "NsgProtocol"], + access: Union[str, "Access"], + priority: int, + direction: Union[str, "Direction"], + description: Optional[str] = None, + source_address_prefixes: Optional[List[str]] = None, + destination_address_prefixes: Optional[List[str]] = None, + source_port_ranges: Optional[List[str]] = None, + destination_port_ranges: Optional[List[str]] = None, + **kwargs + ): + super(NetworkSecurityRule, self).__init__(**kwargs) + self.name = name + self.description = description + self.protocol = protocol + self.source_address_prefixes = source_address_prefixes + self.destination_address_prefixes = destination_address_prefixes + self.source_port_ranges = source_port_ranges + self.destination_port_ranges = destination_port_ranges + self.access = access + self.priority = priority + self.direction = direction + + +class NodeType(ManagedProxyResource): + """Describes a node type in the cluster, each node type represents sub set of nodes in the cluster. + + 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 tags: A set of tags. Azure resource tags. + :type tags: dict[str, str] + :ivar system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~service_fabric_managed_clusters_management_client.models.SystemData + :param is_primary: The node type on which system services will run. Only one node type should + be marked as primary. Primary node type cannot be deleted or changed for existing clusters. + :type is_primary: bool + :param vm_instance_count: The number of nodes in the node type. + :type vm_instance_count: int + :param data_disk_size_gb: Disk size for each vm in the node type in GBs. + :type data_disk_size_gb: int + :param placement_properties: The placement tags applied to nodes in the node type, which can be + used to indicate where certain services (workload) should run. + :type placement_properties: dict[str, str] + :param capacities: The capacity tags applied to the nodes in the node type, the cluster + resource manager uses these tags to understand how much resource a node has. + :type capacities: dict[str, str] + :param application_ports: The range of ports from which cluster assigned port to Service Fabric + applications. + :type application_ports: + ~service_fabric_managed_clusters_management_client.models.EndpointRangeDescription + :param ephemeral_ports: The range of ephemeral ports that nodes in this node type should be + configured with. + :type ephemeral_ports: + ~service_fabric_managed_clusters_management_client.models.EndpointRangeDescription + :param vm_size: The size of virtual machines in the pool. All virtual machines in a pool are + the same size. For example, Standard_D3. + :type vm_size: str + :param vm_image_publisher: The publisher of the Azure Virtual Machines Marketplace image. For + example, Canonical or MicrosoftWindowsServer. + :type vm_image_publisher: str + :param vm_image_offer: The offer type of the Azure Virtual Machines Marketplace image. For + example, UbuntuServer or WindowsServer. + :type vm_image_offer: str + :param vm_image_sku: The SKU of the Azure Virtual Machines Marketplace image. For example, + 14.04.0-LTS or 2012-R2-Datacenter. + :type vm_image_sku: str + :param vm_image_version: The version of the Azure Virtual Machines Marketplace image. A value + of 'latest' can be specified to select the latest version of an image. If omitted, the default + is 'latest'. + :type vm_image_version: str + :param vm_secrets: The secrets to install in the virtual machines. + :type vm_secrets: + list[~service_fabric_managed_clusters_management_client.models.VaultSecretGroup] + :param vm_extensions: Set of extensions that should be installed onto the virtual machines. + :type vm_extensions: + list[~service_fabric_managed_clusters_management_client.models.VMSSExtension] + :param vm_managed_identity: Identities for the virtual machine scale set under the node type. + :type vm_managed_identity: + ~service_fabric_managed_clusters_management_client.models.VmManagedIdentity + :ivar provisioning_state: The provisioning state of the managed cluster resource. Possible + values include: "None", "Creating", "Created", "Updating", "Succeeded", "Failed", "Canceled", + "Deleting", "Deleted", "Other". + :vartype provisioning_state: str or + ~service_fabric_managed_clusters_management_client.models.ManagedResourceProvisioningState + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + 'vm_instance_count': {'maximum': 2147483647, 'minimum': 1}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'is_primary': {'key': 'properties.isPrimary', 'type': 'bool'}, + 'vm_instance_count': {'key': 'properties.vmInstanceCount', 'type': 'int'}, + 'data_disk_size_gb': {'key': 'properties.dataDiskSizeGB', 'type': 'int'}, + 'placement_properties': {'key': 'properties.placementProperties', 'type': '{str}'}, + 'capacities': {'key': 'properties.capacities', 'type': '{str}'}, + 'application_ports': {'key': 'properties.applicationPorts', 'type': 'EndpointRangeDescription'}, + 'ephemeral_ports': {'key': 'properties.ephemeralPorts', 'type': 'EndpointRangeDescription'}, + 'vm_size': {'key': 'properties.vmSize', 'type': 'str'}, + 'vm_image_publisher': {'key': 'properties.vmImagePublisher', 'type': 'str'}, + 'vm_image_offer': {'key': 'properties.vmImageOffer', 'type': 'str'}, + 'vm_image_sku': {'key': 'properties.vmImageSku', 'type': 'str'}, + 'vm_image_version': {'key': 'properties.vmImageVersion', 'type': 'str'}, + 'vm_secrets': {'key': 'properties.vmSecrets', 'type': '[VaultSecretGroup]'}, + 'vm_extensions': {'key': 'properties.vmExtensions', 'type': '[VMSSExtension]'}, + 'vm_managed_identity': {'key': 'properties.vmManagedIdentity', 'type': 'VmManagedIdentity'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + is_primary: Optional[bool] = None, + vm_instance_count: Optional[int] = None, + data_disk_size_gb: Optional[int] = None, + placement_properties: Optional[Dict[str, str]] = None, + capacities: Optional[Dict[str, str]] = None, + application_ports: Optional["EndpointRangeDescription"] = None, + ephemeral_ports: Optional["EndpointRangeDescription"] = None, + vm_size: Optional[str] = None, + vm_image_publisher: Optional[str] = None, + vm_image_offer: Optional[str] = None, + vm_image_sku: Optional[str] = None, + vm_image_version: Optional[str] = None, + vm_secrets: Optional[List["VaultSecretGroup"]] = None, + vm_extensions: Optional[List["VMSSExtension"]] = None, + vm_managed_identity: Optional["VmManagedIdentity"] = None, + **kwargs + ): + super(NodeType, self).__init__(tags=tags, **kwargs) + self.is_primary = is_primary + self.vm_instance_count = vm_instance_count + self.data_disk_size_gb = data_disk_size_gb + self.placement_properties = placement_properties + self.capacities = capacities + self.application_ports = application_ports + self.ephemeral_ports = ephemeral_ports + self.vm_size = vm_size + self.vm_image_publisher = vm_image_publisher + self.vm_image_offer = vm_image_offer + self.vm_image_sku = vm_image_sku + self.vm_image_version = vm_image_version + self.vm_secrets = vm_secrets + self.vm_extensions = vm_extensions + self.vm_managed_identity = vm_managed_identity + self.provisioning_state = None + + +class NodeTypeActionParameters(msrest.serialization.Model): + """Parameters for Node type action. + + All required parameters must be populated in order to send to Azure. + + :param nodes: Required. List of node names from the node type. + :type nodes: list[str] + :param force: Force the action to go through. + :type force: bool + """ + + _validation = { + 'nodes': {'required': True}, + } + + _attribute_map = { + 'nodes': {'key': 'nodes', 'type': '[str]'}, + 'force': {'key': 'force', 'type': 'bool'}, + } + + def __init__( + self, + *, + nodes: List[str], + force: Optional[bool] = None, + **kwargs + ): + super(NodeTypeActionParameters, self).__init__(**kwargs) + self.nodes = nodes + self.force = force + + +class NodeTypeListResult(msrest.serialization.Model): + """Node type list results. + + :param value: The list of node types. + :type value: list[~service_fabric_managed_clusters_management_client.models.NodeType] + :param next_link: The URL to use for getting the next set of results. + :type next_link: str + """ + + _attribute_map = { + 'value': {'key': 'value', 'type': '[NodeType]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["NodeType"]] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(NodeTypeListResult, self).__init__(**kwargs) + self.value = value + self.next_link = next_link + + +class NodeTypeUpdateParameters(msrest.serialization.Model): + """Node type update request. + + :param tags: A set of tags. Node type update parameters. + :type tags: dict[str, str] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(NodeTypeUpdateParameters, self).__init__(**kwargs) + self.tags = tags + + +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[~service_fabric_managed_clusters_management_client.models.OperationResult] + :ivar next_link: URL to get the next set of operation list results if there are any. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[OperationResult]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["OperationResult"]] = None, + **kwargs + ): + super(OperationListResult, self).__init__(**kwargs) + self.value = value + 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: + ~service_fabric_managed_clusters_management_client.models.AvailableOperationDisplay + :param origin: Origin result. + :type origin: str + :param next_link: The URL to use for getting the next set of results. + :type next_link: str + """ + + _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, + *, + name: Optional[str] = None, + is_data_action: Optional[bool] = None, + display: Optional["AvailableOperationDisplay"] = None, + origin: Optional[str] = None, + next_link: Optional[str] = None, + **kwargs + ): + super(OperationResult, self).__init__(**kwargs) + self.name = name + self.is_data_action = is_data_action + self.display = display + self.origin = origin + self.next_link = next_link + + +class PartitionInstanceCountScaleMechanism(ScalingMechanism): + """Represents a scaling mechanism for adding or removing instances of stateless service partition. + + All required parameters must be populated in order to send to Azure. + + :param kind: Required. Specifies the mechanism associated with this scaling policy.Constant + filled by server. Possible values include: "ScalePartitionInstanceCount", + "AddRemoveIncrementalNamedPartition". + :type kind: str or + ~service_fabric_managed_clusters_management_client.models.ServiceScalingMechanismKind + :param min_instance_count: Required. Minimum number of instances of the partition. + :type min_instance_count: int + :param max_instance_count: Required. Maximum number of instances of the partition. + :type max_instance_count: int + :param scale_increment: Required. The number of instances to add or remove during a scaling + operation. + :type scale_increment: int + """ + + _validation = { + 'kind': {'required': True}, + 'min_instance_count': {'required': True}, + 'max_instance_count': {'required': True}, + 'scale_increment': {'required': True}, + } + + _attribute_map = { + 'kind': {'key': 'kind', 'type': 'str'}, + 'min_instance_count': {'key': 'minInstanceCount', 'type': 'int'}, + 'max_instance_count': {'key': 'maxInstanceCount', 'type': 'int'}, + 'scale_increment': {'key': 'scaleIncrement', 'type': 'int'}, + } + + def __init__( + self, + *, + min_instance_count: int, + max_instance_count: int, + scale_increment: int, + **kwargs + ): + super(PartitionInstanceCountScaleMechanism, self).__init__(**kwargs) + self.kind = 'ScalePartitionInstanceCount' # type: str + self.min_instance_count = min_instance_count + self.max_instance_count = max_instance_count + self.scale_increment = scale_increment + + +class RollingUpgradeMonitoringPolicy(msrest.serialization.Model): + """The policy used for monitoring the application upgrade. + + All required parameters must be populated in order to send to Azure. + + :param failure_action: Required. The compensating action to perform when a Monitored upgrade + encounters monitoring policy or health policy violations. Invalid indicates the failure action + is invalid. Rollback specifies that the upgrade will start rolling back automatically. Manual + indicates that the upgrade will switch to UnmonitoredManual upgrade mode. Possible values + include: "Rollback", "Manual". + :type failure_action: str or + ~service_fabric_managed_clusters_management_client.models.FailureAction + :param health_check_wait_duration: Required. The amount of time to wait after completing an + upgrade domain before applying health policies. It is interpreted as a string representing an + ISO 8601 duration with following format "hh:mm:ss.fff". + :type health_check_wait_duration: str + :param health_check_stable_duration: Required. The amount of time that the application or + cluster must remain healthy before the upgrade proceeds to the next upgrade domain. It is + interpreted as a string representing an ISO 8601 duration with following format "hh:mm:ss.fff". + :type health_check_stable_duration: str + :param health_check_retry_timeout: Required. The amount of time to retry health evaluation when + the application or cluster is unhealthy before FailureAction is executed. It is interpreted as + a string representing an ISO 8601 duration with following format "hh:mm:ss.fff". + :type health_check_retry_timeout: str + :param upgrade_timeout: Required. The amount of time the overall upgrade has to complete before + FailureAction is executed. Cannot be larger than 12 hours. It is interpreted as a string + representing an ISO 8601 duration with following format "hh:mm:ss.fff". + :type upgrade_timeout: str + :param upgrade_domain_timeout: Required. The amount of time each upgrade domain has to complete + before FailureAction is executed. Cannot be larger than 12 hours. It is interpreted as a string + representing an ISO 8601 duration with following format "hh:mm:ss.fff". + :type upgrade_domain_timeout: str + """ + + _validation = { + 'failure_action': {'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}, + } + + _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, + *, + failure_action: Union[str, "FailureAction"], + health_check_wait_duration: str, + health_check_stable_duration: str, + health_check_retry_timeout: str, + upgrade_timeout: str, + upgrade_domain_timeout: str, + **kwargs + ): + super(RollingUpgradeMonitoringPolicy, self).__init__(**kwargs) + self.failure_action = failure_action + self.health_check_wait_duration = health_check_wait_duration + self.health_check_stable_duration = health_check_stable_duration + self.health_check_retry_timeout = health_check_retry_timeout + self.upgrade_timeout = upgrade_timeout + self.upgrade_domain_timeout = upgrade_domain_timeout + + +class ScalingPolicy(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 scaling_mechanism: Required. Specifies the mechanism associated with this scaling + policy. + :type scaling_mechanism: + ~service_fabric_managed_clusters_management_client.models.ScalingMechanism + :param scaling_trigger: Required. Specifies the trigger associated with this scaling policy. + :type scaling_trigger: ~service_fabric_managed_clusters_management_client.models.ScalingTrigger + """ + + _validation = { + 'scaling_mechanism': {'required': True}, + 'scaling_trigger': {'required': True}, + } + + _attribute_map = { + 'scaling_mechanism': {'key': 'scalingMechanism', 'type': 'ScalingMechanism'}, + 'scaling_trigger': {'key': 'scalingTrigger', 'type': 'ScalingTrigger'}, + } + + def __init__( + self, + *, + scaling_mechanism: "ScalingMechanism", + scaling_trigger: "ScalingTrigger", + **kwargs + ): + super(ScalingPolicy, self).__init__(**kwargs) + self.scaling_mechanism = scaling_mechanism + self.scaling_trigger = scaling_trigger + + +class ServiceCorrelation(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: + "AlignedAffinity", "NonAlignedAffinity". + :type scheme: str or + ~service_fabric_managed_clusters_management_client.models.ServiceCorrelationScheme + :param service_name: Required. The Arm Resource ID of the service that the correlation + 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, + *, + scheme: Union[str, "ServiceCorrelationScheme"], + service_name: str, + **kwargs + ): + super(ServiceCorrelation, self).__init__(**kwargs) + self.scheme = scheme + self.service_name = service_name + + +class ServiceLoadMetric(msrest.serialization.Model): + """Specifies a metric to load balance a service during runtime. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. The name of the metric. If the service chooses to report load during + 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 + ~service_fabric_managed_clusters_management_client.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, + *, + name: str, + weight: Optional[Union[str, "ServiceLoadMetricWeight"]] = None, + primary_default_load: Optional[int] = None, + secondary_default_load: Optional[int] = None, + default_load: Optional[int] = None, + **kwargs + ): + super(ServiceLoadMetric, self).__init__(**kwargs) + self.name = name + self.weight = weight + self.primary_default_load = primary_default_load + self.secondary_default_load = secondary_default_load + self.default_load = default_load + + +class ServicePlacementPolicy(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: ServicePlacementInvalidDomainPolicy, ServicePlacementNonPartiallyPlaceServicePolicy, ServicePlacementPreferPrimaryDomainPolicy, ServicePlacementRequiredDomainPolicy, ServicePlacementRequireDomainDistributionPolicy. + + All required parameters must be populated in order to send to Azure. + + :param type: Required. The type of placement policy for a service fabric service. Following are + the possible values.Constant filled by server. Possible values include: "InvalidDomain", + "RequiredDomain", "PreferredPrimaryDomain", "RequiredDomainDistribution", + "NonPartiallyPlaceService". + :type type: str or + ~service_fabric_managed_clusters_management_client.models.ServicePlacementPolicyType + """ + + _validation = { + 'type': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + } + + _subtype_map = { + 'type': {'InvalidDomain': 'ServicePlacementInvalidDomainPolicy', 'NonPartiallyPlaceService': 'ServicePlacementNonPartiallyPlaceServicePolicy', 'PreferredPrimaryDomain': 'ServicePlacementPreferPrimaryDomainPolicy', 'RequiredDomain': 'ServicePlacementRequiredDomainPolicy', 'RequiredDomainDistribution': 'ServicePlacementRequireDomainDistributionPolicy'} + } + + def __init__( + self, + **kwargs + ): + super(ServicePlacementPolicy, self).__init__(**kwargs) + self.type = None # type: Optional[str] + + +class ServicePlacementInvalidDomainPolicy(ServicePlacementPolicy): + """Describes the policy to be used for placement of a Service Fabric service where a particular fault or upgrade domain should not be used for placement of the instances or replicas of that service. + + All required parameters must be populated in order to send to Azure. + + :param type: Required. The type of placement policy for a service fabric service. Following are + the possible values.Constant filled by server. Possible values include: "InvalidDomain", + "RequiredDomain", "PreferredPrimaryDomain", "RequiredDomainDistribution", + "NonPartiallyPlaceService". + :type type: str or + ~service_fabric_managed_clusters_management_client.models.ServicePlacementPolicyType + :param domain_name: Required. The name of the domain that should not be used for placement. + :type domain_name: str + """ + + _validation = { + 'type': {'required': True}, + 'domain_name': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'domain_name': {'key': 'domainName', 'type': 'str'}, + } + + def __init__( + self, + *, + domain_name: str, + **kwargs + ): + super(ServicePlacementInvalidDomainPolicy, self).__init__(**kwargs) + self.type = 'InvalidDomain' # type: str + self.domain_name = domain_name + + +class ServicePlacementNonPartiallyPlaceServicePolicy(ServicePlacementPolicy): + """ServicePlacementNonPartiallyPlaceServicePolicy. + + All required parameters must be populated in order to send to Azure. + + :param type: Required. The type of placement policy for a service fabric service. Following are + the possible values.Constant filled by server. Possible values include: "InvalidDomain", + "RequiredDomain", "PreferredPrimaryDomain", "RequiredDomainDistribution", + "NonPartiallyPlaceService". + :type type: str or + ~service_fabric_managed_clusters_management_client.models.ServicePlacementPolicyType + """ + + _validation = { + 'type': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(ServicePlacementNonPartiallyPlaceServicePolicy, self).__init__(**kwargs) + self.type = 'NonPartiallyPlaceService' # type: str + + +class ServicePlacementPreferPrimaryDomainPolicy(ServicePlacementPolicy): + """Describes the policy to be used for placement of a Service Fabric service where the service's +Primary replicas should optimally be placed in a particular domain. + +This placement policy is usually used with fault domains in scenarios where the Service Fabric +cluster is geographically distributed in order to indicate that a service's primary replica should +be located in a particular fault domain, which in geo-distributed scenarios usually aligns with regional +or datacenter boundaries. Note that since this is an optimization it is possible that the Primary replica +may not end up located in this domain due to failures, capacity limits, or other constraints. + + All required parameters must be populated in order to send to Azure. + + :param type: Required. The type of placement policy for a service fabric service. Following are + the possible values.Constant filled by server. Possible values include: "InvalidDomain", + "RequiredDomain", "PreferredPrimaryDomain", "RequiredDomainDistribution", + "NonPartiallyPlaceService". + :type type: str or + ~service_fabric_managed_clusters_management_client.models.ServicePlacementPolicyType + :param domain_name: Required. The name of the domain that should used for placement as per this + policy. + :type domain_name: str + """ + + _validation = { + 'type': {'required': True}, + 'domain_name': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'domain_name': {'key': 'domainName', 'type': 'str'}, + } + + def __init__( + self, + *, + domain_name: str, + **kwargs + ): + super(ServicePlacementPreferPrimaryDomainPolicy, self).__init__(**kwargs) + self.type = 'PreferredPrimaryDomain' # type: str + self.domain_name = domain_name + + +class ServicePlacementRequiredDomainPolicy(ServicePlacementPolicy): + """Describes the policy to be used for placement of a Service Fabric service where the instances or replicas of that service must be placed in a particular domain. + + All required parameters must be populated in order to send to Azure. + + :param type: Required. The type of placement policy for a service fabric service. Following are + the possible values.Constant filled by server. Possible values include: "InvalidDomain", + "RequiredDomain", "PreferredPrimaryDomain", "RequiredDomainDistribution", + "NonPartiallyPlaceService". + :type type: str or + ~service_fabric_managed_clusters_management_client.models.ServicePlacementPolicyType + :param domain_name: Required. The name of the domain that should used for placement as per this + policy. + :type domain_name: str + """ + + _validation = { + 'type': {'required': True}, + 'domain_name': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'domain_name': {'key': 'domainName', 'type': 'str'}, + } + + def __init__( + self, + *, + domain_name: str, + **kwargs + ): + super(ServicePlacementRequiredDomainPolicy, self).__init__(**kwargs) + self.type = 'RequiredDomain' # type: str + self.domain_name = domain_name + + +class ServicePlacementRequireDomainDistributionPolicy(ServicePlacementPolicy): + """Describes the policy to be used for placement of a Service Fabric service where two replicas +from the same partition should never be placed in the same fault or upgrade domain. + +While this is not common it can expose the service to an increased risk of concurrent failures +due to unplanned outages or other cases of subsequent/concurrent failures. As an example, consider +a case where replicas are deployed across different data center, with one replica per location. +In the event that one of the datacenters goes offline, normally the replica that was placed in that +datacenter will be packed into one of the remaining datacenters. If this is not desirable then this +policy should be set. + + All required parameters must be populated in order to send to Azure. + + :param type: Required. The type of placement policy for a service fabric service. Following are + the possible values.Constant filled by server. Possible values include: "InvalidDomain", + "RequiredDomain", "PreferredPrimaryDomain", "RequiredDomainDistribution", + "NonPartiallyPlaceService". + :type type: str or + ~service_fabric_managed_clusters_management_client.models.ServicePlacementPolicyType + :param domain_name: Required. The name of the domain that should used for placement as per this + policy. + :type domain_name: str + """ + + _validation = { + 'type': {'required': True}, + 'domain_name': {'required': True}, + } + + _attribute_map = { + 'type': {'key': 'type', 'type': 'str'}, + 'domain_name': {'key': 'domainName', 'type': 'str'}, + } + + def __init__( + self, + *, + domain_name: str, + **kwargs + ): + super(ServicePlacementRequireDomainDistributionPolicy, self).__init__(**kwargs) + self.type = 'RequiredDomainDistribution' # type: str + self.domain_name = domain_name + + +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: 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 system_data: Metadata pertaining to creation and last modification of the resource. + :vartype system_data: ~service_fabric_managed_clusters_management_client.models.SystemData + :param properties: The service resource properties. + :type properties: + ~service_fabric_managed_clusters_management_client.models.ServiceResourceProperties + """ + + _validation = { + 'id': {'readonly': True}, + 'name': {'readonly': True}, + 'type': {'readonly': True}, + 'system_data': {'readonly': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + 'name': {'key': 'name', 'type': 'str'}, + 'type': {'key': 'type', 'type': 'str'}, + 'location': {'key': 'location', 'type': 'str'}, + 'tags': {'key': 'tags', 'type': '{str}'}, + 'system_data': {'key': 'systemData', 'type': 'SystemData'}, + 'properties': {'key': 'properties', 'type': 'ServiceResourceProperties'}, + } + + def __init__( + self, + *, + location: Optional[str] = None, + tags: Optional[Dict[str, str]] = None, + properties: Optional["ServiceResourceProperties"] = None, + **kwargs + ): + super(ServiceResource, self).__init__(location=location, tags=tags, **kwargs) + self.properties = properties + + +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[~service_fabric_managed_clusters_management_client.models.ServiceResource] + :ivar next_link: URL to get the next set of service list results if there are any. + :vartype next_link: str + """ + + _validation = { + 'next_link': {'readonly': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': '[ServiceResource]'}, + 'next_link': {'key': 'nextLink', 'type': 'str'}, + } + + def __init__( + self, + *, + value: Optional[List["ServiceResource"]] = None, + **kwargs + ): + super(ServiceResourceList, self).__init__(**kwargs) + self.value = value + 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[~service_fabric_managed_clusters_management_client.models.ServiceCorrelation] + :param service_load_metrics: The service load metrics is given as an array of ServiceLoadMetric + objects. + :type service_load_metrics: + list[~service_fabric_managed_clusters_management_client.models.ServiceLoadMetric] + :param service_placement_policies: A list that describes the correlation of the service with + other services. + :type service_placement_policies: + list[~service_fabric_managed_clusters_management_client.models.ServicePlacementPolicy] + :param default_move_cost: Specifies the move cost for the service. Possible values include: + "Zero", "Low", "Medium", "High". + :type default_move_cost: str or + ~service_fabric_managed_clusters_management_client.models.MoveCost + :param scaling_policies: Scaling policies for this service. + :type scaling_policies: + list[~service_fabric_managed_clusters_management_client.models.ScalingPolicy] + """ + + _attribute_map = { + 'placement_constraints': {'key': 'placementConstraints', 'type': 'str'}, + 'correlation_scheme': {'key': 'correlationScheme', 'type': '[ServiceCorrelation]'}, + 'service_load_metrics': {'key': 'serviceLoadMetrics', 'type': '[ServiceLoadMetric]'}, + 'service_placement_policies': {'key': 'servicePlacementPolicies', 'type': '[ServicePlacementPolicy]'}, + 'default_move_cost': {'key': 'defaultMoveCost', 'type': 'str'}, + 'scaling_policies': {'key': 'scalingPolicies', 'type': '[ScalingPolicy]'}, + } + + def __init__( + self, + *, + placement_constraints: Optional[str] = None, + correlation_scheme: Optional[List["ServiceCorrelation"]] = None, + service_load_metrics: Optional[List["ServiceLoadMetric"]] = None, + service_placement_policies: Optional[List["ServicePlacementPolicy"]] = None, + default_move_cost: Optional[Union[str, "MoveCost"]] = None, + scaling_policies: Optional[List["ScalingPolicy"]] = None, + **kwargs + ): + super(ServiceResourcePropertiesBase, self).__init__(**kwargs) + self.placement_constraints = placement_constraints + self.correlation_scheme = correlation_scheme + self.service_load_metrics = service_load_metrics + self.service_placement_policies = service_placement_policies + self.default_move_cost = default_move_cost + self.scaling_policies = scaling_policies + + +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[~service_fabric_managed_clusters_management_client.models.ServiceCorrelation] + :param service_load_metrics: The service load metrics is given as an array of ServiceLoadMetric + objects. + :type service_load_metrics: + list[~service_fabric_managed_clusters_management_client.models.ServiceLoadMetric] + :param service_placement_policies: A list that describes the correlation of the service with + other services. + :type service_placement_policies: + list[~service_fabric_managed_clusters_management_client.models.ServicePlacementPolicy] + :param default_move_cost: Specifies the move cost for the service. Possible values include: + "Zero", "Low", "Medium", "High". + :type default_move_cost: str or + ~service_fabric_managed_clusters_management_client.models.MoveCost + :param scaling_policies: Scaling policies for this service. + :type scaling_policies: + list[~service_fabric_managed_clusters_management_client.models.ScalingPolicy] + :ivar provisioning_state: The current deployment or provisioning state, which only appears in + the response. + :vartype provisioning_state: str + :param service_kind: Required. The kind of service (Stateless or Stateful).Constant filled by + server. Possible values include: "Stateless", "Stateful". + :type service_kind: str or + ~service_fabric_managed_clusters_management_client.models.ServiceKind + :param service_type_name: Required. The name of the service type. + :type service_type_name: str + :param partition_description: Required. Describes how the service is partitioned. + :type partition_description: + ~service_fabric_managed_clusters_management_client.models.Partition + :param service_package_activation_mode: The activation Mode of the service package. Possible + values include: "SharedProcess", "ExclusiveProcess". + :type service_package_activation_mode: str or + ~service_fabric_managed_clusters_management_client.models.ServicePackageActivationMode + :param service_dns_name: The DNS name of the service. It requires the DNS system service to be + enabled in Service Fabric cluster. + :type service_dns_name: str + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'service_kind': {'required': True}, + 'service_type_name': {'required': True}, + 'partition_description': {'required': True}, + } + + _attribute_map = { + 'placement_constraints': {'key': 'placementConstraints', 'type': 'str'}, + 'correlation_scheme': {'key': 'correlationScheme', 'type': '[ServiceCorrelation]'}, + 'service_load_metrics': {'key': 'serviceLoadMetrics', 'type': '[ServiceLoadMetric]'}, + 'service_placement_policies': {'key': 'servicePlacementPolicies', 'type': '[ServicePlacementPolicy]'}, + 'default_move_cost': {'key': 'defaultMoveCost', 'type': 'str'}, + 'scaling_policies': {'key': 'scalingPolicies', 'type': '[ScalingPolicy]'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'service_kind': {'key': 'serviceKind', 'type': 'str'}, + 'service_type_name': {'key': 'serviceTypeName', 'type': 'str'}, + 'partition_description': {'key': 'partitionDescription', 'type': 'Partition'}, + '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, + *, + service_type_name: str, + partition_description: "Partition", + placement_constraints: Optional[str] = None, + correlation_scheme: Optional[List["ServiceCorrelation"]] = None, + service_load_metrics: Optional[List["ServiceLoadMetric"]] = None, + service_placement_policies: Optional[List["ServicePlacementPolicy"]] = None, + default_move_cost: Optional[Union[str, "MoveCost"]] = None, + scaling_policies: Optional[List["ScalingPolicy"]] = None, + service_package_activation_mode: Optional[Union[str, "ServicePackageActivationMode"]] = None, + service_dns_name: Optional[str] = None, + **kwargs + ): + super(ServiceResourceProperties, self).__init__(placement_constraints=placement_constraints, correlation_scheme=correlation_scheme, service_load_metrics=service_load_metrics, service_placement_policies=service_placement_policies, default_move_cost=default_move_cost, scaling_policies=scaling_policies, **kwargs) + self.provisioning_state = None + self.service_kind = 'ServiceResourceProperties' # type: str + self.service_type_name = service_type_name + self.partition_description = partition_description + self.service_package_activation_mode = service_package_activation_mode + self.service_dns_name = service_dns_name + + +class ServiceTypeHealthPolicy(msrest.serialization.Model): + """Represents the health policy used to evaluate the health of services belonging to a service type. + + All required parameters must be populated in order to send to Azure. + + :param max_percent_unhealthy_services: Required. The maximum allowed percentage of unhealthy + services. + + The percentage represents the maximum tolerated percentage of services that can be unhealthy + before the application is considered in error. + If the percentage is respected but there is at least one unhealthy service, the health is + evaluated as Warning. + This is calculated by dividing the number of unhealthy services of the specific service type + over the total number of services of the specific service type. + The computation rounds up to tolerate one failure on small numbers of services. + :type max_percent_unhealthy_services: int + :param max_percent_unhealthy_partitions_per_service: Required. The maximum allowed percentage + of unhealthy partitions per service. + + The percentage represents the maximum tolerated percentage of partitions that can be unhealthy + before the service is considered in error. + If the percentage is respected but there is at least one unhealthy partition, the health is + evaluated as Warning. + The percentage is calculated by dividing the number of unhealthy partitions over the total + number of partitions in the service. + The computation rounds up to tolerate one failure on small numbers of partitions. + :type max_percent_unhealthy_partitions_per_service: int + :param max_percent_unhealthy_replicas_per_partition: Required. The maximum allowed percentage + of unhealthy replicas per partition. + + The percentage represents the maximum tolerated percentage of replicas that can be unhealthy + before the partition is considered in error. + If the percentage is respected but there is at least one unhealthy replica, the health is + evaluated as Warning. + The percentage is calculated by dividing the number of unhealthy replicas over the total + number of replicas in the partition. + The computation rounds up to tolerate one failure on small numbers of replicas. + :type max_percent_unhealthy_replicas_per_partition: int + """ + + _validation = { + 'max_percent_unhealthy_services': {'required': True, 'maximum': 100, 'minimum': 0}, + 'max_percent_unhealthy_partitions_per_service': {'required': True, 'maximum': 100, 'minimum': 0}, + 'max_percent_unhealthy_replicas_per_partition': {'required': True, '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, + *, + max_percent_unhealthy_services: int, + max_percent_unhealthy_partitions_per_service: int, + max_percent_unhealthy_replicas_per_partition: int, + **kwargs + ): + super(ServiceTypeHealthPolicy, self).__init__(**kwargs) + self.max_percent_unhealthy_services = max_percent_unhealthy_services + self.max_percent_unhealthy_partitions_per_service = max_percent_unhealthy_partitions_per_service + self.max_percent_unhealthy_replicas_per_partition = max_percent_unhealthy_replicas_per_partition + + +class ServiceUpdateParameters(msrest.serialization.Model): + """Service update request. + + :param tags: A set of tags. Service update parameters. + :type tags: dict[str, str] + """ + + _attribute_map = { + 'tags': {'key': 'tags', 'type': '{str}'}, + } + + def __init__( + self, + *, + tags: Optional[Dict[str, str]] = None, + **kwargs + ): + super(ServiceUpdateParameters, self).__init__(**kwargs) + self.tags = tags + + +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, + *, + name: str, + value: str, + **kwargs + ): + super(SettingsParameterDescription, self).__init__(**kwargs) + self.name = name + self.value = 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[~service_fabric_managed_clusters_management_client.models.SettingsParameterDescription] + """ + + _validation = { + 'name': {'required': True}, + 'parameters': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'parameters': {'key': 'parameters', 'type': '[SettingsParameterDescription]'}, + } + + def __init__( + self, + *, + name: str, + parameters: List["SettingsParameterDescription"], + **kwargs + ): + super(SettingsSectionDescription, self).__init__(**kwargs) + self.name = name + self.parameters = parameters + + +class SingletonPartitionScheme(Partition): + """SingletonPartitionScheme. + + All required parameters must be populated in order to send to Azure. + + :param partition_scheme: Required. Specifies how the service is partitioned.Constant filled by + server. Possible values include: "Singleton", "UniformInt64Range", "Named". + :type partition_scheme: str or + ~service_fabric_managed_clusters_management_client.models.PartitionScheme + """ + + _validation = { + 'partition_scheme': {'required': True}, + } + + _attribute_map = { + 'partition_scheme': {'key': 'partitionScheme', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(SingletonPartitionScheme, self).__init__(**kwargs) + self.partition_scheme = 'Singleton' # type: str + + +class Sku(msrest.serialization.Model): + """Service Fabric managed cluster Sku definition. + + All required parameters must be populated in order to send to Azure. + + :param name: Required. Sku Name. Possible values include: "Basic", "Standard". + :type name: str or ~service_fabric_managed_clusters_management_client.models.SkuName + """ + + _validation = { + 'name': {'required': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + } + + def __init__( + self, + *, + name: Union[str, "SkuName"], + **kwargs + ): + super(Sku, self).__init__(**kwargs) + self.name = name + + +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[~service_fabric_managed_clusters_management_client.models.ServiceCorrelation] + :param service_load_metrics: The service load metrics is given as an array of ServiceLoadMetric + objects. + :type service_load_metrics: + list[~service_fabric_managed_clusters_management_client.models.ServiceLoadMetric] + :param service_placement_policies: A list that describes the correlation of the service with + other services. + :type service_placement_policies: + list[~service_fabric_managed_clusters_management_client.models.ServicePlacementPolicy] + :param default_move_cost: Specifies the move cost for the service. Possible values include: + "Zero", "Low", "Medium", "High". + :type default_move_cost: str or + ~service_fabric_managed_clusters_management_client.models.MoveCost + :param scaling_policies: Scaling policies for this service. + :type scaling_policies: + list[~service_fabric_managed_clusters_management_client.models.ScalingPolicy] + :ivar provisioning_state: The current deployment or provisioning state, which only appears in + the response. + :vartype provisioning_state: str + :param service_kind: Required. The kind of service (Stateless or Stateful).Constant filled by + server. Possible values include: "Stateless", "Stateful". + :type service_kind: str or + ~service_fabric_managed_clusters_management_client.models.ServiceKind + :param service_type_name: Required. The name of the service type. + :type service_type_name: str + :param partition_description: Required. Describes how the service is partitioned. + :type partition_description: + ~service_fabric_managed_clusters_management_client.models.Partition + :param service_package_activation_mode: The activation Mode of the service package. Possible + values include: "SharedProcess", "ExclusiveProcess". + :type service_package_activation_mode: str or + ~service_fabric_managed_clusters_management_client.models.ServicePackageActivationMode + :param service_dns_name: The DNS name of the service. It requires the DNS system service to be + enabled in Service Fabric cluster. + :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". + :type replica_restart_wait_duration: str + :param quorum_loss_wait_duration: The maximum duration for which a partition is allowed to be + in a state of quorum loss, represented in ISO 8601 format "hh:mm:ss". + :type quorum_loss_wait_duration: str + :param stand_by_replica_keep_duration: The definition on how long StandBy replicas should be + maintained before being removed, represented in ISO 8601 format "hh:mm:ss". + :type stand_by_replica_keep_duration: str + :param service_placement_time_limit: The duration for which replicas can stay InBuild before + reporting that build is stuck, represented in ISO 8601 format "hh:mm:ss". + :type service_placement_time_limit: str + :param drop_source_replica_on_move: Indicates whether to drop source Secondary replica even if + the target replica has not finished build. If desired behavior is to drop it as soon as + possible the value of this property is true, if not it is false. + :type drop_source_replica_on_move: bool + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'service_kind': {'required': True}, + 'service_type_name': {'required': True}, + 'partition_description': {'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': '[ServiceCorrelation]'}, + 'service_load_metrics': {'key': 'serviceLoadMetrics', 'type': '[ServiceLoadMetric]'}, + 'service_placement_policies': {'key': 'servicePlacementPolicies', 'type': '[ServicePlacementPolicy]'}, + 'default_move_cost': {'key': 'defaultMoveCost', 'type': 'str'}, + 'scaling_policies': {'key': 'scalingPolicies', 'type': '[ScalingPolicy]'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'service_kind': {'key': 'serviceKind', 'type': 'str'}, + 'service_type_name': {'key': 'serviceTypeName', 'type': 'str'}, + 'partition_description': {'key': 'partitionDescription', 'type': 'Partition'}, + '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': 'str'}, + 'quorum_loss_wait_duration': {'key': 'quorumLossWaitDuration', 'type': 'str'}, + 'stand_by_replica_keep_duration': {'key': 'standByReplicaKeepDuration', 'type': 'str'}, + 'service_placement_time_limit': {'key': 'servicePlacementTimeLimit', 'type': 'str'}, + 'drop_source_replica_on_move': {'key': 'dropSourceReplicaOnMove', 'type': 'bool'}, + } + + def __init__( + self, + *, + service_type_name: str, + partition_description: "Partition", + placement_constraints: Optional[str] = None, + correlation_scheme: Optional[List["ServiceCorrelation"]] = None, + service_load_metrics: Optional[List["ServiceLoadMetric"]] = None, + service_placement_policies: Optional[List["ServicePlacementPolicy"]] = None, + default_move_cost: Optional[Union[str, "MoveCost"]] = None, + scaling_policies: Optional[List["ScalingPolicy"]] = None, + service_package_activation_mode: Optional[Union[str, "ServicePackageActivationMode"]] = None, + service_dns_name: Optional[str] = None, + has_persisted_state: Optional[bool] = None, + target_replica_set_size: Optional[int] = None, + min_replica_set_size: Optional[int] = None, + replica_restart_wait_duration: Optional[str] = None, + quorum_loss_wait_duration: Optional[str] = None, + stand_by_replica_keep_duration: Optional[str] = None, + service_placement_time_limit: Optional[str] = None, + drop_source_replica_on_move: Optional[bool] = None, + **kwargs + ): + super(StatefulServiceProperties, self).__init__(placement_constraints=placement_constraints, correlation_scheme=correlation_scheme, service_load_metrics=service_load_metrics, service_placement_policies=service_placement_policies, default_move_cost=default_move_cost, scaling_policies=scaling_policies, service_type_name=service_type_name, partition_description=partition_description, service_package_activation_mode=service_package_activation_mode, service_dns_name=service_dns_name, **kwargs) + self.service_kind = 'Stateful' # type: str + self.has_persisted_state = has_persisted_state + self.target_replica_set_size = target_replica_set_size + self.min_replica_set_size = min_replica_set_size + self.replica_restart_wait_duration = replica_restart_wait_duration + self.quorum_loss_wait_duration = quorum_loss_wait_duration + self.stand_by_replica_keep_duration = stand_by_replica_keep_duration + self.service_placement_time_limit = service_placement_time_limit + self.drop_source_replica_on_move = drop_source_replica_on_move + + +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[~service_fabric_managed_clusters_management_client.models.ServiceCorrelation] + :param service_load_metrics: The service load metrics is given as an array of ServiceLoadMetric + objects. + :type service_load_metrics: + list[~service_fabric_managed_clusters_management_client.models.ServiceLoadMetric] + :param service_placement_policies: A list that describes the correlation of the service with + other services. + :type service_placement_policies: + list[~service_fabric_managed_clusters_management_client.models.ServicePlacementPolicy] + :param default_move_cost: Specifies the move cost for the service. Possible values include: + "Zero", "Low", "Medium", "High". + :type default_move_cost: str or + ~service_fabric_managed_clusters_management_client.models.MoveCost + :param scaling_policies: Scaling policies for this service. + :type scaling_policies: + list[~service_fabric_managed_clusters_management_client.models.ScalingPolicy] + :ivar provisioning_state: The current deployment or provisioning state, which only appears in + the response. + :vartype provisioning_state: str + :param service_kind: Required. The kind of service (Stateless or Stateful).Constant filled by + server. Possible values include: "Stateless", "Stateful". + :type service_kind: str or + ~service_fabric_managed_clusters_management_client.models.ServiceKind + :param service_type_name: Required. The name of the service type. + :type service_type_name: str + :param partition_description: Required. Describes how the service is partitioned. + :type partition_description: + ~service_fabric_managed_clusters_management_client.models.Partition + :param service_package_activation_mode: The activation Mode of the service package. Possible + values include: "SharedProcess", "ExclusiveProcess". + :type service_package_activation_mode: str or + ~service_fabric_managed_clusters_management_client.models.ServicePackageActivationMode + :param service_dns_name: The DNS name of the service. It requires the DNS system service to be + enabled in Service Fabric cluster. + :type service_dns_name: str + :param instance_count: Required. The instance count. + :type instance_count: int + :param min_instance_count: MinInstanceCount is the minimum number of instances that must be up + to meet the EnsureAvailability safety check during operations like upgrade or deactivate node. + The actual number that is used is max( MinInstanceCount, ceil( MinInstancePercentage/100.0 * + InstanceCount) ). Note, if InstanceCount is set to -1, during MinInstanceCount computation -1 + is first converted into the number of nodes on which the instances are allowed to be placed + according to the placement constraints on the service. + :type min_instance_count: int + :param min_instance_percentage: MinInstancePercentage is the minimum percentage of + InstanceCount that must be up to meet the EnsureAvailability safety check during operations + like upgrade or deactivate node. The actual number that is used is max( MinInstanceCount, ceil( + MinInstancePercentage/100.0 * InstanceCount) ). Note, if InstanceCount is set to -1, during + MinInstancePercentage computation, -1 is first converted into the number of nodes on which the + instances are allowed to be placed according to the placement constraints on the service. + :type min_instance_percentage: int + :param instance_close_delay_duration: Duration represented in ISO 8601 format "hh:mm:ss", to + wait before a stateless instance is closed, to allow the active requests to drain gracefully. + This would be effective when the instance is closing during the application/cluster upgrade and + disabling node. The endpoint exposed on this instance is removed prior to starting the delay, + which prevents new connections to this instance. In addition, clients that have subscribed to + service endpoint change + events(https://docs.microsoft.com/dotnet/api/system.fabric.fabricclient.servicemanagementclient.registerservicenotificationfilterasync), + can do the following upon receiving the endpoint removal notification: - Stop sending new + requests to this instance. - Close existing connections after in-flight requests have + completed. - Connect to a different instance of the service partition for future requests. + Note, the default value of InstanceCloseDelayDuration is 0, which indicates that there won't be + any delay or removal of the endpoint prior to closing the instance. + :type instance_close_delay_duration: str + """ + + _validation = { + 'provisioning_state': {'readonly': True}, + 'service_kind': {'required': True}, + 'service_type_name': {'required': True}, + 'partition_description': {'required': True}, + 'instance_count': {'required': True, 'minimum': -1}, + } + + _attribute_map = { + 'placement_constraints': {'key': 'placementConstraints', 'type': 'str'}, + 'correlation_scheme': {'key': 'correlationScheme', 'type': '[ServiceCorrelation]'}, + 'service_load_metrics': {'key': 'serviceLoadMetrics', 'type': '[ServiceLoadMetric]'}, + 'service_placement_policies': {'key': 'servicePlacementPolicies', 'type': '[ServicePlacementPolicy]'}, + 'default_move_cost': {'key': 'defaultMoveCost', 'type': 'str'}, + 'scaling_policies': {'key': 'scalingPolicies', 'type': '[ScalingPolicy]'}, + 'provisioning_state': {'key': 'provisioningState', 'type': 'str'}, + 'service_kind': {'key': 'serviceKind', 'type': 'str'}, + 'service_type_name': {'key': 'serviceTypeName', 'type': 'str'}, + 'partition_description': {'key': 'partitionDescription', 'type': 'Partition'}, + 'service_package_activation_mode': {'key': 'servicePackageActivationMode', 'type': 'str'}, + 'service_dns_name': {'key': 'serviceDnsName', 'type': 'str'}, + 'instance_count': {'key': 'instanceCount', 'type': 'int'}, + 'min_instance_count': {'key': 'minInstanceCount', 'type': 'int'}, + 'min_instance_percentage': {'key': 'minInstancePercentage', 'type': 'int'}, + 'instance_close_delay_duration': {'key': 'instanceCloseDelayDuration', 'type': 'str'}, + } + + def __init__( + self, + *, + service_type_name: str, + partition_description: "Partition", + instance_count: int, + placement_constraints: Optional[str] = None, + correlation_scheme: Optional[List["ServiceCorrelation"]] = None, + service_load_metrics: Optional[List["ServiceLoadMetric"]] = None, + service_placement_policies: Optional[List["ServicePlacementPolicy"]] = None, + default_move_cost: Optional[Union[str, "MoveCost"]] = None, + scaling_policies: Optional[List["ScalingPolicy"]] = None, + service_package_activation_mode: Optional[Union[str, "ServicePackageActivationMode"]] = None, + service_dns_name: Optional[str] = None, + min_instance_count: Optional[int] = None, + min_instance_percentage: Optional[int] = None, + instance_close_delay_duration: Optional[str] = "0", + **kwargs + ): + super(StatelessServiceProperties, self).__init__(placement_constraints=placement_constraints, correlation_scheme=correlation_scheme, service_load_metrics=service_load_metrics, service_placement_policies=service_placement_policies, default_move_cost=default_move_cost, scaling_policies=scaling_policies, service_type_name=service_type_name, partition_description=partition_description, service_package_activation_mode=service_package_activation_mode, service_dns_name=service_dns_name, **kwargs) + self.service_kind = 'Stateless' # type: str + self.instance_count = instance_count + self.min_instance_count = min_instance_count + self.min_instance_percentage = min_instance_percentage + self.instance_close_delay_duration = instance_close_delay_duration + + +class SubResource(msrest.serialization.Model): + """Azure resource identifier. + + :param id: Azure resource identifier. + :type id: str + """ + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + *, + id: Optional[str] = None, + **kwargs + ): + super(SubResource, self).__init__(**kwargs) + self.id = id + + +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, + *, + created_by: Optional[str] = None, + created_by_type: Optional[str] = None, + created_at: Optional[datetime.datetime] = None, + last_modified_by: Optional[str] = None, + last_modified_by_type: Optional[str] = None, + last_modified_at: Optional[datetime.datetime] = None, + **kwargs + ): + super(SystemData, self).__init__(**kwargs) + self.created_by = created_by + self.created_by_type = created_by_type + self.created_at = created_at + self.last_modified_by = last_modified_by + self.last_modified_by_type = last_modified_by_type + self.last_modified_at = last_modified_at + + +class UniformInt64RangePartitionScheme(Partition): + """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: "Singleton", "UniformInt64Range", "Named". + :type partition_scheme: str or + ~service_fabric_managed_clusters_management_client.models.PartitionScheme + :param count: Required. The number of partitions. + :type count: int + :param low_key: Required. The lower bound of the partition key range that + should be split between the partition ‘Count’. + :type low_key: long + :param high_key: Required. The upper bound of the partition key range that + should be split between the partition ‘Count’. + :type high_key: long + """ + + _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': 'long'}, + 'high_key': {'key': 'highKey', 'type': 'long'}, + } + + def __init__( + self, + *, + count: int, + low_key: int, + high_key: int, + **kwargs + ): + super(UniformInt64RangePartitionScheme, self).__init__(**kwargs) + self.partition_scheme = 'UniformInt64Range' # type: str + self.count = count + self.low_key = low_key + self.high_key = high_key + + +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 + + +class VaultCertificate(msrest.serialization.Model): + """Describes a single certificate reference in a Key Vault, and where the certificate should reside on the VM. + + All required parameters must be populated in order to send to Azure. + + :param certificate_url: Required. This is the URL of a certificate that has been uploaded to + Key Vault as a secret. For adding a secret to the Key Vault, see `Add a key or secret to the + key vault `_. In this + case, your certificate needs to be It is the Base64 encoding of the following JSON Object which + is encoded in UTF-8: :code:`
`:code:`
` {:code:`
` "data":":code:``",:code:`
` "dataType":"pfx",:code:`
` "password":":code:``":code:`
`}. + :type certificate_url: str + :param certificate_store: Required. For Windows VMs, specifies the certificate store on the + Virtual Machine to which the certificate should be added. The specified certificate store is + implicitly in the LocalMachine account. :code:`
`:code:`
`For Linux VMs, the certificate + file is placed under the /var/lib/waagent directory, with the file name + :code:``.crt for the X509 certificate file and + :code:``.prv for private key. Both of these files are .pem formatted. + :type certificate_store: str + """ + + _validation = { + 'certificate_url': {'required': True}, + 'certificate_store': {'required': True}, + } + + _attribute_map = { + 'certificate_url': {'key': 'certificateUrl', 'type': 'str'}, + 'certificate_store': {'key': 'certificateStore', 'type': 'str'}, + } + + def __init__( + self, + *, + certificate_url: str, + certificate_store: str, + **kwargs + ): + super(VaultCertificate, self).__init__(**kwargs) + self.certificate_url = certificate_url + self.certificate_store = certificate_store + + +class VaultSecretGroup(msrest.serialization.Model): + """Specifies set of certificates that should be installed onto the virtual machines. + + All required parameters must be populated in order to send to Azure. + + :param source_vault: Required. The relative URL of the Key Vault containing all of the + certificates in VaultCertificates. + :type source_vault: ~service_fabric_managed_clusters_management_client.models.SubResource + :param vault_certificates: Required. The list of key vault references in SourceVault which + contain certificates. + :type vault_certificates: + list[~service_fabric_managed_clusters_management_client.models.VaultCertificate] + """ + + _validation = { + 'source_vault': {'required': True}, + 'vault_certificates': {'required': True}, + } + + _attribute_map = { + 'source_vault': {'key': 'sourceVault', 'type': 'SubResource'}, + 'vault_certificates': {'key': 'vaultCertificates', 'type': '[VaultCertificate]'}, + } + + def __init__( + self, + *, + source_vault: "SubResource", + vault_certificates: List["VaultCertificate"], + **kwargs + ): + super(VaultSecretGroup, self).__init__(**kwargs) + self.source_vault = source_vault + self.vault_certificates = vault_certificates + + +class VmManagedIdentity(msrest.serialization.Model): + """Identities for the virtual machine scale set under the node type. + + :param user_assigned_identities: The list of user identities associated with the virtual + machine scale set under the node type. Each entry will be an ARM resource ids in the form: + '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}'. + :type user_assigned_identities: list[str] + """ + + _attribute_map = { + 'user_assigned_identities': {'key': 'userAssignedIdentities', 'type': '[str]'}, + } + + def __init__( + self, + *, + user_assigned_identities: Optional[List[str]] = None, + **kwargs + ): + super(VmManagedIdentity, self).__init__(**kwargs) + self.user_assigned_identities = user_assigned_identities + + +class VMSSExtension(msrest.serialization.Model): + """Specifies set of extensions that should be installed onto the virtual machines. + + 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 name: Required. The name of the extension. + :type name: str + :param publisher: Required. The name of the extension handler publisher. + :type publisher: str + :param type: Required. Specifies the type of the extension; an example is + "CustomScriptExtension". + :type type: str + :param type_handler_version: Required. Specifies the version of the script handler. + :type type_handler_version: str + :param auto_upgrade_minor_version: Indicates whether the extension should use a newer minor + version if one is available at deployment time. Once deployed, however, the extension will not + upgrade minor versions unless redeployed, even with this property set to true. + :type auto_upgrade_minor_version: bool + :param settings: Json formatted public settings for the extension. + :type settings: object + :param protected_settings: The extension can contain either protectedSettings or + protectedSettingsFromKeyVault or no protected settings at all. + :type protected_settings: object + :param force_update_tag: If a value is provided and is different from the previous value, the + extension handler will be forced to update even if the extension configuration has not changed. + :type force_update_tag: str + :param provision_after_extensions: Collection of extension names after which this extension + needs to be provisioned. + :type provision_after_extensions: list[str] + :ivar provisioning_state: The provisioning state, which only appears in the response. + :vartype provisioning_state: str + """ + + _validation = { + 'name': {'required': True}, + 'publisher': {'required': True}, + 'type': {'required': True}, + 'type_handler_version': {'required': True}, + 'provisioning_state': {'readonly': True}, + } + + _attribute_map = { + 'name': {'key': 'name', 'type': 'str'}, + 'publisher': {'key': 'properties.publisher', 'type': 'str'}, + 'type': {'key': 'properties.type', 'type': 'str'}, + 'type_handler_version': {'key': 'properties.typeHandlerVersion', 'type': 'str'}, + 'auto_upgrade_minor_version': {'key': 'properties.autoUpgradeMinorVersion', 'type': 'bool'}, + 'settings': {'key': 'properties.settings', 'type': 'object'}, + 'protected_settings': {'key': 'properties.protectedSettings', 'type': 'object'}, + 'force_update_tag': {'key': 'properties.forceUpdateTag', 'type': 'str'}, + 'provision_after_extensions': {'key': 'properties.provisionAfterExtensions', 'type': '[str]'}, + 'provisioning_state': {'key': 'properties.provisioningState', 'type': 'str'}, + } + + def __init__( + self, + *, + name: str, + publisher: str, + type: str, + type_handler_version: str, + auto_upgrade_minor_version: Optional[bool] = None, + settings: Optional[object] = None, + protected_settings: Optional[object] = None, + force_update_tag: Optional[str] = None, + provision_after_extensions: Optional[List[str]] = None, + **kwargs + ): + super(VMSSExtension, self).__init__(**kwargs) + self.name = name + self.publisher = publisher + self.type = type + self.type_handler_version = type_handler_version + self.auto_upgrade_minor_version = auto_upgrade_minor_version + self.settings = settings + self.protected_settings = protected_settings + self.force_update_tag = force_update_tag + self.provision_after_extensions = provision_after_extensions + self.provisioning_state = None diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/models/_service_fabric_managed_clusters_management_client_enums.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/models/_service_fabric_managed_clusters_management_client_enums.py new file mode 100644 index 000000000000..8bd1bd636f51 --- /dev/null +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/models/_service_fabric_managed_clusters_management_client_enums.py @@ -0,0 +1,231 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- + +from enum import Enum, 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 Access(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The network traffic is allowed or denied. + """ + + ALLOW = "allow" + DENY = "deny" + +class ClusterState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """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. + * Upgrading - Indicates that the cluster is being upgraded with the user provided + configuration. + * UpgradeFailed - Indicates that the last upgrade for the cluster has failed. + * Ready - Indicates that the cluster is in a stable state. + """ + + WAITING_FOR_NODES = "WaitingForNodes" + DEPLOYING = "Deploying" + BASELINE_UPGRADE = "BaselineUpgrade" + UPGRADING = "Upgrading" + UPGRADE_FAILED = "UpgradeFailed" + READY = "Ready" + +class ClusterUpgradeCadence(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Indicates when new cluster runtime version upgrades will be applied after they are released. By + default is Wave0. + """ + + WAVE0 = "Wave0" #: Cluster upgrade starts immediately after a new version is rolled out. Recommended for Test/Dev clusters. + WAVE1 = "Wave1" #: Cluster upgrade starts 7 days after a new version is rolled out. Recommended for Pre-prod clusters. + WAVE2 = "Wave2" #: Cluster upgrade starts 14 days after a new version is rolled out. Recommended for Production clusters. + +class Direction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Network security rule direction. + """ + + INBOUND = "inbound" + OUTBOUND = "outbound" + +class FailureAction(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The compensating action to perform when a Monitored upgrade encounters monitoring policy or + health policy violations. Invalid indicates the failure action is invalid. Rollback specifies + that the upgrade will start rolling back automatically. Manual indicates that the upgrade will + switch to UnmonitoredManual upgrade mode. + """ + + ROLLBACK = "Rollback" #: Indicates that a rollback of the upgrade will be performed by Service Fabric if the upgrade fails. + MANUAL = "Manual" #: Indicates that a manual repair will need to be performed by the administrator if the upgrade fails. Service Fabric will not proceed to the next upgrade domain automatically. + +class ManagedClusterAddOnFeature(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Available cluster add-on features + """ + + DNS_SERVICE = "DnsService" + BACKUP_RESTORE_SERVICE = "BackupRestoreService" + RESOURCE_MONITOR_SERVICE = "ResourceMonitorService" + +class ManagedIdentityType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of managed identity for the resource. + """ + + NONE = "None" #: Indicates that no identity is associated with the resource. + SYSTEM_ASSIGNED = "SystemAssigned" #: Indicates that system assigned identity is associated with the resource. + USER_ASSIGNED = "UserAssigned" #: Indicates that user assigned identity is associated with the resource. + SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned, UserAssigned" #: Indicates that both system assigned and user assigned identity are associated with the resource. + +class ManagedResourceProvisioningState(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The provisioning state of the managed resource. + """ + + NONE = "None" + CREATING = "Creating" + CREATED = "Created" + UPDATING = "Updating" + SUCCEEDED = "Succeeded" + FAILED = "Failed" + CANCELED = "Canceled" + DELETING = "Deleting" + DELETED = "Deleted" + OTHER = "Other" + +class MoveCost(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Specifies the move cost for the service. + """ + + ZERO = "Zero" #: Zero move cost. This value is zero. + LOW = "Low" #: Specifies the move cost of the service as Low. The value is 1. + MEDIUM = "Medium" #: Specifies the move cost of the service as Medium. The value is 2. + HIGH = "High" #: Specifies the move cost of the service as High. The value is 3. + +class NsgProtocol(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Network protocol this rule applies to. + """ + + HTTP = "http" + HTTPS = "https" + TCP = "tcp" + UDP = "udp" + ICMP = "icmp" + AH = "ah" + ESP = "esp" + +class PartitionScheme(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Enumerates the ways that a service can be partitioned. + """ + + SINGLETON = "Singleton" #: Indicates that the partition is based on string names, and is a SingletonPartitionScheme object, The value is 0. + UNIFORM_INT64_RANGE = "UniformInt64Range" #: Indicates that the partition is based on Int64 key ranges, and is a UniformInt64RangePartitionScheme object. The value is 1. + NAMED = "Named" #: Indicates that the partition is based on string names, and is a NamedPartitionScheme object. The value is 2. + +class ProbeProtocol(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """the reference to the load balancer probe used by the load balancing rule. + """ + + TCP = "tcp" + HTTP = "http" + HTTPS = "https" + +class Protocol(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The reference to the transport protocol used by the load balancing rule. + """ + + TCP = "tcp" + UDP = "udp" + +class RollingUpgradeMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The mode used to monitor health during a rolling upgrade. The values are Monitored, and + UnmonitoredAuto. + """ + + MONITORED = "Monitored" #: The upgrade will stop after completing each upgrade domain and automatically monitor health before proceeding. The value is 0. + UNMONITORED_AUTO = "UnmonitoredAuto" #: The upgrade will proceed automatically without performing any health monitoring. The value is 1. + +class ServiceCorrelationScheme(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The service correlation scheme. + """ + + ALIGNED_AFFINITY = "AlignedAffinity" #: Aligned affinity ensures that the primaries of the partitions of the affinitized services are collocated on the same nodes. This is the default and is the same as selecting the Affinity scheme. The value is 0. + NON_ALIGNED_AFFINITY = "NonAlignedAffinity" #: Non-Aligned affinity guarantees that all replicas of each service will be placed on the same nodes. Unlike Aligned Affinity, this does not guarantee that replicas of particular role will be collocated. The value is 1. + +class ServiceKind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The kind of service (Stateless or Stateful). + """ + + STATELESS = "Stateless" #: Does not use Service Fabric to make its state highly available or reliable. The value is 0. + STATEFUL = "Stateful" #: Uses Service Fabric to make its state or part of its state highly available and reliable. The value is 1. + +class ServiceLoadMetricWeight(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Determines the metric weight relative to the other metrics that are configured for this + service. During runtime, if two metrics end up in conflict, the Cluster Resource Manager + prefers the metric with the higher weight. + """ + + ZERO = "Zero" #: Disables resource balancing for this metric. This value is zero. + LOW = "Low" #: Specifies the metric weight of the service load as Low. The value is 1. + MEDIUM = "Medium" #: Specifies the metric weight of the service load as Medium. The value is 2. + HIGH = "High" #: Specifies the metric weight of the service load as High. The value is 3. + +class ServicePackageActivationMode(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The activation Mode of the service package + """ + + SHARED_PROCESS = "SharedProcess" #: Indicates the application package activation mode will use shared process. + EXCLUSIVE_PROCESS = "ExclusiveProcess" #: Indicates the application package activation mode will use exclusive process. + +class ServicePlacementPolicyType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The type of placement policy for a service fabric service. Following are the possible values. + """ + + INVALID_DOMAIN = "InvalidDomain" #: Indicates that the ServicePlacementPolicyDescription is of type ServicePlacementInvalidDomainPolicyDescription, which indicates that a particular fault or upgrade domain cannot be used for placement of this service. The value is 0. + REQUIRED_DOMAIN = "RequiredDomain" #: Indicates that the ServicePlacementPolicyDescription is of type ServicePlacementRequireDomainDistributionPolicyDescription indicating that the replicas of the service must be placed in a specific domain. The value is 1. + PREFERRED_PRIMARY_DOMAIN = "PreferredPrimaryDomain" #: Indicates that the ServicePlacementPolicyDescription is of type ServicePlacementPreferPrimaryDomainPolicyDescription, which indicates that if possible the Primary replica for the partitions of the service should be located in a particular domain as an optimization. The value is 2. + REQUIRED_DOMAIN_DISTRIBUTION = "RequiredDomainDistribution" #: Indicates that the ServicePlacementPolicyDescription is of type ServicePlacementRequireDomainDistributionPolicyDescription, indicating that the system will disallow placement of any two replicas from the same partition in the same domain at any time. The value is 3. + NON_PARTIALLY_PLACE_SERVICE = "NonPartiallyPlaceService" #: Indicates that the ServicePlacementPolicyDescription is of type ServicePlacementNonPartiallyPlaceServicePolicyDescription, which indicates that if possible all replicas of a particular partition of the service should be placed atomically. The value is 4. + +class ServiceScalingMechanismKind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Enumerates the ways that a service can be partitioned. + """ + + SCALE_PARTITION_INSTANCE_COUNT = "ScalePartitionInstanceCount" #: Represents a scaling mechanism for adding or removing instances of stateless service partition. The value is 0. + ADD_REMOVE_INCREMENTAL_NAMED_PARTITION = "AddRemoveIncrementalNamedPartition" #: Represents a scaling mechanism for adding or removing named partitions of a stateless service. The value is 1. + +class ServiceScalingTriggerKind(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Enumerates the ways that a service can be partitioned. + """ + + AVERAGE_PARTITION_LOAD = "AveragePartitionLoad" #: Represents a scaling trigger related to an average load of a metric/resource of a partition. The value is 0. + AVERAGE_SERVICE_LOAD = "AverageServiceLoad" #: Represents a scaling policy related to an average load of a metric/resource of a service. The value is 1. + +class SkuName(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """Sku Name. Basic requires a minimum of 3 nodes and Standard a minimum of 5. Basic only allows 1 + node type. + """ + + BASIC = "Basic" + STANDARD = "Standard" diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/__init__.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/__init__.py new file mode 100644 index 000000000000..613aba52b2a2 --- /dev/null +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/__init__.py @@ -0,0 +1,25 @@ +# 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 ._application_types_operations import ApplicationTypesOperations +from ._application_type_versions_operations import ApplicationTypeVersionsOperations +from ._applications_operations import ApplicationsOperations +from ._services_operations import ServicesOperations +from ._managed_clusters_operations import ManagedClustersOperations +from ._operations import Operations +from ._node_types_operations import NodeTypesOperations + +__all__ = [ + 'ApplicationTypesOperations', + 'ApplicationTypeVersionsOperations', + 'ApplicationsOperations', + 'ServicesOperations', + 'ManagedClustersOperations', + 'Operations', + 'NodeTypesOperations', +] diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_application_type_versions_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_application_type_versions_operations.py new file mode 100644 index 000000000000..a60f4cea26a9 --- /dev/null +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_application_type_versions_operations.py @@ -0,0 +1,555 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +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: ~service_fabric_managed_clusters_management_client.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + 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" + """Gets a Service Fabric managed application type version resource. + + Get a Service Fabric managed application type version resource created or in the process of + being created in the Service Fabric managed application type name resource. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. + :type cluster_name: str + :param application_type_name: The name of the application type name resource. + :type application_type_name: str + :param version: The application type version. + :type version: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ApplicationTypeVersionResource, or the result of cls(response) + :rtype: ~service_fabric_managed_clusters_management_client.models.ApplicationTypeVersionResource + :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-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'applicationTypeName': self._serialize.url("application_type_name", application_type_name, 'str'), + 'version': self._serialize.url("version", version, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorModel, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ApplicationTypeVersionResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applicationTypes/{applicationTypeName}/versions/{version}'} # type: ignore + + def _create_or_update_initial( + self, + resource_group_name, # type: str + cluster_name, # type: str + application_type_name, # type: str + version, # type: str + parameters, # type: "_models.ApplicationTypeVersionResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.ApplicationTypeVersionResource" + 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-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + '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) + 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(_models.ErrorModel, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ApplicationTypeVersionResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('ApplicationTypeVersionResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applicationTypes/{applicationTypeName}/versions/{version}'} # type: ignore + + 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"] + """Creates or updates a Service Fabric managed application type version resource. + + Create or update a Service Fabric managed application type version resource with the specified + name. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. + :type cluster_name: str + :param application_type_name: The name of the application type name resource. + :type application_type_name: str + :param version: The application type version. + :type version: str + :param parameters: The application type version resource. + :type parameters: ~service_fabric_managed_clusters_management_client.models.ApplicationTypeVersionResource + :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: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either ApplicationTypeVersionResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~service_fabric_managed_clusters_management_client.models.ApplicationTypeVersionResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + 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( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_type_name=application_type_name, + version=version, + parameters=parameters, + cls=lambda x,y,z: x, + **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, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applicationTypes/{applicationTypeName}/versions/{version}'} # type: ignore + + def update( + self, + resource_group_name, # type: str + cluster_name, # type: str + application_type_name, # type: str + version, # type: str + parameters, # type: "_models.ApplicationTypeVersionUpdateParameters" + **kwargs # type: Any + ): + # type: (...) -> "_models.ApplicationTypeVersionResource" + """Updates the tags of an application type version resource of a given managed cluster. + + Updates the tags of an application type version resource of a given managed cluster. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. + :type cluster_name: str + :param application_type_name: The name of the application type name resource. + :type application_type_name: str + :param version: The application type version. + :type version: str + :param parameters: The application type version resource updated tags. + :type parameters: ~service_fabric_managed_clusters_management_client.models.ApplicationTypeVersionUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ApplicationTypeVersionResource, or the result of cls(response) + :rtype: ~service_fabric_managed_clusters_management_client.models.ApplicationTypeVersionResource + :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-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'applicationTypeName': self._serialize.url("application_type_name", application_type_name, 'str'), + 'version': self._serialize.url("version", version, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # 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, 'ApplicationTypeVersionUpdateParameters') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorModel, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ApplicationTypeVersionResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applicationTypes/{applicationTypeName}/versions/{version}'} # type: ignore + + def _delete_initial( + self, + resource_group_name, # type: str + cluster_name, # type: str + application_type_name, # type: str + version, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + 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-01-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'applicationTypeName': self._serialize.url("application_type_name", application_type_name, 'str'), + 'version': self._serialize.url("version", version, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorModel, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applicationTypes/{applicationTypeName}/versions/{version}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + cluster_name, # type: str + application_type_name, # type: str + version, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes a Service Fabric managed application type version resource. + + Delete a Service Fabric managed application type version resource with the specified name. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. + :type cluster_name: str + :param application_type_name: The name of the application type name resource. + :type application_type_name: str + :param version: The application type version. + :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: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_type_name=application_type_name, + version=version, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'applicationTypeName': self._serialize.url("application_type_name", application_type_name, 'str'), + 'version': self._serialize.url("version", version, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applicationTypes/{applicationTypeName}/versions/{version}'} # type: ignore + + def list_by_application_types( + self, + resource_group_name, # type: str + cluster_name, # type: str + application_type_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ApplicationTypeVersionResourceList"] + """Gets the list of application type version resources created in the specified Service Fabric managed application type name resource. + + Gets all application type version resources created or in the process of being created in the + Service Fabric managed application type name resource. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. + :type cluster_name: str + :param application_type_name: The name of the application type name resource. + :type application_type_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ApplicationTypeVersionResourceList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~service_fabric_managed_clusters_management_client.models.ApplicationTypeVersionResourceList] + :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-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_application_types.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'applicationTypeName': self._serialize.url("application_type_name", application_type_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('ApplicationTypeVersionResourceList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(_models.ErrorModel, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_application_types.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applicationTypes/{applicationTypeName}/versions'} # type: ignore diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_application_types_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_application_types_operations.py new file mode 100644 index 000000000000..a1eee71c848f --- /dev/null +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_application_types_operations.py @@ -0,0 +1,463 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +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: ~service_fabric_managed_clusters_management_client.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def get( + self, + resource_group_name, # type: str + cluster_name, # type: str + application_type_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.ApplicationTypeResource" + """Gets a Service Fabric managed application type name resource. + + Get a Service Fabric application type name resource created or in the process of being created + in the Service Fabric managed cluster resource. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. + :type cluster_name: str + :param application_type_name: The name of the application type name resource. + :type application_type_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ApplicationTypeResource, or the result of cls(response) + :rtype: ~service_fabric_managed_clusters_management_client.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-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'applicationTypeName': self._serialize.url("application_type_name", application_type_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorModel, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ApplicationTypeResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applicationTypes/{applicationTypeName}'} # type: ignore + + 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" + """Creates or updates a Service Fabric managed application type name resource. + + Create or update a Service Fabric managed application type name resource with the specified + name. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. + :type cluster_name: str + :param application_type_name: The name of the application type name resource. + :type application_type_name: str + :param parameters: The application type name resource. + :type parameters: ~service_fabric_managed_clusters_management_client.models.ApplicationTypeResource + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ApplicationTypeResource, or the result of cls(response) + :rtype: ~service_fabric_managed_clusters_management_client.models.ApplicationTypeResource + :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-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.create_or_update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + '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) + 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(_models.ErrorModel, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ApplicationTypeResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applicationTypes/{applicationTypeName}'} # type: ignore + + def update( + self, + resource_group_name, # type: str + cluster_name, # type: str + application_type_name, # type: str + parameters, # type: "_models.ApplicationTypeUpdateParameters" + **kwargs # type: Any + ): + # type: (...) -> "_models.ApplicationTypeResource" + """Updates the tags of an application type resource of a given managed cluster. + + Updates the tags of an application type resource of a given managed cluster. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. + :type cluster_name: str + :param application_type_name: The name of the application type name resource. + :type application_type_name: str + :param parameters: The application type resource updated tags. + :type parameters: ~service_fabric_managed_clusters_management_client.models.ApplicationTypeUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ApplicationTypeResource, or the result of cls(response) + :rtype: ~service_fabric_managed_clusters_management_client.models.ApplicationTypeResource + :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-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'applicationTypeName': self._serialize.url("application_type_name", application_type_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # 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, 'ApplicationTypeUpdateParameters') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorModel, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ApplicationTypeResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applicationTypes/{applicationTypeName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name, # type: str + cluster_name, # type: str + application_type_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + 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-01-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'applicationTypeName': self._serialize.url("application_type_name", application_type_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorModel, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applicationTypes/{applicationTypeName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + cluster_name, # type: str + application_type_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes a Service Fabric managed application type name resource. + + Delete a Service Fabric managed application type name resource with the specified name. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. + :type cluster_name: str + :param application_type_name: The name of the application type name resource. + :type application_type_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_type_name=application_type_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'applicationTypeName': self._serialize.url("application_type_name", application_type_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applicationTypes/{applicationTypeName}'} # type: ignore + + def list( + self, + resource_group_name, # type: str + cluster_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ApplicationTypeResourceList"] + """Gets the list of application type name resources created in the specified Service Fabric managed cluster resource. + + Gets all application type name resources created or in the process of being created in the + Service Fabric managed cluster resource. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. + :type cluster_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ApplicationTypeResourceList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~service_fabric_managed_clusters_management_client.models.ApplicationTypeResourceList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationTypeResourceList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('ApplicationTypeResourceList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(_models.ErrorModel, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applicationTypes'} # type: ignore diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_applications_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_applications_operations.py new file mode 100644 index 000000000000..24d271323265 --- /dev/null +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_applications_operations.py @@ -0,0 +1,528 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +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: ~service_fabric_managed_clusters_management_client.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def get( + self, + resource_group_name, # type: str + cluster_name, # type: str + application_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.ApplicationResource" + """Gets a Service Fabric managed application resource. + + Get a Service Fabric managed application resource created or in the process of being created in + the Service Fabric cluster resource. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. + :type cluster_name: str + :param application_name: The name of the application resource. + :type application_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ApplicationResource, or the result of cls(response) + :rtype: ~service_fabric_managed_clusters_management_client.models.ApplicationResource + :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-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'applicationName': self._serialize.url("application_name", application_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorModel, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ApplicationResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applications/{applicationName}'} # type: ignore + + def _create_or_update_initial( + self, + resource_group_name, # type: str + cluster_name, # type: str + application_name, # type: str + parameters, # type: "_models.ApplicationResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.ApplicationResource" + 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-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + '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) + 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(_models.ErrorModel, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ApplicationResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('ApplicationResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applications/{applicationName}'} # type: ignore + + 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"] + """Creates or updates a Service Fabric managed application resource. + + Create or update a Service Fabric managed application resource with the specified name. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. + :type cluster_name: str + :param application_name: The name of the application resource. + :type application_name: str + :param parameters: The application resource. + :type parameters: ~service_fabric_managed_clusters_management_client.models.ApplicationResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either ApplicationResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~service_fabric_managed_clusters_management_client.models.ApplicationResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + 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( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_name=application_name, + parameters=parameters, + cls=lambda x,y,z: x, + **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, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applications/{applicationName}'} # type: ignore + + def update( + self, + resource_group_name, # type: str + cluster_name, # type: str + application_name, # type: str + parameters, # type: "_models.ApplicationUpdateParameters" + **kwargs # type: Any + ): + # type: (...) -> "_models.ApplicationResource" + """Updates the tags of an application resource of a given managed cluster. + + Updates the tags of an application resource of a given managed cluster. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. + :type cluster_name: str + :param application_name: The name of the application resource. + :type application_name: str + :param parameters: The application resource updated tags. + :type parameters: ~service_fabric_managed_clusters_management_client.models.ApplicationUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ApplicationResource, or the result of cls(response) + :rtype: ~service_fabric_managed_clusters_management_client.models.ApplicationResource + :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-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'applicationName': self._serialize.url("application_name", application_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # 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, 'ApplicationUpdateParameters') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorModel, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ApplicationResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applications/{applicationName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name, # type: str + cluster_name, # type: str + application_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + 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-01-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'applicationName': self._serialize.url("application_name", application_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorModel, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applications/{applicationName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + cluster_name, # type: str + application_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes a Service Fabric managed application resource. + + Delete a Service Fabric managed application resource with the specified name. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. + :type cluster_name: str + :param application_name: The name of the application resource. + :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: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_name=application_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'applicationName': self._serialize.url("application_name", application_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applications/{applicationName}'} # type: ignore + + def list( + self, + resource_group_name, # type: str + cluster_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ApplicationResourceList"] + """Gets the list of managed application resources created in the specified Service Fabric cluster resource. + + Gets all managed application resources created or in the process of being created in the + Service Fabric cluster resource. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. + :type cluster_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ApplicationResourceList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~service_fabric_managed_clusters_management_client.models.ApplicationResourceList] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ApplicationResourceList"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('ApplicationResourceList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(_models.ErrorModel, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applications'} # type: ignore diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_managed_clusters_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_managed_clusters_operations.py new file mode 100644 index 000000000000..ce0d8144dd45 --- /dev/null +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_managed_clusters_operations.py @@ -0,0 +1,573 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class ManagedClustersOperations(object): + """ManagedClustersOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~service_fabric_managed_clusters_management_client.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_by_resource_group( + self, + resource_group_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ManagedClusterListResult"] + """Gets the list of Service Fabric cluster resources created in the specified resource group. + + Gets all Service Fabric cluster resources created or in the process of being created in the + resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ManagedClusterListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~service_fabric_managed_clusters_management_client.models.ManagedClusterListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_resource_group.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('ManagedClusterListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(_models.ErrorModel, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters'} # type: ignore + + def list_by_subscription( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ManagedClusterListResult"] + """Gets the list of Service Fabric cluster resources created in the specified subscription. + + Gets all Service Fabric cluster resources created or in the process of being created in the + subscription. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ManagedClusterListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~service_fabric_managed_clusters_management_client.models.ManagedClusterListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedClusterListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_subscription.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('ManagedClusterListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(_models.ErrorModel, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.ServiceFabric/managedClusters'} # type: ignore + + def get( + self, + resource_group_name, # type: str + cluster_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.ManagedCluster" + """Gets a Service Fabric managed cluster resource. + + Get a Service Fabric managed cluster resource created or in the process of being created in the + specified resource group. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. + :type cluster_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedCluster, or the result of cls(response) + :rtype: ~service_fabric_managed_clusters_management_client.models.ManagedCluster + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorModel, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ManagedCluster', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}'} # type: ignore + + def _create_or_update_initial( + self, + resource_group_name, # type: str + cluster_name, # type: str + parameters, # type: "_models.ManagedCluster" + **kwargs # type: Any + ): + # type: (...) -> "_models.ManagedCluster" + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + '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, 'ManagedCluster') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorModel, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ManagedCluster', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('ManagedCluster', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}'} # type: ignore + + def begin_create_or_update( + self, + resource_group_name, # type: str + cluster_name, # type: str + parameters, # type: "_models.ManagedCluster" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.ManagedCluster"] + """Creates or updates a Service Fabric managed cluster resource. + + Create or update a Service Fabric managed cluster resource with the specified name. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. + :type cluster_name: str + :param parameters: The cluster resource. + :type parameters: ~service_fabric_managed_clusters_management_client.models.ManagedCluster + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either ManagedCluster or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~service_fabric_managed_clusters_management_client.models.ManagedCluster] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('ManagedCluster', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}'} # type: ignore + + def update( + self, + resource_group_name, # type: str + cluster_name, # type: str + parameters, # type: "_models.ManagedClusterUpdateParameters" + **kwargs # type: Any + ): + # type: (...) -> "_models.ManagedCluster" + """Updates the tags of of a Service Fabric managed cluster resource. + + Update the tags of of a Service Fabric managed cluster resource with the specified name. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. + :type cluster_name: str + :param parameters: The managed cluster resource updated tags. + :type parameters: ~service_fabric_managed_clusters_management_client.models.ManagedClusterUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ManagedCluster, or the result of cls(response) + :rtype: ~service_fabric_managed_clusters_management_client.models.ManagedCluster + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.ManagedCluster"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # 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, 'ManagedClusterUpdateParameters') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorModel, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ManagedCluster', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name, # type: str + cluster_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + 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-01-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorModel, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + cluster_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes a Service Fabric managed cluster resource. + + Delete a Service Fabric managed cluster resource with the specified name. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. + :type cluster_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}'} # type: ignore diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_node_types_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_node_types_operations.py new file mode 100644 index 000000000000..51886c1585c3 --- /dev/null +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_node_types_operations.py @@ -0,0 +1,919 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class NodeTypesOperations(object): + """NodeTypesOperations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~service_fabric_managed_clusters_management_client.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list_by_managed_clusters( + self, + resource_group_name, # type: str + cluster_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.NodeTypeListResult"] + """Gets the list of Node types of the specified managed cluster. + + Gets all Node types of the specified managed cluster. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. + :type cluster_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either NodeTypeListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~service_fabric_managed_clusters_management_client.models.NodeTypeListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NodeTypeListResult"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_managed_clusters.metadata['url'] # type: ignore + path_format_arguments = { + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('NodeTypeListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(_models.ErrorModel, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_managed_clusters.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/nodeTypes'} # type: ignore + + def _restart_initial( + self, + resource_group_name, # type: str + cluster_name, # type: str + node_type_name, # type: str + parameters, # type: "_models.NodeTypeActionParameters" + **kwargs # type: Any + ): + # type: (...) -> None + 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-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._restart_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'nodeTypeName': self._serialize.url("node_type_name", node_type_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # 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, 'NodeTypeActionParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorModel, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _restart_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/nodeTypes/{nodeTypeName}/restart'} # type: ignore + + def begin_restart( + self, + resource_group_name, # type: str + cluster_name, # type: str + node_type_name, # type: str + parameters, # type: "_models.NodeTypeActionParameters" + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Restarts one or more nodes on the node type. + + Restarts one or more nodes on the node type. It will disable the fabric nodes, trigger a + restart on the VMs and activate the nodes back again. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. + :type cluster_name: str + :param node_type_name: The name of the node type. + :type node_type_name: str + :param parameters: parameters for restart action. + :type parameters: ~service_fabric_managed_clusters_management_client.models.NodeTypeActionParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._restart_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + node_type_name=node_type_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'nodeTypeName': self._serialize.url("node_type_name", node_type_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_restart.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/nodeTypes/{nodeTypeName}/restart'} # type: ignore + + def _reimage_initial( + self, + resource_group_name, # type: str + cluster_name, # type: str + node_type_name, # type: str + parameters, # type: "_models.NodeTypeActionParameters" + **kwargs # type: Any + ): + # type: (...) -> None + 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-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._reimage_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'nodeTypeName': self._serialize.url("node_type_name", node_type_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # 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, 'NodeTypeActionParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorModel, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _reimage_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/nodeTypes/{nodeTypeName}/reimage'} # type: ignore + + def begin_reimage( + self, + resource_group_name, # type: str + cluster_name, # type: str + node_type_name, # type: str + parameters, # type: "_models.NodeTypeActionParameters" + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Reimages one or more nodes on the node type. + + Reimages one or more nodes on the node type. It will disable the fabric nodes, trigger a + reimage on the VMs and activate the nodes back again. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. + :type cluster_name: str + :param node_type_name: The name of the node type. + :type node_type_name: str + :param parameters: parameters for reimage action. + :type parameters: ~service_fabric_managed_clusters_management_client.models.NodeTypeActionParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._reimage_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + node_type_name=node_type_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'nodeTypeName': self._serialize.url("node_type_name", node_type_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_reimage.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/nodeTypes/{nodeTypeName}/reimage'} # type: ignore + + def _delete_node_initial( + self, + resource_group_name, # type: str + cluster_name, # type: str + node_type_name, # type: str + parameters, # type: "_models.NodeTypeActionParameters" + **kwargs # type: Any + ): + # type: (...) -> None + 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-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._delete_node_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'nodeTypeName': self._serialize.url("node_type_name", node_type_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # 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, 'NodeTypeActionParameters') + body_content_kwargs['content'] = body_content + request = self._client.post(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorModel, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_node_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/nodeTypes/{nodeTypeName}/deleteNode'} # type: ignore + + def begin_delete_node( + self, + resource_group_name, # type: str + cluster_name, # type: str + node_type_name, # type: str + parameters, # type: "_models.NodeTypeActionParameters" + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes one or more nodes on the node type. + + Deletes one or more nodes on the node type. It will disable the fabric nodes, trigger a delete + on the VMs and removes the state from the cluster. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. + :type cluster_name: str + :param node_type_name: The name of the node type. + :type node_type_name: str + :param parameters: parameters for delete action. + :type parameters: ~service_fabric_managed_clusters_management_client.models.NodeTypeActionParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_node_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + node_type_name=node_type_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'nodeTypeName': self._serialize.url("node_type_name", node_type_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete_node.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/nodeTypes/{nodeTypeName}/deleteNode'} # type: ignore + + def get( + self, + resource_group_name, # type: str + cluster_name, # type: str + node_type_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> "_models.NodeType" + """Gets a Service Fabric node type. + + Get a Service Fabric node type of a given managed cluster. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. + :type cluster_name: str + :param node_type_name: The name of the node type. + :type node_type_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NodeType, or the result of cls(response) + :rtype: ~service_fabric_managed_clusters_management_client.models.NodeType + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NodeType"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'nodeTypeName': self._serialize.url("node_type_name", node_type_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorModel, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('NodeType', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/nodeTypes/{nodeTypeName}'} # type: ignore + + def _create_or_update_initial( + self, + resource_group_name, # type: str + cluster_name, # type: str + node_type_name, # type: str + parameters, # type: "_models.NodeType" + **kwargs # type: Any + ): + # type: (...) -> "_models.NodeType" + cls = kwargs.pop('cls', None) # type: ClsType["_models.NodeType"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'nodeTypeName': self._serialize.url("node_type_name", node_type_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['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, 'NodeType') + body_content_kwargs['content'] = body_content + request = self._client.put(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorModel, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('NodeType', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('NodeType', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/nodeTypes/{nodeTypeName}'} # type: ignore + + def begin_create_or_update( + self, + resource_group_name, # type: str + cluster_name, # type: str + node_type_name, # type: str + parameters, # type: "_models.NodeType" + **kwargs # type: Any + ): + # type: (...) -> LROPoller["_models.NodeType"] + """Creates or updates a Service Fabric node type. + + Create or update a Service Fabric node type of a given managed cluster. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. + :type cluster_name: str + :param node_type_name: The name of the node type. + :type node_type_name: str + :param parameters: The node type resource. + :type parameters: ~service_fabric_managed_clusters_management_client.models.NodeType + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for 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 NodeType or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~service_fabric_managed_clusters_management_client.models.NodeType] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType["_models.NodeType"] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._create_or_update_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + node_type_name=node_type_name, + parameters=parameters, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + deserialized = self._deserialize('NodeType', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + return deserialized + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'nodeTypeName': self._serialize.url("node_type_name", node_type_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/nodeTypes/{nodeTypeName}'} # type: ignore + + def update( + self, + resource_group_name, # type: str + cluster_name, # type: str + node_type_name, # type: str + parameters, # type: "_models.NodeTypeUpdateParameters" + **kwargs # type: Any + ): + # type: (...) -> "_models.NodeType" + """Update the tags of a node type resource of a given managed cluster. + + Update the configuration of a node type of a given managed cluster, only updating tags. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. + :type cluster_name: str + :param node_type_name: The name of the node type. + :type node_type_name: str + :param parameters: The parameters to update the node type configuration. + :type parameters: ~service_fabric_managed_clusters_management_client.models.NodeTypeUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: NodeType, or the result of cls(response) + :rtype: ~service_fabric_managed_clusters_management_client.models.NodeType + :raises: ~azure.core.exceptions.HttpResponseError + """ + cls = kwargs.pop('cls', None) # type: ClsType["_models.NodeType"] + error_map = { + 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError + } + error_map.update(kwargs.pop('error_map', {})) + api_version = "2021-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'nodeTypeName': self._serialize.url("node_type_name", node_type_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # 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, 'NodeTypeUpdateParameters') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorModel, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('NodeType', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/nodeTypes/{nodeTypeName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name, # type: str + cluster_name, # type: str + node_type_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + 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-01-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'nodeTypeName': self._serialize.url("node_type_name", node_type_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorModel, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/nodeTypes/{nodeTypeName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + cluster_name, # type: str + node_type_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes a Service Fabric node type. + + Delete a Service Fabric node type of a given managed cluster. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. + :type cluster_name: str + :param node_type_name: The name of the node type. + :type node_type_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + node_type_name=node_type_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'nodeTypeName': self._serialize.url("node_type_name", node_type_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedClusters/{clusterName}/nodeTypes/{nodeTypeName}'} # type: ignore diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_operations.py new file mode 100644 index 000000000000..28f6e98854e6 --- /dev/null +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_operations.py @@ -0,0 +1,112 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.mgmt.core.exceptions import ARMErrorFormat + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +class Operations(object): + """Operations operations. + + You should not instantiate this class directly. Instead, you should create a Client instance that + instantiates it for you and attaches it as an attribute. + + :ivar models: Alias to model classes used in this operation group. + :type models: ~service_fabric_managed_clusters_management_client.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + def list( + self, + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.OperationListResult"] + """Lists all of the available Service Fabric resource provider API operations. + + Get the list of available Service Fabric resource provider API operations. + + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either OperationListResult or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~service_fabric_managed_clusters_management_client.models.OperationListResult] + :raises: ~azure.core.exceptions.HttpResponseError + """ + 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-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list.metadata['url'] # type: ignore + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('OperationListResult', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(_models.ErrorModel, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + 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 diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_services_operations.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_services_operations.py new file mode 100644 index 000000000000..44b200f28312 --- /dev/null +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/operations/_services_operations.py @@ -0,0 +1,558 @@ +# coding=utf-8 +# -------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for license information. +# Code generated by Microsoft (R) AutoRest Code Generator. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. +# -------------------------------------------------------------------------- +from typing import TYPE_CHECKING +import warnings + +from azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error +from azure.core.paging import ItemPaged +from azure.core.pipeline import PipelineResponse +from azure.core.pipeline.transport import HttpRequest, HttpResponse +from azure.core.polling import LROPoller, NoPolling, PollingMethod +from azure.mgmt.core.exceptions import ARMErrorFormat +from azure.mgmt.core.polling.arm_polling import ARMPolling + +from .. import models as _models + +if TYPE_CHECKING: + # pylint: disable=unused-import,ungrouped-imports + from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar, Union + + T = TypeVar('T') + ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] + +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: ~service_fabric_managed_clusters_management_client.models + :param client: Client for service requests. + :param config: Configuration of service client. + :param serializer: An object model serializer. + :param deserializer: An object model deserializer. + """ + + models = _models + + def __init__(self, client, config, serializer, deserializer): + self._client = client + self._serialize = serializer + self._deserialize = deserializer + self._config = config + + 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" + """Gets a Service Fabric managed service resource. + + Get a Service Fabric service resource created or in the process of being created in the Service + Fabric managed application resource. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. + :type cluster_name: str + :param application_name: The name of the application resource. + :type application_name: str + :param service_name: The name of the service resource in the format of + {applicationName}~{serviceName}. + :type service_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ServiceResource, or the result of cls(response) + :rtype: ~service_fabric_managed_clusters_management_client.models.ServiceResource + :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-01-01-preview" + accept = "application/json" + + # Construct URL + url = self.get.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'applicationName': self._serialize.url("application_name", application_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorModel, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ServiceResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + get.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applications/{applicationName}/services/{serviceName}'} # type: ignore + + def _create_or_update_initial( + self, + resource_group_name, # type: str + cluster_name, # type: str + application_name, # type: str + service_name, # type: str + parameters, # type: "_models.ServiceResource" + **kwargs # type: Any + ): + # type: (...) -> "_models.ServiceResource" + 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-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self._create_or_update_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + '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) + 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(_models.ErrorModel, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if response.status_code == 200: + deserialized = self._deserialize('ServiceResource', pipeline_response) + + if response.status_code == 202: + deserialized = self._deserialize('ServiceResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + _create_or_update_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applications/{applicationName}/services/{serviceName}'} # type: ignore + + 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"] + """Creates or updates a Service Fabric managed service resource. + + Create or update a Service Fabric managed service resource with the specified name. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. + :type cluster_name: str + :param application_name: The name of the application resource. + :type application_name: str + :param service_name: The name of the service resource in the format of + {applicationName}~{serviceName}. + :type service_name: str + :param parameters: The service resource. + :type parameters: ~service_fabric_managed_clusters_management_client.models.ServiceResource + :keyword callable cls: A custom type or function that will be passed the direct response + :keyword str continuation_token: A continuation token to restart a poller from a saved state. + :keyword polling: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either ServiceResource or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[~service_fabric_managed_clusters_management_client.models.ServiceResource] + :raises ~azure.core.exceptions.HttpResponseError: + """ + 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( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_name=application_name, + service_name=service_name, + parameters=parameters, + cls=lambda x,y,z: x, + **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, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_create_or_update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applications/{applicationName}/services/{serviceName}'} # type: ignore + + def update( + self, + resource_group_name, # type: str + cluster_name, # type: str + application_name, # type: str + service_name, # type: str + parameters, # type: "_models.ServiceUpdateParameters" + **kwargs # type: Any + ): + # type: (...) -> "_models.ServiceResource" + """Updates the tags of a service resource of a given managed cluster. + + Updates the tags of a service resource of a given managed cluster. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. + :type cluster_name: str + :param application_name: The name of the application resource. + :type application_name: str + :param service_name: The name of the service resource in the format of + {applicationName}~{serviceName}. + :type service_name: str + :param parameters: The service resource updated tags. + :type parameters: ~service_fabric_managed_clusters_management_client.models.ServiceUpdateParameters + :keyword callable cls: A custom type or function that will be passed the direct response + :return: ServiceResource, or the result of cls(response) + :rtype: ~service_fabric_managed_clusters_management_client.models.ServiceResource + :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-01-01-preview" + content_type = kwargs.pop("content_type", "application/json") + accept = "application/json" + + # Construct URL + url = self.update.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'applicationName': self._serialize.url("application_name", application_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # 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, 'ServiceUpdateParameters') + body_content_kwargs['content'] = body_content + request = self._client.patch(url, query_parameters, header_parameters, **body_content_kwargs) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorModel, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + deserialized = self._deserialize('ServiceResource', pipeline_response) + + if cls: + return cls(pipeline_response, deserialized, {}) + + return deserialized + update.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applications/{applicationName}/services/{serviceName}'} # type: ignore + + def _delete_initial( + self, + resource_group_name, # type: str + cluster_name, # type: str + application_name, # type: str + service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> None + 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-01-01-preview" + accept = "application/json" + + # Construct URL + url = self._delete_initial.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'applicationName': self._serialize.url("application_name", application_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + request = self._client.delete(url, query_parameters, header_parameters) + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200, 202, 204]: + map_error(status_code=response.status_code, response=response, error_map=error_map) + error = self._deserialize(_models.ErrorModel, response) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + if cls: + return cls(pipeline_response, None, {}) + + _delete_initial.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applications/{applicationName}/services/{serviceName}'} # type: ignore + + def begin_delete( + self, + resource_group_name, # type: str + cluster_name, # type: str + application_name, # type: str + service_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> LROPoller[None] + """Deletes a Service Fabric managed service resource. + + Delete a Service Fabric managed service resource with the specified name. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. + :type cluster_name: str + :param application_name: The name of the application resource. + :type application_name: str + :param service_name: The name of the service resource in the format of + {applicationName}~{serviceName}. + :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: True for ARMPolling, False for no polling, or a + polling object for personal polling strategy + :paramtype polling: bool or ~azure.core.polling.PollingMethod + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :return: An instance of LROPoller that returns either None or the result of cls(response) + :rtype: ~azure.core.polling.LROPoller[None] + :raises ~azure.core.exceptions.HttpResponseError: + """ + polling = kwargs.pop('polling', True) # type: Union[bool, PollingMethod] + cls = kwargs.pop('cls', None) # type: ClsType[None] + lro_delay = kwargs.pop( + 'polling_interval', + self._config.polling_interval + ) + cont_token = kwargs.pop('continuation_token', None) # type: Optional[str] + if cont_token is None: + raw_result = self._delete_initial( + resource_group_name=resource_group_name, + cluster_name=cluster_name, + application_name=application_name, + service_name=service_name, + cls=lambda x,y,z: x, + **kwargs + ) + + kwargs.pop('error_map', None) + kwargs.pop('content_type', None) + + def get_long_running_output(pipeline_response): + if cls: + return cls(pipeline_response, None, {}) + + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'applicationName': self._serialize.url("application_name", application_name, 'str'), + 'serviceName': self._serialize.url("service_name", service_name, 'str'), + } + + if polling is True: polling_method = ARMPolling(lro_delay, lro_options={'final-state-via': 'location'}, path_format_arguments=path_format_arguments, **kwargs) + elif polling is False: polling_method = NoPolling() + else: polling_method = polling + if cont_token: + return LROPoller.from_continuation_token( + polling_method=polling_method, + continuation_token=cont_token, + client=self._client, + deserialization_callback=get_long_running_output + ) + else: + return LROPoller(self._client, raw_result, get_long_running_output, polling_method) + begin_delete.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applications/{applicationName}/services/{serviceName}'} # type: ignore + + def list_by_applications( + self, + resource_group_name, # type: str + cluster_name, # type: str + application_name, # type: str + **kwargs # type: Any + ): + # type: (...) -> Iterable["_models.ServiceResourceList"] + """Gets the list of service resources created in the specified Service Fabric managed application resource. + + Gets all service resources created or in the process of being created in the Service Fabric + managed application resource. + + :param resource_group_name: The name of the resource group. + :type resource_group_name: str + :param cluster_name: The name of the cluster resource. + :type cluster_name: str + :param application_name: The name of the application resource. + :type application_name: str + :keyword callable cls: A custom type or function that will be passed the direct response + :return: An iterator like instance of either ServiceResourceList or the result of cls(response) + :rtype: ~azure.core.paging.ItemPaged[~service_fabric_managed_clusters_management_client.models.ServiceResourceList] + :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-01-01-preview" + accept = "application/json" + + def prepare_request(next_link=None): + # Construct headers + header_parameters = {} # type: Dict[str, Any] + header_parameters['Accept'] = self._serialize.header("accept", accept, 'str') + + if not next_link: + # Construct URL + url = self.list_by_applications.metadata['url'] # type: ignore + path_format_arguments = { + 'subscriptionId': self._serialize.url("self._config.subscription_id", self._config.subscription_id, 'str'), + 'resourceGroupName': self._serialize.url("resource_group_name", resource_group_name, 'str'), + 'clusterName': self._serialize.url("cluster_name", cluster_name, 'str'), + 'applicationName': self._serialize.url("application_name", application_name, 'str'), + } + url = self._client.format_url(url, **path_format_arguments) + # Construct parameters + query_parameters = {} # type: Dict[str, Any] + query_parameters['api-version'] = self._serialize.query("api_version", api_version, 'str') + + request = self._client.get(url, query_parameters, header_parameters) + else: + url = next_link + query_parameters = {} # type: Dict[str, Any] + request = self._client.get(url, query_parameters, header_parameters) + return request + + def extract_data(pipeline_response): + deserialized = self._deserialize('ServiceResourceList', pipeline_response) + list_of_elem = deserialized.value + if cls: + list_of_elem = cls(list_of_elem) + return deserialized.next_link or None, iter(list_of_elem) + + def get_next(next_link=None): + request = prepare_request(next_link) + + pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs) + response = pipeline_response.http_response + + if response.status_code not in [200]: + error = self._deserialize(_models.ErrorModel, response) + map_error(status_code=response.status_code, response=response, error_map=error_map) + raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) + + return pipeline_response + + return ItemPaged( + get_next, extract_data + ) + list_by_applications.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ServiceFabric/managedclusters/{clusterName}/applications/{applicationName}/services'} # type: ignore diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/py.typed b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/py.typed new file mode 100644 index 000000000000..e5aff4f83af8 --- /dev/null +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/azure/mgmt/servicefabricmanagedclusters/py.typed @@ -0,0 +1 @@ +# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/sdk_packaging.toml b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/sdk_packaging.toml new file mode 100644 index 000000000000..997c4589873a --- /dev/null +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/sdk_packaging.toml @@ -0,0 +1,8 @@ +[packaging] +package_name = "azure-mgmt-servicefabricmanagedclusters" +package_nspkg = "azure-mgmt-nspkg" +package_pprint_name = "Servicefabricmanagedclusters Management" +package_doc_id = "" +is_stable = false +is_arm = true +need_msrestazure = true diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/setup.cfg b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/setup.cfg new file mode 100644 index 000000000000..3c6e79cf31da --- /dev/null +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/setup.cfg @@ -0,0 +1,2 @@ +[bdist_wheel] +universal=1 diff --git a/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/setup.py b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/setup.py new file mode 100644 index 000000000000..7ef14fe45b86 --- /dev/null +++ b/sdk/servicefabricmanagedclusters/azure-mgmt-servicefabricmanagedclusters/setup.py @@ -0,0 +1,91 @@ +#!/usr/bin/env python + +#------------------------------------------------------------------------- +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. See License.txt in the project root for +# license information. +#-------------------------------------------------------------------------- + +import re +import os.path +from io import open +from setuptools import find_packages, setup + +# Change the PACKAGE_NAME only to change folder and different name +PACKAGE_NAME = "azure-mgmt-servicefabricmanagedclusters" +PACKAGE_PPRINT_NAME = "Servicefabricmanagedclusters Management" + +# a-b-c => a/b/c +package_folder_path = PACKAGE_NAME.replace('-', '/') +# a-b-c => a.b.c +namespace_name = PACKAGE_NAME.replace('-', '.') + +# azure v0.x is not compatible with this package +# azure v0.x used to have a __version__ attribute (newer versions don't) +try: + import azure + try: + ver = azure.__version__ + raise Exception( + 'This package is incompatible with azure=={}. '.format(ver) + + 'Uninstall it with "pip uninstall azure".' + ) + except AttributeError: + pass +except ImportError: + pass + +# Version extraction inspired from 'requests' +with open(os.path.join(package_folder_path, 'version.py') + if os.path.exists(os.path.join(package_folder_path, 'version.py')) + else os.path.join(package_folder_path, '_version.py'), 'r') as fd: + version = re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', + fd.read(), re.MULTILINE).group(1) + +if not version: + raise RuntimeError('Cannot find version information') + +with open('README.md', encoding='utf-8') as f: + readme = f.read() +with open('CHANGELOG.md', encoding='utf-8') as f: + changelog = f.read() + +setup( + name=PACKAGE_NAME, + version=version, + description='Microsoft Azure {} Client Library for Python'.format(PACKAGE_PPRINT_NAME), + long_description=readme + '\n\n' + changelog, + long_description_content_type='text/markdown', + license='MIT License', + author='Microsoft Corporation', + author_email='azpysdkhelp@microsoft.com', + url='https://github.com/Azure/azure-sdk-for-python', + classifiers=[ + 'Development Status :: 4 - Beta', + 'Programming Language :: Python', + 'Programming Language :: Python :: 2', + 'Programming Language :: Python :: 2.7', + 'Programming Language :: Python :: 3', + 'Programming Language :: Python :: 3.5', + 'Programming Language :: Python :: 3.6', + 'Programming Language :: Python :: 3.7', + 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: 3.9', + 'License :: OSI Approved :: MIT License', + ], + zip_safe=False, + packages=find_packages(exclude=[ + 'tests', + # Exclude packages that will be covered by PEP420 or nspkg + 'azure', + 'azure.mgmt', + ]), + install_requires=[ + 'msrest>=0.5.0', + 'azure-mgmt-core>=1.2.0,<2.0.0', + 'azure-common~=1.1', + ], + extras_require={ + ":python_version<'3.0'": ['azure-mgmt-nspkg'], + } +) diff --git a/sdk/servicefabricmanagedclusters/ci.yml b/sdk/servicefabricmanagedclusters/ci.yml new file mode 100644 index 000000000000..ed826b34bc3e --- /dev/null +++ b/sdk/servicefabricmanagedclusters/ci.yml @@ -0,0 +1,35 @@ +# DO NOT EDIT THIS FILE +# This file is generated automatically and any changes will be lost. + +trigger: + branches: + include: + - master + - main + - hotfix/* + - release/* + - restapi* + paths: + include: + - sdk/servicefabricmanagedclusters/ + +pr: + branches: + include: + - master + - main + - feature/* + - hotfix/* + - release/* + - restapi* + paths: + include: + - sdk/servicefabricmanagedclusters/ + +extends: + template: ../../eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: servicefabricmanagedclusters + Artifacts: + - name: azure_mgmt_servicefabricmanagedclusters + safeName: azuremgmtservicefabricmanagedclusters \ No newline at end of file