diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/__init__.py index c9e1e010e0e02..4fb8943beb2c1 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/__init__.py @@ -7,10 +7,12 @@ # -------------------------------------------------------------------------- from ._container_service_client import ContainerServiceClient -__all__ = ['ContainerServiceClient'] + +__all__ = ["ContainerServiceClient"] try: from ._patch import patch_sdk # type: ignore + patch_sdk() except ImportError: pass diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/_configuration.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/_configuration.py index d0d261e8db848..f38bca8483502 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/_configuration.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/_configuration.py @@ -19,6 +19,7 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential + class ContainerServiceClientConfiguration: """Configuration for ContainerServiceClient. @@ -31,12 +32,7 @@ class ContainerServiceClientConfiguration: :type subscription_id: str """ - def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - **kwargs: Any - ): + def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any): if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -44,23 +40,22 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'azure-mgmt-containerservice/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "azure-mgmt-containerservice/{}".format(VERSION)) self.polling_interval = kwargs.get("polling_interval", 30) self._configure(**kwargs) - def _configure( - self, - **kwargs: Any - ): - 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') + def _configure(self, **kwargs: Any): + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/_container_service_client.py index cad62fb662cb8..8d52c177e3f27 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/_container_service_client.py @@ -25,6 +25,7 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential + class _SDKClient(object): def __init__(self, *args, **kwargs): """This is a fake class to support current implemetation of MultiApiClientMixin." @@ -32,6 +33,7 @@ def __init__(self, *args, **kwargs): """ pass + class ContainerServiceClient(MultiApiClientMixin, _SDKClient): """The Container Service Client. @@ -56,33 +58,35 @@ class ContainerServiceClient(MultiApiClientMixin, _SDKClient): :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ - DEFAULT_API_VERSION = '2024-08-01' + DEFAULT_API_VERSION = "2024-08-01" _PROFILE_TAG = "azure.mgmt.containerservice.ContainerServiceClient" - LATEST_PROFILE = ProfileDefinition({ - _PROFILE_TAG: { - None: DEFAULT_API_VERSION, - 'container_services': '2019-04-01', - 'fleet_members': '2022-09-02-preview', - 'fleets': '2022-09-02-preview', - 'load_balancers': '2024-07-02-preview', - 'managed_cluster_snapshots': '2024-07-02-preview', - 'open_shift_managed_clusters': '2019-04-30', - 'operation_status_result': '2024-07-02-preview', - }}, - _PROFILE_TAG + " latest" + LATEST_PROFILE = ProfileDefinition( + { + _PROFILE_TAG: { + None: DEFAULT_API_VERSION, + "container_services": "2019-04-01", + "fleet_members": "2022-09-02-preview", + "fleets": "2022-09-02-preview", + "load_balancers": "2024-07-02-preview", + "managed_cluster_snapshots": "2024-07-02-preview", + "open_shift_managed_clusters": "2019-04-30", + "operation_status_result": "2024-07-02-preview", + } + }, + _PROFILE_TAG + " latest", ) def __init__( self, credential: "TokenCredential", subscription_id: str, - api_version: Optional[str]=None, + api_version: Optional[str] = None, base_url: str = "https://management.azure.com", - profile: KnownProfiles=KnownProfiles.default, + profile: KnownProfiles = KnownProfiles.default, **kwargs: Any ): if api_version: - kwargs.setdefault('api_version', api_version) + kwargs.setdefault("api_version", api_version) self._config = ContainerServiceClientConfiguration(credential, subscription_id, **kwargs) _policies = kwargs.pop("policies", None) if _policies is None: @@ -103,10 +107,7 @@ def __init__( self._config.http_logging_policy, ] self._client = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) - super(ContainerServiceClient, self).__init__( - api_version=api_version, - profile=profile - ) + super(ContainerServiceClient, self).__init__(api_version=api_version, profile=profile) @classmethod def _models_dict(cls, api_version): @@ -116,342 +117,426 @@ def _models_dict(cls, api_version): def models(cls, api_version=DEFAULT_API_VERSION): """Module depends on the API version: - * 2017-07-01: :mod:`v2017_07_01.models` - * 2018-03-31: :mod:`v2018_03_31.models` - * 2018-08-01-preview: :mod:`v2018_08_01_preview.models` - * 2018-09-30-preview: :mod:`v2018_09_30_preview.models` - * 2019-02-01: :mod:`v2019_02_01.models` - * 2019-04-01: :mod:`v2019_04_01.models` - * 2019-04-30: :mod:`v2019_04_30.models` - * 2019-06-01: :mod:`v2019_06_01.models` - * 2019-08-01: :mod:`v2019_08_01.models` - * 2019-09-30-preview: :mod:`v2019_09_30_preview.models` - * 2019-10-01: :mod:`v2019_10_01.models` - * 2019-10-27-preview: :mod:`v2019_10_27_preview.models` - * 2019-11-01: :mod:`v2019_11_01.models` - * 2020-01-01: :mod:`v2020_01_01.models` - * 2020-02-01: :mod:`v2020_02_01.models` - * 2020-03-01: :mod:`v2020_03_01.models` - * 2020-04-01: :mod:`v2020_04_01.models` - * 2020-06-01: :mod:`v2020_06_01.models` - * 2020-07-01: :mod:`v2020_07_01.models` - * 2020-09-01: :mod:`v2020_09_01.models` - * 2020-11-01: :mod:`v2020_11_01.models` - * 2020-12-01: :mod:`v2020_12_01.models` - * 2021-02-01: :mod:`v2021_02_01.models` - * 2021-03-01: :mod:`v2021_03_01.models` - * 2021-05-01: :mod:`v2021_05_01.models` - * 2021-07-01: :mod:`v2021_07_01.models` - * 2021-08-01: :mod:`v2021_08_01.models` - * 2021-09-01: :mod:`v2021_09_01.models` - * 2021-10-01: :mod:`v2021_10_01.models` - * 2021-11-01-preview: :mod:`v2021_11_01_preview.models` - * 2022-01-01: :mod:`v2022_01_01.models` - * 2022-01-02-preview: :mod:`v2022_01_02_preview.models` - * 2022-02-01: :mod:`v2022_02_01.models` - * 2022-02-02-preview: :mod:`v2022_02_02_preview.models` - * 2022-03-01: :mod:`v2022_03_01.models` - * 2022-03-02-preview: :mod:`v2022_03_02_preview.models` - * 2022-04-01: :mod:`v2022_04_01.models` - * 2022-04-02-preview: :mod:`v2022_04_02_preview.models` - * 2022-05-02-preview: :mod:`v2022_05_02_preview.models` - * 2022-06-01: :mod:`v2022_06_01.models` - * 2022-06-02-preview: :mod:`v2022_06_02_preview.models` - * 2022-07-01: :mod:`v2022_07_01.models` - * 2022-07-02-preview: :mod:`v2022_07_02_preview.models` - * 2022-08-02-preview: :mod:`v2022_08_02_preview.models` - * 2022-08-03-preview: :mod:`v2022_08_03_preview.models` - * 2022-09-01: :mod:`v2022_09_01.models` - * 2022-09-02-preview: :mod:`v2022_09_02_preview.models` - * 2022-10-02-preview: :mod:`v2022_10_02_preview.models` - * 2022-11-01: :mod:`v2022_11_01.models` - * 2022-11-02-preview: :mod:`v2022_11_02_preview.models` - * 2023-01-01: :mod:`v2023_01_01.models` - * 2023-01-02-preview: :mod:`v2023_01_02_preview.models` - * 2023-02-01: :mod:`v2023_02_01.models` - * 2023-02-02-preview: :mod:`v2023_02_02_preview.models` - * 2023-03-01: :mod:`v2023_03_01.models` - * 2023-03-02-preview: :mod:`v2023_03_02_preview.models` - * 2023-04-01: :mod:`v2023_04_01.models` - * 2023-04-02-preview: :mod:`v2023_04_02_preview.models` - * 2023-05-01: :mod:`v2023_05_01.models` - * 2023-05-02-preview: :mod:`v2023_05_02_preview.models` - * 2023-06-01: :mod:`v2023_06_01.models` - * 2023-06-02-preview: :mod:`v2023_06_02_preview.models` - * 2023-07-01: :mod:`v2023_07_01.models` - * 2023-07-02-preview: :mod:`v2023_07_02_preview.models` - * 2023-08-01: :mod:`v2023_08_01.models` - * 2023-08-02-preview: :mod:`v2023_08_02_preview.models` - * 2023-09-01: :mod:`v2023_09_01.models` - * 2023-09-02-preview: :mod:`v2023_09_02_preview.models` - * 2023-10-01: :mod:`v2023_10_01.models` - * 2023-10-02-preview: :mod:`v2023_10_02_preview.models` - * 2023-11-01: :mod:`v2023_11_01.models` - * 2023-11-02-preview: :mod:`v2023_11_02_preview.models` - * 2024-01-01: :mod:`v2024_01_01.models` - * 2024-01-02-preview: :mod:`v2024_01_02_preview.models` - * 2024-02-01: :mod:`v2024_02_01.models` - * 2024-02-02-preview: :mod:`v2024_02_02_preview.models` - * 2024-03-02-preview: :mod:`v2024_03_02_preview.models` - * 2024-04-02-preview: :mod:`v2024_04_02_preview.models` - * 2024-05-01: :mod:`v2024_05_01.models` - * 2024-05-02-preview: :mod:`v2024_05_02_preview.models` - * 2024-06-02-preview: :mod:`v2024_06_02_preview.models` - * 2024-07-01: :mod:`v2024_07_01.models` - * 2024-07-02-preview: :mod:`v2024_07_02_preview.models` - * 2024-08-01: :mod:`v2024_08_01.models` + * 2017-07-01: :mod:`v2017_07_01.models` + * 2018-03-31: :mod:`v2018_03_31.models` + * 2018-08-01-preview: :mod:`v2018_08_01_preview.models` + * 2018-09-30-preview: :mod:`v2018_09_30_preview.models` + * 2019-02-01: :mod:`v2019_02_01.models` + * 2019-04-01: :mod:`v2019_04_01.models` + * 2019-04-30: :mod:`v2019_04_30.models` + * 2019-06-01: :mod:`v2019_06_01.models` + * 2019-08-01: :mod:`v2019_08_01.models` + * 2019-09-30-preview: :mod:`v2019_09_30_preview.models` + * 2019-10-01: :mod:`v2019_10_01.models` + * 2019-10-27-preview: :mod:`v2019_10_27_preview.models` + * 2019-11-01: :mod:`v2019_11_01.models` + * 2020-01-01: :mod:`v2020_01_01.models` + * 2020-02-01: :mod:`v2020_02_01.models` + * 2020-03-01: :mod:`v2020_03_01.models` + * 2020-04-01: :mod:`v2020_04_01.models` + * 2020-06-01: :mod:`v2020_06_01.models` + * 2020-07-01: :mod:`v2020_07_01.models` + * 2020-09-01: :mod:`v2020_09_01.models` + * 2020-11-01: :mod:`v2020_11_01.models` + * 2020-12-01: :mod:`v2020_12_01.models` + * 2021-02-01: :mod:`v2021_02_01.models` + * 2021-03-01: :mod:`v2021_03_01.models` + * 2021-05-01: :mod:`v2021_05_01.models` + * 2021-07-01: :mod:`v2021_07_01.models` + * 2021-08-01: :mod:`v2021_08_01.models` + * 2021-09-01: :mod:`v2021_09_01.models` + * 2021-10-01: :mod:`v2021_10_01.models` + * 2021-11-01-preview: :mod:`v2021_11_01_preview.models` + * 2022-01-01: :mod:`v2022_01_01.models` + * 2022-01-02-preview: :mod:`v2022_01_02_preview.models` + * 2022-02-01: :mod:`v2022_02_01.models` + * 2022-02-02-preview: :mod:`v2022_02_02_preview.models` + * 2022-03-01: :mod:`v2022_03_01.models` + * 2022-03-02-preview: :mod:`v2022_03_02_preview.models` + * 2022-04-01: :mod:`v2022_04_01.models` + * 2022-04-02-preview: :mod:`v2022_04_02_preview.models` + * 2022-05-02-preview: :mod:`v2022_05_02_preview.models` + * 2022-06-01: :mod:`v2022_06_01.models` + * 2022-06-02-preview: :mod:`v2022_06_02_preview.models` + * 2022-07-01: :mod:`v2022_07_01.models` + * 2022-07-02-preview: :mod:`v2022_07_02_preview.models` + * 2022-08-02-preview: :mod:`v2022_08_02_preview.models` + * 2022-08-03-preview: :mod:`v2022_08_03_preview.models` + * 2022-09-01: :mod:`v2022_09_01.models` + * 2022-09-02-preview: :mod:`v2022_09_02_preview.models` + * 2022-10-02-preview: :mod:`v2022_10_02_preview.models` + * 2022-11-01: :mod:`v2022_11_01.models` + * 2022-11-02-preview: :mod:`v2022_11_02_preview.models` + * 2023-01-01: :mod:`v2023_01_01.models` + * 2023-01-02-preview: :mod:`v2023_01_02_preview.models` + * 2023-02-01: :mod:`v2023_02_01.models` + * 2023-02-02-preview: :mod:`v2023_02_02_preview.models` + * 2023-03-01: :mod:`v2023_03_01.models` + * 2023-03-02-preview: :mod:`v2023_03_02_preview.models` + * 2023-04-01: :mod:`v2023_04_01.models` + * 2023-04-02-preview: :mod:`v2023_04_02_preview.models` + * 2023-05-01: :mod:`v2023_05_01.models` + * 2023-05-02-preview: :mod:`v2023_05_02_preview.models` + * 2023-06-01: :mod:`v2023_06_01.models` + * 2023-06-02-preview: :mod:`v2023_06_02_preview.models` + * 2023-07-01: :mod:`v2023_07_01.models` + * 2023-07-02-preview: :mod:`v2023_07_02_preview.models` + * 2023-08-01: :mod:`v2023_08_01.models` + * 2023-08-02-preview: :mod:`v2023_08_02_preview.models` + * 2023-09-01: :mod:`v2023_09_01.models` + * 2023-09-02-preview: :mod:`v2023_09_02_preview.models` + * 2023-10-01: :mod:`v2023_10_01.models` + * 2023-10-02-preview: :mod:`v2023_10_02_preview.models` + * 2023-11-01: :mod:`v2023_11_01.models` + * 2023-11-02-preview: :mod:`v2023_11_02_preview.models` + * 2024-01-01: :mod:`v2024_01_01.models` + * 2024-01-02-preview: :mod:`v2024_01_02_preview.models` + * 2024-02-01: :mod:`v2024_02_01.models` + * 2024-02-02-preview: :mod:`v2024_02_02_preview.models` + * 2024-03-02-preview: :mod:`v2024_03_02_preview.models` + * 2024-04-02-preview: :mod:`v2024_04_02_preview.models` + * 2024-05-01: :mod:`v2024_05_01.models` + * 2024-05-02-preview: :mod:`v2024_05_02_preview.models` + * 2024-06-02-preview: :mod:`v2024_06_02_preview.models` + * 2024-07-01: :mod:`v2024_07_01.models` + * 2024-07-02-preview: :mod:`v2024_07_02_preview.models` + * 2024-08-01: :mod:`v2024_08_01.models` """ - if api_version == '2017-07-01': + if api_version == "2017-07-01": from .v2017_07_01 import models + return models - elif api_version == '2018-03-31': + elif api_version == "2018-03-31": from .v2018_03_31 import models + return models - elif api_version == '2018-08-01-preview': + elif api_version == "2018-08-01-preview": from .v2018_08_01_preview import models + return models - elif api_version == '2018-09-30-preview': + elif api_version == "2018-09-30-preview": from .v2018_09_30_preview import models + return models - elif api_version == '2019-02-01': + elif api_version == "2019-02-01": from .v2019_02_01 import models + return models - elif api_version == '2019-04-01': + elif api_version == "2019-04-01": from .v2019_04_01 import models + return models - elif api_version == '2019-04-30': + elif api_version == "2019-04-30": from .v2019_04_30 import models + return models - elif api_version == '2019-06-01': + elif api_version == "2019-06-01": from .v2019_06_01 import models + return models - elif api_version == '2019-08-01': + elif api_version == "2019-08-01": from .v2019_08_01 import models + return models - elif api_version == '2019-09-30-preview': + elif api_version == "2019-09-30-preview": from .v2019_09_30_preview import models + return models - elif api_version == '2019-10-01': + elif api_version == "2019-10-01": from .v2019_10_01 import models + return models - elif api_version == '2019-10-27-preview': + elif api_version == "2019-10-27-preview": from .v2019_10_27_preview import models + return models - elif api_version == '2019-11-01': + elif api_version == "2019-11-01": from .v2019_11_01 import models + return models - elif api_version == '2020-01-01': + elif api_version == "2020-01-01": from .v2020_01_01 import models + return models - elif api_version == '2020-02-01': + elif api_version == "2020-02-01": from .v2020_02_01 import models + return models - elif api_version == '2020-03-01': + elif api_version == "2020-03-01": from .v2020_03_01 import models + return models - elif api_version == '2020-04-01': + elif api_version == "2020-04-01": from .v2020_04_01 import models + return models - elif api_version == '2020-06-01': + elif api_version == "2020-06-01": from .v2020_06_01 import models + return models - elif api_version == '2020-07-01': + elif api_version == "2020-07-01": from .v2020_07_01 import models + return models - elif api_version == '2020-09-01': + elif api_version == "2020-09-01": from .v2020_09_01 import models + return models - elif api_version == '2020-11-01': + elif api_version == "2020-11-01": from .v2020_11_01 import models + return models - elif api_version == '2020-12-01': + elif api_version == "2020-12-01": from .v2020_12_01 import models + return models - elif api_version == '2021-02-01': + elif api_version == "2021-02-01": from .v2021_02_01 import models + return models - elif api_version == '2021-03-01': + elif api_version == "2021-03-01": from .v2021_03_01 import models + return models - elif api_version == '2021-05-01': + elif api_version == "2021-05-01": from .v2021_05_01 import models + return models - elif api_version == '2021-07-01': + elif api_version == "2021-07-01": from .v2021_07_01 import models + return models - elif api_version == '2021-08-01': + elif api_version == "2021-08-01": from .v2021_08_01 import models + return models - elif api_version == '2021-09-01': + elif api_version == "2021-09-01": from .v2021_09_01 import models + return models - elif api_version == '2021-10-01': + elif api_version == "2021-10-01": from .v2021_10_01 import models + return models - elif api_version == '2021-11-01-preview': + elif api_version == "2021-11-01-preview": from .v2021_11_01_preview import models + return models - elif api_version == '2022-01-01': + elif api_version == "2022-01-01": from .v2022_01_01 import models + return models - elif api_version == '2022-01-02-preview': + elif api_version == "2022-01-02-preview": from .v2022_01_02_preview import models + return models - elif api_version == '2022-02-01': + elif api_version == "2022-02-01": from .v2022_02_01 import models + return models - elif api_version == '2022-02-02-preview': + elif api_version == "2022-02-02-preview": from .v2022_02_02_preview import models + return models - elif api_version == '2022-03-01': + elif api_version == "2022-03-01": from .v2022_03_01 import models + return models - elif api_version == '2022-03-02-preview': + elif api_version == "2022-03-02-preview": from .v2022_03_02_preview import models + return models - elif api_version == '2022-04-01': + elif api_version == "2022-04-01": from .v2022_04_01 import models + return models - elif api_version == '2022-04-02-preview': + elif api_version == "2022-04-02-preview": from .v2022_04_02_preview import models + return models - elif api_version == '2022-05-02-preview': + elif api_version == "2022-05-02-preview": from .v2022_05_02_preview import models + return models - elif api_version == '2022-06-01': + elif api_version == "2022-06-01": from .v2022_06_01 import models + return models - elif api_version == '2022-06-02-preview': + elif api_version == "2022-06-02-preview": from .v2022_06_02_preview import models + return models - elif api_version == '2022-07-01': + elif api_version == "2022-07-01": from .v2022_07_01 import models + return models - elif api_version == '2022-07-02-preview': + elif api_version == "2022-07-02-preview": from .v2022_07_02_preview import models + return models - elif api_version == '2022-08-02-preview': + elif api_version == "2022-08-02-preview": from .v2022_08_02_preview import models + return models - elif api_version == '2022-08-03-preview': + elif api_version == "2022-08-03-preview": from .v2022_08_03_preview import models + return models - elif api_version == '2022-09-01': + elif api_version == "2022-09-01": from .v2022_09_01 import models + return models - elif api_version == '2022-09-02-preview': + elif api_version == "2022-09-02-preview": from .v2022_09_02_preview import models + return models - elif api_version == '2022-10-02-preview': + elif api_version == "2022-10-02-preview": from .v2022_10_02_preview import models + return models - elif api_version == '2022-11-01': + elif api_version == "2022-11-01": from .v2022_11_01 import models + return models - elif api_version == '2022-11-02-preview': + elif api_version == "2022-11-02-preview": from .v2022_11_02_preview import models + return models - elif api_version == '2023-01-01': + elif api_version == "2023-01-01": from .v2023_01_01 import models + return models - elif api_version == '2023-01-02-preview': + elif api_version == "2023-01-02-preview": from .v2023_01_02_preview import models + return models - elif api_version == '2023-02-01': + elif api_version == "2023-02-01": from .v2023_02_01 import models + return models - elif api_version == '2023-02-02-preview': + elif api_version == "2023-02-02-preview": from .v2023_02_02_preview import models + return models - elif api_version == '2023-03-01': + elif api_version == "2023-03-01": from .v2023_03_01 import models + return models - elif api_version == '2023-03-02-preview': + elif api_version == "2023-03-02-preview": from .v2023_03_02_preview import models + return models - elif api_version == '2023-04-01': + elif api_version == "2023-04-01": from .v2023_04_01 import models + return models - elif api_version == '2023-04-02-preview': + elif api_version == "2023-04-02-preview": from .v2023_04_02_preview import models + return models - elif api_version == '2023-05-01': + elif api_version == "2023-05-01": from .v2023_05_01 import models + return models - elif api_version == '2023-05-02-preview': + elif api_version == "2023-05-02-preview": from .v2023_05_02_preview import models + return models - elif api_version == '2023-06-01': + elif api_version == "2023-06-01": from .v2023_06_01 import models + return models - elif api_version == '2023-06-02-preview': + elif api_version == "2023-06-02-preview": from .v2023_06_02_preview import models + return models - elif api_version == '2023-07-01': + elif api_version == "2023-07-01": from .v2023_07_01 import models + return models - elif api_version == '2023-07-02-preview': + elif api_version == "2023-07-02-preview": from .v2023_07_02_preview import models + return models - elif api_version == '2023-08-01': + elif api_version == "2023-08-01": from .v2023_08_01 import models + return models - elif api_version == '2023-08-02-preview': + elif api_version == "2023-08-02-preview": from .v2023_08_02_preview import models + return models - elif api_version == '2023-09-01': + elif api_version == "2023-09-01": from .v2023_09_01 import models + return models - elif api_version == '2023-09-02-preview': + elif api_version == "2023-09-02-preview": from .v2023_09_02_preview import models + return models - elif api_version == '2023-10-01': + elif api_version == "2023-10-01": from .v2023_10_01 import models + return models - elif api_version == '2023-10-02-preview': + elif api_version == "2023-10-02-preview": from .v2023_10_02_preview import models + return models - elif api_version == '2023-11-01': + elif api_version == "2023-11-01": from .v2023_11_01 import models + return models - elif api_version == '2023-11-02-preview': + elif api_version == "2023-11-02-preview": from .v2023_11_02_preview import models + return models - elif api_version == '2024-01-01': + elif api_version == "2024-01-01": from .v2024_01_01 import models + return models - elif api_version == '2024-01-02-preview': + elif api_version == "2024-01-02-preview": from .v2024_01_02_preview import models + return models - elif api_version == '2024-02-01': + elif api_version == "2024-02-01": from .v2024_02_01 import models + return models - elif api_version == '2024-02-02-preview': + elif api_version == "2024-02-02-preview": from .v2024_02_02_preview import models + return models - elif api_version == '2024-03-02-preview': + elif api_version == "2024-03-02-preview": from .v2024_03_02_preview import models + return models - elif api_version == '2024-04-02-preview': + elif api_version == "2024-04-02-preview": from .v2024_04_02_preview import models + return models - elif api_version == '2024-05-01': + elif api_version == "2024-05-01": from .v2024_05_01 import models + return models - elif api_version == '2024-05-02-preview': + elif api_version == "2024-05-02-preview": from .v2024_05_02_preview import models + return models - elif api_version == '2024-06-02-preview': + elif api_version == "2024-06-02-preview": from .v2024_06_02_preview import models + return models - elif api_version == '2024-07-01': + elif api_version == "2024-07-01": from .v2024_07_01 import models + return models - elif api_version == '2024-07-02-preview': + elif api_version == "2024-07-02-preview": from .v2024_07_02_preview import models + return models - elif api_version == '2024-08-01': + elif api_version == "2024-08-01": from .v2024_08_01 import models + return models raise ValueError("API version {} is not available".format(api_version)) @@ -459,2280 +544,2406 @@ def models(cls, api_version=DEFAULT_API_VERSION): def agent_pools(self): """Instance depends on the API version: - * 2019-02-01: :class:`AgentPoolsOperations` - * 2019-04-01: :class:`AgentPoolsOperations` - * 2019-06-01: :class:`AgentPoolsOperations` - * 2019-08-01: :class:`AgentPoolsOperations` - * 2019-10-01: :class:`AgentPoolsOperations` - * 2019-11-01: :class:`AgentPoolsOperations` - * 2020-01-01: :class:`AgentPoolsOperations` - * 2020-02-01: :class:`AgentPoolsOperations` - * 2020-03-01: :class:`AgentPoolsOperations` - * 2020-04-01: :class:`AgentPoolsOperations` - * 2020-06-01: :class:`AgentPoolsOperations` - * 2020-07-01: :class:`AgentPoolsOperations` - * 2020-09-01: :class:`AgentPoolsOperations` - * 2020-11-01: :class:`AgentPoolsOperations` - * 2020-12-01: :class:`AgentPoolsOperations` - * 2021-02-01: :class:`AgentPoolsOperations` - * 2021-03-01: :class:`AgentPoolsOperations` - * 2021-05-01: :class:`AgentPoolsOperations` - * 2021-07-01: :class:`AgentPoolsOperations` - * 2021-08-01: :class:`AgentPoolsOperations` - * 2021-09-01: :class:`AgentPoolsOperations` - * 2021-10-01: :class:`AgentPoolsOperations` - * 2021-11-01-preview: :class:`AgentPoolsOperations` - * 2022-01-01: :class:`AgentPoolsOperations` - * 2022-01-02-preview: :class:`AgentPoolsOperations` - * 2022-02-01: :class:`AgentPoolsOperations` - * 2022-02-02-preview: :class:`AgentPoolsOperations` - * 2022-03-01: :class:`AgentPoolsOperations` - * 2022-03-02-preview: :class:`AgentPoolsOperations` - * 2022-04-01: :class:`AgentPoolsOperations` - * 2022-04-02-preview: :class:`AgentPoolsOperations` - * 2022-05-02-preview: :class:`AgentPoolsOperations` - * 2022-06-01: :class:`AgentPoolsOperations` - * 2022-06-02-preview: :class:`AgentPoolsOperations` - * 2022-07-01: :class:`AgentPoolsOperations` - * 2022-07-02-preview: :class:`AgentPoolsOperations` - * 2022-08-02-preview: :class:`AgentPoolsOperations` - * 2022-08-03-preview: :class:`AgentPoolsOperations` - * 2022-09-01: :class:`AgentPoolsOperations` - * 2022-09-02-preview: :class:`AgentPoolsOperations` - * 2022-10-02-preview: :class:`AgentPoolsOperations` - * 2022-11-01: :class:`AgentPoolsOperations` - * 2022-11-02-preview: :class:`AgentPoolsOperations` - * 2023-01-01: :class:`AgentPoolsOperations` - * 2023-01-02-preview: :class:`AgentPoolsOperations` - * 2023-02-01: :class:`AgentPoolsOperations` - * 2023-02-02-preview: :class:`AgentPoolsOperations` - * 2023-03-01: :class:`AgentPoolsOperations` - * 2023-03-02-preview: :class:`AgentPoolsOperations` - * 2023-04-01: :class:`AgentPoolsOperations` - * 2023-04-02-preview: :class:`AgentPoolsOperations` - * 2023-05-01: :class:`AgentPoolsOperations` - * 2023-05-02-preview: :class:`AgentPoolsOperations` - * 2023-06-01: :class:`AgentPoolsOperations` - * 2023-06-02-preview: :class:`AgentPoolsOperations` - * 2023-07-01: :class:`AgentPoolsOperations` - * 2023-07-02-preview: :class:`AgentPoolsOperations` - * 2023-08-01: :class:`AgentPoolsOperations` - * 2023-08-02-preview: :class:`AgentPoolsOperations` - * 2023-09-01: :class:`AgentPoolsOperations` - * 2023-09-02-preview: :class:`AgentPoolsOperations` - * 2023-10-01: :class:`AgentPoolsOperations` - * 2023-10-02-preview: :class:`AgentPoolsOperations` - * 2023-11-01: :class:`AgentPoolsOperations` - * 2023-11-02-preview: :class:`AgentPoolsOperations` - * 2024-01-01: :class:`AgentPoolsOperations` - * 2024-01-02-preview: :class:`AgentPoolsOperations` - * 2024-02-01: :class:`AgentPoolsOperations` - * 2024-02-02-preview: :class:`AgentPoolsOperations` - * 2024-03-02-preview: :class:`AgentPoolsOperations` - * 2024-04-02-preview: :class:`AgentPoolsOperations` - * 2024-05-01: :class:`AgentPoolsOperations` - * 2024-05-02-preview: :class:`AgentPoolsOperations` - * 2024-06-02-preview: :class:`AgentPoolsOperations` - * 2024-07-01: :class:`AgentPoolsOperations` - * 2024-07-02-preview: :class:`AgentPoolsOperations` - * 2024-08-01: :class:`AgentPoolsOperations` + * 2019-02-01: :class:`AgentPoolsOperations` + * 2019-04-01: :class:`AgentPoolsOperations` + * 2019-06-01: :class:`AgentPoolsOperations` + * 2019-08-01: :class:`AgentPoolsOperations` + * 2019-10-01: :class:`AgentPoolsOperations` + * 2019-11-01: :class:`AgentPoolsOperations` + * 2020-01-01: :class:`AgentPoolsOperations` + * 2020-02-01: :class:`AgentPoolsOperations` + * 2020-03-01: :class:`AgentPoolsOperations` + * 2020-04-01: :class:`AgentPoolsOperations` + * 2020-06-01: :class:`AgentPoolsOperations` + * 2020-07-01: :class:`AgentPoolsOperations` + * 2020-09-01: :class:`AgentPoolsOperations` + * 2020-11-01: :class:`AgentPoolsOperations` + * 2020-12-01: :class:`AgentPoolsOperations` + * 2021-02-01: :class:`AgentPoolsOperations` + * 2021-03-01: :class:`AgentPoolsOperations` + * 2021-05-01: :class:`AgentPoolsOperations` + * 2021-07-01: :class:`AgentPoolsOperations` + * 2021-08-01: :class:`AgentPoolsOperations` + * 2021-09-01: :class:`AgentPoolsOperations` + * 2021-10-01: :class:`AgentPoolsOperations` + * 2021-11-01-preview: :class:`AgentPoolsOperations` + * 2022-01-01: :class:`AgentPoolsOperations` + * 2022-01-02-preview: :class:`AgentPoolsOperations` + * 2022-02-01: :class:`AgentPoolsOperations` + * 2022-02-02-preview: :class:`AgentPoolsOperations` + * 2022-03-01: :class:`AgentPoolsOperations` + * 2022-03-02-preview: :class:`AgentPoolsOperations` + * 2022-04-01: :class:`AgentPoolsOperations` + * 2022-04-02-preview: :class:`AgentPoolsOperations` + * 2022-05-02-preview: :class:`AgentPoolsOperations` + * 2022-06-01: :class:`AgentPoolsOperations` + * 2022-06-02-preview: :class:`AgentPoolsOperations` + * 2022-07-01: :class:`AgentPoolsOperations` + * 2022-07-02-preview: :class:`AgentPoolsOperations` + * 2022-08-02-preview: :class:`AgentPoolsOperations` + * 2022-08-03-preview: :class:`AgentPoolsOperations` + * 2022-09-01: :class:`AgentPoolsOperations` + * 2022-09-02-preview: :class:`AgentPoolsOperations` + * 2022-10-02-preview: :class:`AgentPoolsOperations` + * 2022-11-01: :class:`AgentPoolsOperations` + * 2022-11-02-preview: :class:`AgentPoolsOperations` + * 2023-01-01: :class:`AgentPoolsOperations` + * 2023-01-02-preview: :class:`AgentPoolsOperations` + * 2023-02-01: :class:`AgentPoolsOperations` + * 2023-02-02-preview: :class:`AgentPoolsOperations` + * 2023-03-01: :class:`AgentPoolsOperations` + * 2023-03-02-preview: :class:`AgentPoolsOperations` + * 2023-04-01: :class:`AgentPoolsOperations` + * 2023-04-02-preview: :class:`AgentPoolsOperations` + * 2023-05-01: :class:`AgentPoolsOperations` + * 2023-05-02-preview: :class:`AgentPoolsOperations` + * 2023-06-01: :class:`AgentPoolsOperations` + * 2023-06-02-preview: :class:`AgentPoolsOperations` + * 2023-07-01: :class:`AgentPoolsOperations` + * 2023-07-02-preview: :class:`AgentPoolsOperations` + * 2023-08-01: :class:`AgentPoolsOperations` + * 2023-08-02-preview: :class:`AgentPoolsOperations` + * 2023-09-01: :class:`AgentPoolsOperations` + * 2023-09-02-preview: :class:`AgentPoolsOperations` + * 2023-10-01: :class:`AgentPoolsOperations` + * 2023-10-02-preview: :class:`AgentPoolsOperations` + * 2023-11-01: :class:`AgentPoolsOperations` + * 2023-11-02-preview: :class:`AgentPoolsOperations` + * 2024-01-01: :class:`AgentPoolsOperations` + * 2024-01-02-preview: :class:`AgentPoolsOperations` + * 2024-02-01: :class:`AgentPoolsOperations` + * 2024-02-02-preview: :class:`AgentPoolsOperations` + * 2024-03-02-preview: :class:`AgentPoolsOperations` + * 2024-04-02-preview: :class:`AgentPoolsOperations` + * 2024-05-01: :class:`AgentPoolsOperations` + * 2024-05-02-preview: :class:`AgentPoolsOperations` + * 2024-06-02-preview: :class:`AgentPoolsOperations` + * 2024-07-01: :class:`AgentPoolsOperations` + * 2024-07-02-preview: :class:`AgentPoolsOperations` + * 2024-08-01: :class:`AgentPoolsOperations` """ - api_version = self._get_api_version('agent_pools') - if api_version == '2019-02-01': + api_version = self._get_api_version("agent_pools") + if api_version == "2019-02-01": from .v2019_02_01.operations import AgentPoolsOperations as OperationClass - elif api_version == '2019-04-01': + elif api_version == "2019-04-01": from .v2019_04_01.operations import AgentPoolsOperations as OperationClass - elif api_version == '2019-06-01': + elif api_version == "2019-06-01": from .v2019_06_01.operations import AgentPoolsOperations as OperationClass - elif api_version == '2019-08-01': + elif api_version == "2019-08-01": from .v2019_08_01.operations import AgentPoolsOperations as OperationClass - elif api_version == '2019-10-01': + elif api_version == "2019-10-01": from .v2019_10_01.operations import AgentPoolsOperations as OperationClass - elif api_version == '2019-11-01': + elif api_version == "2019-11-01": from .v2019_11_01.operations import AgentPoolsOperations as OperationClass - elif api_version == '2020-01-01': + elif api_version == "2020-01-01": from .v2020_01_01.operations import AgentPoolsOperations as OperationClass - elif api_version == '2020-02-01': + elif api_version == "2020-02-01": from .v2020_02_01.operations import AgentPoolsOperations as OperationClass - elif api_version == '2020-03-01': + elif api_version == "2020-03-01": from .v2020_03_01.operations import AgentPoolsOperations as OperationClass - elif api_version == '2020-04-01': + elif api_version == "2020-04-01": from .v2020_04_01.operations import AgentPoolsOperations as OperationClass - elif api_version == '2020-06-01': + elif api_version == "2020-06-01": from .v2020_06_01.operations import AgentPoolsOperations as OperationClass - elif api_version == '2020-07-01': + elif api_version == "2020-07-01": from .v2020_07_01.operations import AgentPoolsOperations as OperationClass - elif api_version == '2020-09-01': + elif api_version == "2020-09-01": from .v2020_09_01.operations import AgentPoolsOperations as OperationClass - elif api_version == '2020-11-01': + elif api_version == "2020-11-01": from .v2020_11_01.operations import AgentPoolsOperations as OperationClass - elif api_version == '2020-12-01': + elif api_version == "2020-12-01": from .v2020_12_01.operations import AgentPoolsOperations as OperationClass - elif api_version == '2021-02-01': + elif api_version == "2021-02-01": from .v2021_02_01.operations import AgentPoolsOperations as OperationClass - elif api_version == '2021-03-01': + elif api_version == "2021-03-01": from .v2021_03_01.operations import AgentPoolsOperations as OperationClass - elif api_version == '2021-05-01': + elif api_version == "2021-05-01": from .v2021_05_01.operations import AgentPoolsOperations as OperationClass - elif api_version == '2021-07-01': + elif api_version == "2021-07-01": from .v2021_07_01.operations import AgentPoolsOperations as OperationClass - elif api_version == '2021-08-01': + elif api_version == "2021-08-01": from .v2021_08_01.operations import AgentPoolsOperations as OperationClass - elif api_version == '2021-09-01': + elif api_version == "2021-09-01": from .v2021_09_01.operations import AgentPoolsOperations as OperationClass - elif api_version == '2021-10-01': + elif api_version == "2021-10-01": from .v2021_10_01.operations import AgentPoolsOperations as OperationClass - elif api_version == '2021-11-01-preview': + elif api_version == "2021-11-01-preview": from .v2021_11_01_preview.operations import AgentPoolsOperations as OperationClass - elif api_version == '2022-01-01': + elif api_version == "2022-01-01": from .v2022_01_01.operations import AgentPoolsOperations as OperationClass - elif api_version == '2022-01-02-preview': + elif api_version == "2022-01-02-preview": from .v2022_01_02_preview.operations import AgentPoolsOperations as OperationClass - elif api_version == '2022-02-01': + elif api_version == "2022-02-01": from .v2022_02_01.operations import AgentPoolsOperations as OperationClass - elif api_version == '2022-02-02-preview': + elif api_version == "2022-02-02-preview": from .v2022_02_02_preview.operations import AgentPoolsOperations as OperationClass - elif api_version == '2022-03-01': + elif api_version == "2022-03-01": from .v2022_03_01.operations import AgentPoolsOperations as OperationClass - elif api_version == '2022-03-02-preview': + elif api_version == "2022-03-02-preview": from .v2022_03_02_preview.operations import AgentPoolsOperations as OperationClass - elif api_version == '2022-04-01': + elif api_version == "2022-04-01": from .v2022_04_01.operations import AgentPoolsOperations as OperationClass - elif api_version == '2022-04-02-preview': + elif api_version == "2022-04-02-preview": from .v2022_04_02_preview.operations import AgentPoolsOperations as OperationClass - elif api_version == '2022-05-02-preview': + elif api_version == "2022-05-02-preview": from .v2022_05_02_preview.operations import AgentPoolsOperations as OperationClass - elif api_version == '2022-06-01': + elif api_version == "2022-06-01": from .v2022_06_01.operations import AgentPoolsOperations as OperationClass - elif api_version == '2022-06-02-preview': + elif api_version == "2022-06-02-preview": from .v2022_06_02_preview.operations import AgentPoolsOperations as OperationClass - elif api_version == '2022-07-01': + elif api_version == "2022-07-01": from .v2022_07_01.operations import AgentPoolsOperations as OperationClass - elif api_version == '2022-07-02-preview': + elif api_version == "2022-07-02-preview": from .v2022_07_02_preview.operations import AgentPoolsOperations as OperationClass - elif api_version == '2022-08-02-preview': + elif api_version == "2022-08-02-preview": from .v2022_08_02_preview.operations import AgentPoolsOperations as OperationClass - elif api_version == '2022-08-03-preview': + elif api_version == "2022-08-03-preview": from .v2022_08_03_preview.operations import AgentPoolsOperations as OperationClass - elif api_version == '2022-09-01': + elif api_version == "2022-09-01": from .v2022_09_01.operations import AgentPoolsOperations as OperationClass - elif api_version == '2022-09-02-preview': + elif api_version == "2022-09-02-preview": from .v2022_09_02_preview.operations import AgentPoolsOperations as OperationClass - elif api_version == '2022-10-02-preview': + elif api_version == "2022-10-02-preview": from .v2022_10_02_preview.operations import AgentPoolsOperations as OperationClass - elif api_version == '2022-11-01': + elif api_version == "2022-11-01": from .v2022_11_01.operations import AgentPoolsOperations as OperationClass - elif api_version == '2022-11-02-preview': + elif api_version == "2022-11-02-preview": from .v2022_11_02_preview.operations import AgentPoolsOperations as OperationClass - elif api_version == '2023-01-01': + elif api_version == "2023-01-01": from .v2023_01_01.operations import AgentPoolsOperations as OperationClass - elif api_version == '2023-01-02-preview': + elif api_version == "2023-01-02-preview": from .v2023_01_02_preview.operations import AgentPoolsOperations as OperationClass - elif api_version == '2023-02-01': + elif api_version == "2023-02-01": from .v2023_02_01.operations import AgentPoolsOperations as OperationClass - elif api_version == '2023-02-02-preview': + elif api_version == "2023-02-02-preview": from .v2023_02_02_preview.operations import AgentPoolsOperations as OperationClass - elif api_version == '2023-03-01': + elif api_version == "2023-03-01": from .v2023_03_01.operations import AgentPoolsOperations as OperationClass - elif api_version == '2023-03-02-preview': + elif api_version == "2023-03-02-preview": from .v2023_03_02_preview.operations import AgentPoolsOperations as OperationClass - elif api_version == '2023-04-01': + elif api_version == "2023-04-01": from .v2023_04_01.operations import AgentPoolsOperations as OperationClass - elif api_version == '2023-04-02-preview': + elif api_version == "2023-04-02-preview": from .v2023_04_02_preview.operations import AgentPoolsOperations as OperationClass - elif api_version == '2023-05-01': + elif api_version == "2023-05-01": from .v2023_05_01.operations import AgentPoolsOperations as OperationClass - elif api_version == '2023-05-02-preview': + elif api_version == "2023-05-02-preview": from .v2023_05_02_preview.operations import AgentPoolsOperations as OperationClass - elif api_version == '2023-06-01': + elif api_version == "2023-06-01": from .v2023_06_01.operations import AgentPoolsOperations as OperationClass - elif api_version == '2023-06-02-preview': + elif api_version == "2023-06-02-preview": from .v2023_06_02_preview.operations import AgentPoolsOperations as OperationClass - elif api_version == '2023-07-01': + elif api_version == "2023-07-01": from .v2023_07_01.operations import AgentPoolsOperations as OperationClass - elif api_version == '2023-07-02-preview': + elif api_version == "2023-07-02-preview": from .v2023_07_02_preview.operations import AgentPoolsOperations as OperationClass - elif api_version == '2023-08-01': + elif api_version == "2023-08-01": from .v2023_08_01.operations import AgentPoolsOperations as OperationClass - elif api_version == '2023-08-02-preview': + elif api_version == "2023-08-02-preview": from .v2023_08_02_preview.operations import AgentPoolsOperations as OperationClass - elif api_version == '2023-09-01': + elif api_version == "2023-09-01": from .v2023_09_01.operations import AgentPoolsOperations as OperationClass - elif api_version == '2023-09-02-preview': + elif api_version == "2023-09-02-preview": from .v2023_09_02_preview.operations import AgentPoolsOperations as OperationClass - elif api_version == '2023-10-01': + elif api_version == "2023-10-01": from .v2023_10_01.operations import AgentPoolsOperations as OperationClass - elif api_version == '2023-10-02-preview': + elif api_version == "2023-10-02-preview": from .v2023_10_02_preview.operations import AgentPoolsOperations as OperationClass - elif api_version == '2023-11-01': + elif api_version == "2023-11-01": from .v2023_11_01.operations import AgentPoolsOperations as OperationClass - elif api_version == '2023-11-02-preview': + elif api_version == "2023-11-02-preview": from .v2023_11_02_preview.operations import AgentPoolsOperations as OperationClass - elif api_version == '2024-01-01': + elif api_version == "2024-01-01": from .v2024_01_01.operations import AgentPoolsOperations as OperationClass - elif api_version == '2024-01-02-preview': + elif api_version == "2024-01-02-preview": from .v2024_01_02_preview.operations import AgentPoolsOperations as OperationClass - elif api_version == '2024-02-01': + elif api_version == "2024-02-01": from .v2024_02_01.operations import AgentPoolsOperations as OperationClass - elif api_version == '2024-02-02-preview': + elif api_version == "2024-02-02-preview": from .v2024_02_02_preview.operations import AgentPoolsOperations as OperationClass - elif api_version == '2024-03-02-preview': + elif api_version == "2024-03-02-preview": from .v2024_03_02_preview.operations import AgentPoolsOperations as OperationClass - elif api_version == '2024-04-02-preview': + elif api_version == "2024-04-02-preview": from .v2024_04_02_preview.operations import AgentPoolsOperations as OperationClass - elif api_version == '2024-05-01': + elif api_version == "2024-05-01": from .v2024_05_01.operations import AgentPoolsOperations as OperationClass - elif api_version == '2024-05-02-preview': + elif api_version == "2024-05-02-preview": from .v2024_05_02_preview.operations import AgentPoolsOperations as OperationClass - elif api_version == '2024-06-02-preview': + elif api_version == "2024-06-02-preview": from .v2024_06_02_preview.operations import AgentPoolsOperations as OperationClass - elif api_version == '2024-07-01': + elif api_version == "2024-07-01": from .v2024_07_01.operations import AgentPoolsOperations as OperationClass - elif api_version == '2024-07-02-preview': + elif api_version == "2024-07-02-preview": from .v2024_07_02_preview.operations import AgentPoolsOperations as OperationClass - elif api_version == '2024-08-01': + elif api_version == "2024-08-01": from .v2024_08_01.operations import AgentPoolsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'agent_pools'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) + return OperationClass( + self._client, + self._config, + Serializer(self._models_dict(api_version)), + Deserializer(self._models_dict(api_version)), + api_version, + ) @property def container_services(self): """Instance depends on the API version: - * 2017-07-01: :class:`ContainerServicesOperations` - * 2019-04-01: :class:`ContainerServicesOperations` + * 2017-07-01: :class:`ContainerServicesOperations` + * 2019-04-01: :class:`ContainerServicesOperations` """ - api_version = self._get_api_version('container_services') - if api_version == '2017-07-01': + api_version = self._get_api_version("container_services") + if api_version == "2017-07-01": from .v2017_07_01.operations import ContainerServicesOperations as OperationClass - elif api_version == '2019-04-01': + elif api_version == "2019-04-01": from .v2019_04_01.operations import ContainerServicesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'container_services'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) + return OperationClass( + self._client, + self._config, + Serializer(self._models_dict(api_version)), + Deserializer(self._models_dict(api_version)), + api_version, + ) @property def fleet_members(self): """Instance depends on the API version: - * 2022-06-02-preview: :class:`FleetMembersOperations` - * 2022-07-02-preview: :class:`FleetMembersOperations` - * 2022-09-02-preview: :class:`FleetMembersOperations` + * 2022-06-02-preview: :class:`FleetMembersOperations` + * 2022-07-02-preview: :class:`FleetMembersOperations` + * 2022-09-02-preview: :class:`FleetMembersOperations` """ - api_version = self._get_api_version('fleet_members') - if api_version == '2022-06-02-preview': + api_version = self._get_api_version("fleet_members") + if api_version == "2022-06-02-preview": from .v2022_06_02_preview.operations import FleetMembersOperations as OperationClass - elif api_version == '2022-07-02-preview': + elif api_version == "2022-07-02-preview": from .v2022_07_02_preview.operations import FleetMembersOperations as OperationClass - elif api_version == '2022-09-02-preview': + elif api_version == "2022-09-02-preview": from .v2022_09_02_preview.operations import FleetMembersOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'fleet_members'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) + return OperationClass( + self._client, + self._config, + Serializer(self._models_dict(api_version)), + Deserializer(self._models_dict(api_version)), + api_version, + ) @property def fleets(self): """Instance depends on the API version: - * 2022-06-02-preview: :class:`FleetsOperations` - * 2022-07-02-preview: :class:`FleetsOperations` - * 2022-09-02-preview: :class:`FleetsOperations` + * 2022-06-02-preview: :class:`FleetsOperations` + * 2022-07-02-preview: :class:`FleetsOperations` + * 2022-09-02-preview: :class:`FleetsOperations` """ - api_version = self._get_api_version('fleets') - if api_version == '2022-06-02-preview': + api_version = self._get_api_version("fleets") + if api_version == "2022-06-02-preview": from .v2022_06_02_preview.operations import FleetsOperations as OperationClass - elif api_version == '2022-07-02-preview': + elif api_version == "2022-07-02-preview": from .v2022_07_02_preview.operations import FleetsOperations as OperationClass - elif api_version == '2022-09-02-preview': + elif api_version == "2022-09-02-preview": from .v2022_09_02_preview.operations import FleetsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'fleets'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) + return OperationClass( + self._client, + self._config, + Serializer(self._models_dict(api_version)), + Deserializer(self._models_dict(api_version)), + api_version, + ) @property def load_balancers(self): """Instance depends on the API version: - * 2024-03-02-preview: :class:`LoadBalancersOperations` - * 2024-04-02-preview: :class:`LoadBalancersOperations` - * 2024-05-02-preview: :class:`LoadBalancersOperations` - * 2024-06-02-preview: :class:`LoadBalancersOperations` - * 2024-07-02-preview: :class:`LoadBalancersOperations` + * 2024-03-02-preview: :class:`LoadBalancersOperations` + * 2024-04-02-preview: :class:`LoadBalancersOperations` + * 2024-05-02-preview: :class:`LoadBalancersOperations` + * 2024-06-02-preview: :class:`LoadBalancersOperations` + * 2024-07-02-preview: :class:`LoadBalancersOperations` """ - api_version = self._get_api_version('load_balancers') - if api_version == '2024-03-02-preview': + api_version = self._get_api_version("load_balancers") + if api_version == "2024-03-02-preview": from .v2024_03_02_preview.operations import LoadBalancersOperations as OperationClass - elif api_version == '2024-04-02-preview': + elif api_version == "2024-04-02-preview": from .v2024_04_02_preview.operations import LoadBalancersOperations as OperationClass - elif api_version == '2024-05-02-preview': + elif api_version == "2024-05-02-preview": from .v2024_05_02_preview.operations import LoadBalancersOperations as OperationClass - elif api_version == '2024-06-02-preview': + elif api_version == "2024-06-02-preview": from .v2024_06_02_preview.operations import LoadBalancersOperations as OperationClass - elif api_version == '2024-07-02-preview': + elif api_version == "2024-07-02-preview": from .v2024_07_02_preview.operations import LoadBalancersOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'load_balancers'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) + return OperationClass( + self._client, + self._config, + Serializer(self._models_dict(api_version)), + Deserializer(self._models_dict(api_version)), + api_version, + ) @property def machines(self): """Instance depends on the API version: - * 2023-07-02-preview: :class:`MachinesOperations` - * 2023-08-02-preview: :class:`MachinesOperations` - * 2023-09-02-preview: :class:`MachinesOperations` - * 2023-10-02-preview: :class:`MachinesOperations` - * 2023-11-02-preview: :class:`MachinesOperations` - * 2024-01-02-preview: :class:`MachinesOperations` - * 2024-02-02-preview: :class:`MachinesOperations` - * 2024-03-02-preview: :class:`MachinesOperations` - * 2024-04-02-preview: :class:`MachinesOperations` - * 2024-05-02-preview: :class:`MachinesOperations` - * 2024-06-02-preview: :class:`MachinesOperations` - * 2024-07-01: :class:`MachinesOperations` - * 2024-07-02-preview: :class:`MachinesOperations` - * 2024-08-01: :class:`MachinesOperations` + * 2023-07-02-preview: :class:`MachinesOperations` + * 2023-08-02-preview: :class:`MachinesOperations` + * 2023-09-02-preview: :class:`MachinesOperations` + * 2023-10-02-preview: :class:`MachinesOperations` + * 2023-11-02-preview: :class:`MachinesOperations` + * 2024-01-02-preview: :class:`MachinesOperations` + * 2024-02-02-preview: :class:`MachinesOperations` + * 2024-03-02-preview: :class:`MachinesOperations` + * 2024-04-02-preview: :class:`MachinesOperations` + * 2024-05-02-preview: :class:`MachinesOperations` + * 2024-06-02-preview: :class:`MachinesOperations` + * 2024-07-01: :class:`MachinesOperations` + * 2024-07-02-preview: :class:`MachinesOperations` + * 2024-08-01: :class:`MachinesOperations` """ - api_version = self._get_api_version('machines') - if api_version == '2023-07-02-preview': + api_version = self._get_api_version("machines") + if api_version == "2023-07-02-preview": from .v2023_07_02_preview.operations import MachinesOperations as OperationClass - elif api_version == '2023-08-02-preview': + elif api_version == "2023-08-02-preview": from .v2023_08_02_preview.operations import MachinesOperations as OperationClass - elif api_version == '2023-09-02-preview': + elif api_version == "2023-09-02-preview": from .v2023_09_02_preview.operations import MachinesOperations as OperationClass - elif api_version == '2023-10-02-preview': + elif api_version == "2023-10-02-preview": from .v2023_10_02_preview.operations import MachinesOperations as OperationClass - elif api_version == '2023-11-02-preview': + elif api_version == "2023-11-02-preview": from .v2023_11_02_preview.operations import MachinesOperations as OperationClass - elif api_version == '2024-01-02-preview': + elif api_version == "2024-01-02-preview": from .v2024_01_02_preview.operations import MachinesOperations as OperationClass - elif api_version == '2024-02-02-preview': + elif api_version == "2024-02-02-preview": from .v2024_02_02_preview.operations import MachinesOperations as OperationClass - elif api_version == '2024-03-02-preview': + elif api_version == "2024-03-02-preview": from .v2024_03_02_preview.operations import MachinesOperations as OperationClass - elif api_version == '2024-04-02-preview': + elif api_version == "2024-04-02-preview": from .v2024_04_02_preview.operations import MachinesOperations as OperationClass - elif api_version == '2024-05-02-preview': + elif api_version == "2024-05-02-preview": from .v2024_05_02_preview.operations import MachinesOperations as OperationClass - elif api_version == '2024-06-02-preview': + elif api_version == "2024-06-02-preview": from .v2024_06_02_preview.operations import MachinesOperations as OperationClass - elif api_version == '2024-07-01': + elif api_version == "2024-07-01": from .v2024_07_01.operations import MachinesOperations as OperationClass - elif api_version == '2024-07-02-preview': + elif api_version == "2024-07-02-preview": from .v2024_07_02_preview.operations import MachinesOperations as OperationClass - elif api_version == '2024-08-01': + elif api_version == "2024-08-01": from .v2024_08_01.operations import MachinesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'machines'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) + return OperationClass( + self._client, + self._config, + Serializer(self._models_dict(api_version)), + Deserializer(self._models_dict(api_version)), + api_version, + ) @property def maintenance_configurations(self): """Instance depends on the API version: - * 2020-12-01: :class:`MaintenanceConfigurationsOperations` - * 2021-02-01: :class:`MaintenanceConfigurationsOperations` - * 2021-03-01: :class:`MaintenanceConfigurationsOperations` - * 2021-05-01: :class:`MaintenanceConfigurationsOperations` - * 2021-07-01: :class:`MaintenanceConfigurationsOperations` - * 2021-08-01: :class:`MaintenanceConfigurationsOperations` - * 2021-09-01: :class:`MaintenanceConfigurationsOperations` - * 2021-10-01: :class:`MaintenanceConfigurationsOperations` - * 2021-11-01-preview: :class:`MaintenanceConfigurationsOperations` - * 2022-01-01: :class:`MaintenanceConfigurationsOperations` - * 2022-01-02-preview: :class:`MaintenanceConfigurationsOperations` - * 2022-02-01: :class:`MaintenanceConfigurationsOperations` - * 2022-02-02-preview: :class:`MaintenanceConfigurationsOperations` - * 2022-03-01: :class:`MaintenanceConfigurationsOperations` - * 2022-03-02-preview: :class:`MaintenanceConfigurationsOperations` - * 2022-04-01: :class:`MaintenanceConfigurationsOperations` - * 2022-04-02-preview: :class:`MaintenanceConfigurationsOperations` - * 2022-05-02-preview: :class:`MaintenanceConfigurationsOperations` - * 2022-06-01: :class:`MaintenanceConfigurationsOperations` - * 2022-06-02-preview: :class:`MaintenanceConfigurationsOperations` - * 2022-07-01: :class:`MaintenanceConfigurationsOperations` - * 2022-07-02-preview: :class:`MaintenanceConfigurationsOperations` - * 2022-08-02-preview: :class:`MaintenanceConfigurationsOperations` - * 2022-08-03-preview: :class:`MaintenanceConfigurationsOperations` - * 2022-09-01: :class:`MaintenanceConfigurationsOperations` - * 2022-09-02-preview: :class:`MaintenanceConfigurationsOperations` - * 2022-10-02-preview: :class:`MaintenanceConfigurationsOperations` - * 2022-11-01: :class:`MaintenanceConfigurationsOperations` - * 2022-11-02-preview: :class:`MaintenanceConfigurationsOperations` - * 2023-01-01: :class:`MaintenanceConfigurationsOperations` - * 2023-01-02-preview: :class:`MaintenanceConfigurationsOperations` - * 2023-02-01: :class:`MaintenanceConfigurationsOperations` - * 2023-02-02-preview: :class:`MaintenanceConfigurationsOperations` - * 2023-03-01: :class:`MaintenanceConfigurationsOperations` - * 2023-03-02-preview: :class:`MaintenanceConfigurationsOperations` - * 2023-04-01: :class:`MaintenanceConfigurationsOperations` - * 2023-04-02-preview: :class:`MaintenanceConfigurationsOperations` - * 2023-05-01: :class:`MaintenanceConfigurationsOperations` - * 2023-05-02-preview: :class:`MaintenanceConfigurationsOperations` - * 2023-06-01: :class:`MaintenanceConfigurationsOperations` - * 2023-06-02-preview: :class:`MaintenanceConfigurationsOperations` - * 2023-07-01: :class:`MaintenanceConfigurationsOperations` - * 2023-07-02-preview: :class:`MaintenanceConfigurationsOperations` - * 2023-08-01: :class:`MaintenanceConfigurationsOperations` - * 2023-08-02-preview: :class:`MaintenanceConfigurationsOperations` - * 2023-09-01: :class:`MaintenanceConfigurationsOperations` - * 2023-09-02-preview: :class:`MaintenanceConfigurationsOperations` - * 2023-10-01: :class:`MaintenanceConfigurationsOperations` - * 2023-10-02-preview: :class:`MaintenanceConfigurationsOperations` - * 2023-11-01: :class:`MaintenanceConfigurationsOperations` - * 2023-11-02-preview: :class:`MaintenanceConfigurationsOperations` - * 2024-01-01: :class:`MaintenanceConfigurationsOperations` - * 2024-01-02-preview: :class:`MaintenanceConfigurationsOperations` - * 2024-02-01: :class:`MaintenanceConfigurationsOperations` - * 2024-02-02-preview: :class:`MaintenanceConfigurationsOperations` - * 2024-03-02-preview: :class:`MaintenanceConfigurationsOperations` - * 2024-04-02-preview: :class:`MaintenanceConfigurationsOperations` - * 2024-05-01: :class:`MaintenanceConfigurationsOperations` - * 2024-05-02-preview: :class:`MaintenanceConfigurationsOperations` - * 2024-06-02-preview: :class:`MaintenanceConfigurationsOperations` - * 2024-07-01: :class:`MaintenanceConfigurationsOperations` - * 2024-07-02-preview: :class:`MaintenanceConfigurationsOperations` - * 2024-08-01: :class:`MaintenanceConfigurationsOperations` + * 2020-12-01: :class:`MaintenanceConfigurationsOperations` + * 2021-02-01: :class:`MaintenanceConfigurationsOperations` + * 2021-03-01: :class:`MaintenanceConfigurationsOperations` + * 2021-05-01: :class:`MaintenanceConfigurationsOperations` + * 2021-07-01: :class:`MaintenanceConfigurationsOperations` + * 2021-08-01: :class:`MaintenanceConfigurationsOperations` + * 2021-09-01: :class:`MaintenanceConfigurationsOperations` + * 2021-10-01: :class:`MaintenanceConfigurationsOperations` + * 2021-11-01-preview: :class:`MaintenanceConfigurationsOperations` + * 2022-01-01: :class:`MaintenanceConfigurationsOperations` + * 2022-01-02-preview: :class:`MaintenanceConfigurationsOperations` + * 2022-02-01: :class:`MaintenanceConfigurationsOperations` + * 2022-02-02-preview: :class:`MaintenanceConfigurationsOperations` + * 2022-03-01: :class:`MaintenanceConfigurationsOperations` + * 2022-03-02-preview: :class:`MaintenanceConfigurationsOperations` + * 2022-04-01: :class:`MaintenanceConfigurationsOperations` + * 2022-04-02-preview: :class:`MaintenanceConfigurationsOperations` + * 2022-05-02-preview: :class:`MaintenanceConfigurationsOperations` + * 2022-06-01: :class:`MaintenanceConfigurationsOperations` + * 2022-06-02-preview: :class:`MaintenanceConfigurationsOperations` + * 2022-07-01: :class:`MaintenanceConfigurationsOperations` + * 2022-07-02-preview: :class:`MaintenanceConfigurationsOperations` + * 2022-08-02-preview: :class:`MaintenanceConfigurationsOperations` + * 2022-08-03-preview: :class:`MaintenanceConfigurationsOperations` + * 2022-09-01: :class:`MaintenanceConfigurationsOperations` + * 2022-09-02-preview: :class:`MaintenanceConfigurationsOperations` + * 2022-10-02-preview: :class:`MaintenanceConfigurationsOperations` + * 2022-11-01: :class:`MaintenanceConfigurationsOperations` + * 2022-11-02-preview: :class:`MaintenanceConfigurationsOperations` + * 2023-01-01: :class:`MaintenanceConfigurationsOperations` + * 2023-01-02-preview: :class:`MaintenanceConfigurationsOperations` + * 2023-02-01: :class:`MaintenanceConfigurationsOperations` + * 2023-02-02-preview: :class:`MaintenanceConfigurationsOperations` + * 2023-03-01: :class:`MaintenanceConfigurationsOperations` + * 2023-03-02-preview: :class:`MaintenanceConfigurationsOperations` + * 2023-04-01: :class:`MaintenanceConfigurationsOperations` + * 2023-04-02-preview: :class:`MaintenanceConfigurationsOperations` + * 2023-05-01: :class:`MaintenanceConfigurationsOperations` + * 2023-05-02-preview: :class:`MaintenanceConfigurationsOperations` + * 2023-06-01: :class:`MaintenanceConfigurationsOperations` + * 2023-06-02-preview: :class:`MaintenanceConfigurationsOperations` + * 2023-07-01: :class:`MaintenanceConfigurationsOperations` + * 2023-07-02-preview: :class:`MaintenanceConfigurationsOperations` + * 2023-08-01: :class:`MaintenanceConfigurationsOperations` + * 2023-08-02-preview: :class:`MaintenanceConfigurationsOperations` + * 2023-09-01: :class:`MaintenanceConfigurationsOperations` + * 2023-09-02-preview: :class:`MaintenanceConfigurationsOperations` + * 2023-10-01: :class:`MaintenanceConfigurationsOperations` + * 2023-10-02-preview: :class:`MaintenanceConfigurationsOperations` + * 2023-11-01: :class:`MaintenanceConfigurationsOperations` + * 2023-11-02-preview: :class:`MaintenanceConfigurationsOperations` + * 2024-01-01: :class:`MaintenanceConfigurationsOperations` + * 2024-01-02-preview: :class:`MaintenanceConfigurationsOperations` + * 2024-02-01: :class:`MaintenanceConfigurationsOperations` + * 2024-02-02-preview: :class:`MaintenanceConfigurationsOperations` + * 2024-03-02-preview: :class:`MaintenanceConfigurationsOperations` + * 2024-04-02-preview: :class:`MaintenanceConfigurationsOperations` + * 2024-05-01: :class:`MaintenanceConfigurationsOperations` + * 2024-05-02-preview: :class:`MaintenanceConfigurationsOperations` + * 2024-06-02-preview: :class:`MaintenanceConfigurationsOperations` + * 2024-07-01: :class:`MaintenanceConfigurationsOperations` + * 2024-07-02-preview: :class:`MaintenanceConfigurationsOperations` + * 2024-08-01: :class:`MaintenanceConfigurationsOperations` """ - api_version = self._get_api_version('maintenance_configurations') - if api_version == '2020-12-01': + api_version = self._get_api_version("maintenance_configurations") + if api_version == "2020-12-01": from .v2020_12_01.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2021-02-01': + elif api_version == "2021-02-01": from .v2021_02_01.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2021-03-01': + elif api_version == "2021-03-01": from .v2021_03_01.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2021-05-01': + elif api_version == "2021-05-01": from .v2021_05_01.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2021-07-01': + elif api_version == "2021-07-01": from .v2021_07_01.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2021-08-01': + elif api_version == "2021-08-01": from .v2021_08_01.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2021-09-01': + elif api_version == "2021-09-01": from .v2021_09_01.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2021-10-01': + elif api_version == "2021-10-01": from .v2021_10_01.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2021-11-01-preview': + elif api_version == "2021-11-01-preview": from .v2021_11_01_preview.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2022-01-01': + elif api_version == "2022-01-01": from .v2022_01_01.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2022-01-02-preview': + elif api_version == "2022-01-02-preview": from .v2022_01_02_preview.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2022-02-01': + elif api_version == "2022-02-01": from .v2022_02_01.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2022-02-02-preview': + elif api_version == "2022-02-02-preview": from .v2022_02_02_preview.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2022-03-01': + elif api_version == "2022-03-01": from .v2022_03_01.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2022-03-02-preview': + elif api_version == "2022-03-02-preview": from .v2022_03_02_preview.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2022-04-01': + elif api_version == "2022-04-01": from .v2022_04_01.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2022-04-02-preview': + elif api_version == "2022-04-02-preview": from .v2022_04_02_preview.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2022-05-02-preview': + elif api_version == "2022-05-02-preview": from .v2022_05_02_preview.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2022-06-01': + elif api_version == "2022-06-01": from .v2022_06_01.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2022-06-02-preview': + elif api_version == "2022-06-02-preview": from .v2022_06_02_preview.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2022-07-01': + elif api_version == "2022-07-01": from .v2022_07_01.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2022-07-02-preview': + elif api_version == "2022-07-02-preview": from .v2022_07_02_preview.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2022-08-02-preview': + elif api_version == "2022-08-02-preview": from .v2022_08_02_preview.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2022-08-03-preview': + elif api_version == "2022-08-03-preview": from .v2022_08_03_preview.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2022-09-01': + elif api_version == "2022-09-01": from .v2022_09_01.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2022-09-02-preview': + elif api_version == "2022-09-02-preview": from .v2022_09_02_preview.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2022-10-02-preview': + elif api_version == "2022-10-02-preview": from .v2022_10_02_preview.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2022-11-01': + elif api_version == "2022-11-01": from .v2022_11_01.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2022-11-02-preview': + elif api_version == "2022-11-02-preview": from .v2022_11_02_preview.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2023-01-01': + elif api_version == "2023-01-01": from .v2023_01_01.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2023-01-02-preview': + elif api_version == "2023-01-02-preview": from .v2023_01_02_preview.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2023-02-01': + elif api_version == "2023-02-01": from .v2023_02_01.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2023-02-02-preview': + elif api_version == "2023-02-02-preview": from .v2023_02_02_preview.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2023-03-01': + elif api_version == "2023-03-01": from .v2023_03_01.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2023-03-02-preview': + elif api_version == "2023-03-02-preview": from .v2023_03_02_preview.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2023-04-01': + elif api_version == "2023-04-01": from .v2023_04_01.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2023-04-02-preview': + elif api_version == "2023-04-02-preview": from .v2023_04_02_preview.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2023-05-01': + elif api_version == "2023-05-01": from .v2023_05_01.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2023-05-02-preview': + elif api_version == "2023-05-02-preview": from .v2023_05_02_preview.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2023-06-01': + elif api_version == "2023-06-01": from .v2023_06_01.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2023-06-02-preview': + elif api_version == "2023-06-02-preview": from .v2023_06_02_preview.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2023-07-01': + elif api_version == "2023-07-01": from .v2023_07_01.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2023-07-02-preview': + elif api_version == "2023-07-02-preview": from .v2023_07_02_preview.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2023-08-01': + elif api_version == "2023-08-01": from .v2023_08_01.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2023-08-02-preview': + elif api_version == "2023-08-02-preview": from .v2023_08_02_preview.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2023-09-01': + elif api_version == "2023-09-01": from .v2023_09_01.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2023-09-02-preview': + elif api_version == "2023-09-02-preview": from .v2023_09_02_preview.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2023-10-01': + elif api_version == "2023-10-01": from .v2023_10_01.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2023-10-02-preview': + elif api_version == "2023-10-02-preview": from .v2023_10_02_preview.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2023-11-01': + elif api_version == "2023-11-01": from .v2023_11_01.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2023-11-02-preview': + elif api_version == "2023-11-02-preview": from .v2023_11_02_preview.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2024-01-01': + elif api_version == "2024-01-01": from .v2024_01_01.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2024-01-02-preview': + elif api_version == "2024-01-02-preview": from .v2024_01_02_preview.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2024-02-01': + elif api_version == "2024-02-01": from .v2024_02_01.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2024-02-02-preview': + elif api_version == "2024-02-02-preview": from .v2024_02_02_preview.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2024-03-02-preview': + elif api_version == "2024-03-02-preview": from .v2024_03_02_preview.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2024-04-02-preview': + elif api_version == "2024-04-02-preview": from .v2024_04_02_preview.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2024-05-01': + elif api_version == "2024-05-01": from .v2024_05_01.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2024-05-02-preview': + elif api_version == "2024-05-02-preview": from .v2024_05_02_preview.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2024-06-02-preview': + elif api_version == "2024-06-02-preview": from .v2024_06_02_preview.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2024-07-01': + elif api_version == "2024-07-01": from .v2024_07_01.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2024-07-02-preview': + elif api_version == "2024-07-02-preview": from .v2024_07_02_preview.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2024-08-01': + elif api_version == "2024-08-01": from .v2024_08_01.operations import MaintenanceConfigurationsOperations as OperationClass else: - raise ValueError("API version {} does not have operation group 'maintenance_configurations'".format(api_version)) + raise ValueError( + "API version {} does not have operation group 'maintenance_configurations'".format(api_version) + ) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) + return OperationClass( + self._client, + self._config, + Serializer(self._models_dict(api_version)), + Deserializer(self._models_dict(api_version)), + api_version, + ) @property def managed_cluster_snapshots(self): """Instance depends on the API version: - * 2022-02-02-preview: :class:`ManagedClusterSnapshotsOperations` - * 2022-03-02-preview: :class:`ManagedClusterSnapshotsOperations` - * 2022-04-02-preview: :class:`ManagedClusterSnapshotsOperations` - * 2022-05-02-preview: :class:`ManagedClusterSnapshotsOperations` - * 2022-06-02-preview: :class:`ManagedClusterSnapshotsOperations` - * 2022-07-02-preview: :class:`ManagedClusterSnapshotsOperations` - * 2022-08-02-preview: :class:`ManagedClusterSnapshotsOperations` - * 2022-08-03-preview: :class:`ManagedClusterSnapshotsOperations` - * 2022-09-02-preview: :class:`ManagedClusterSnapshotsOperations` - * 2022-10-02-preview: :class:`ManagedClusterSnapshotsOperations` - * 2022-11-02-preview: :class:`ManagedClusterSnapshotsOperations` - * 2023-01-02-preview: :class:`ManagedClusterSnapshotsOperations` - * 2023-02-02-preview: :class:`ManagedClusterSnapshotsOperations` - * 2023-03-02-preview: :class:`ManagedClusterSnapshotsOperations` - * 2023-04-02-preview: :class:`ManagedClusterSnapshotsOperations` - * 2023-05-02-preview: :class:`ManagedClusterSnapshotsOperations` - * 2023-06-02-preview: :class:`ManagedClusterSnapshotsOperations` - * 2023-07-02-preview: :class:`ManagedClusterSnapshotsOperations` - * 2023-08-02-preview: :class:`ManagedClusterSnapshotsOperations` - * 2023-09-02-preview: :class:`ManagedClusterSnapshotsOperations` - * 2023-10-02-preview: :class:`ManagedClusterSnapshotsOperations` - * 2023-11-02-preview: :class:`ManagedClusterSnapshotsOperations` - * 2024-01-02-preview: :class:`ManagedClusterSnapshotsOperations` - * 2024-02-02-preview: :class:`ManagedClusterSnapshotsOperations` - * 2024-03-02-preview: :class:`ManagedClusterSnapshotsOperations` - * 2024-04-02-preview: :class:`ManagedClusterSnapshotsOperations` - * 2024-05-02-preview: :class:`ManagedClusterSnapshotsOperations` - * 2024-06-02-preview: :class:`ManagedClusterSnapshotsOperations` - * 2024-07-02-preview: :class:`ManagedClusterSnapshotsOperations` + * 2022-02-02-preview: :class:`ManagedClusterSnapshotsOperations` + * 2022-03-02-preview: :class:`ManagedClusterSnapshotsOperations` + * 2022-04-02-preview: :class:`ManagedClusterSnapshotsOperations` + * 2022-05-02-preview: :class:`ManagedClusterSnapshotsOperations` + * 2022-06-02-preview: :class:`ManagedClusterSnapshotsOperations` + * 2022-07-02-preview: :class:`ManagedClusterSnapshotsOperations` + * 2022-08-02-preview: :class:`ManagedClusterSnapshotsOperations` + * 2022-08-03-preview: :class:`ManagedClusterSnapshotsOperations` + * 2022-09-02-preview: :class:`ManagedClusterSnapshotsOperations` + * 2022-10-02-preview: :class:`ManagedClusterSnapshotsOperations` + * 2022-11-02-preview: :class:`ManagedClusterSnapshotsOperations` + * 2023-01-02-preview: :class:`ManagedClusterSnapshotsOperations` + * 2023-02-02-preview: :class:`ManagedClusterSnapshotsOperations` + * 2023-03-02-preview: :class:`ManagedClusterSnapshotsOperations` + * 2023-04-02-preview: :class:`ManagedClusterSnapshotsOperations` + * 2023-05-02-preview: :class:`ManagedClusterSnapshotsOperations` + * 2023-06-02-preview: :class:`ManagedClusterSnapshotsOperations` + * 2023-07-02-preview: :class:`ManagedClusterSnapshotsOperations` + * 2023-08-02-preview: :class:`ManagedClusterSnapshotsOperations` + * 2023-09-02-preview: :class:`ManagedClusterSnapshotsOperations` + * 2023-10-02-preview: :class:`ManagedClusterSnapshotsOperations` + * 2023-11-02-preview: :class:`ManagedClusterSnapshotsOperations` + * 2024-01-02-preview: :class:`ManagedClusterSnapshotsOperations` + * 2024-02-02-preview: :class:`ManagedClusterSnapshotsOperations` + * 2024-03-02-preview: :class:`ManagedClusterSnapshotsOperations` + * 2024-04-02-preview: :class:`ManagedClusterSnapshotsOperations` + * 2024-05-02-preview: :class:`ManagedClusterSnapshotsOperations` + * 2024-06-02-preview: :class:`ManagedClusterSnapshotsOperations` + * 2024-07-02-preview: :class:`ManagedClusterSnapshotsOperations` """ - api_version = self._get_api_version('managed_cluster_snapshots') - if api_version == '2022-02-02-preview': + api_version = self._get_api_version("managed_cluster_snapshots") + if api_version == "2022-02-02-preview": from .v2022_02_02_preview.operations import ManagedClusterSnapshotsOperations as OperationClass - elif api_version == '2022-03-02-preview': + elif api_version == "2022-03-02-preview": from .v2022_03_02_preview.operations import ManagedClusterSnapshotsOperations as OperationClass - elif api_version == '2022-04-02-preview': + elif api_version == "2022-04-02-preview": from .v2022_04_02_preview.operations import ManagedClusterSnapshotsOperations as OperationClass - elif api_version == '2022-05-02-preview': + elif api_version == "2022-05-02-preview": from .v2022_05_02_preview.operations import ManagedClusterSnapshotsOperations as OperationClass - elif api_version == '2022-06-02-preview': + elif api_version == "2022-06-02-preview": from .v2022_06_02_preview.operations import ManagedClusterSnapshotsOperations as OperationClass - elif api_version == '2022-07-02-preview': + elif api_version == "2022-07-02-preview": from .v2022_07_02_preview.operations import ManagedClusterSnapshotsOperations as OperationClass - elif api_version == '2022-08-02-preview': + elif api_version == "2022-08-02-preview": from .v2022_08_02_preview.operations import ManagedClusterSnapshotsOperations as OperationClass - elif api_version == '2022-08-03-preview': + elif api_version == "2022-08-03-preview": from .v2022_08_03_preview.operations import ManagedClusterSnapshotsOperations as OperationClass - elif api_version == '2022-09-02-preview': + elif api_version == "2022-09-02-preview": from .v2022_09_02_preview.operations import ManagedClusterSnapshotsOperations as OperationClass - elif api_version == '2022-10-02-preview': + elif api_version == "2022-10-02-preview": from .v2022_10_02_preview.operations import ManagedClusterSnapshotsOperations as OperationClass - elif api_version == '2022-11-02-preview': + elif api_version == "2022-11-02-preview": from .v2022_11_02_preview.operations import ManagedClusterSnapshotsOperations as OperationClass - elif api_version == '2023-01-02-preview': + elif api_version == "2023-01-02-preview": from .v2023_01_02_preview.operations import ManagedClusterSnapshotsOperations as OperationClass - elif api_version == '2023-02-02-preview': + elif api_version == "2023-02-02-preview": from .v2023_02_02_preview.operations import ManagedClusterSnapshotsOperations as OperationClass - elif api_version == '2023-03-02-preview': + elif api_version == "2023-03-02-preview": from .v2023_03_02_preview.operations import ManagedClusterSnapshotsOperations as OperationClass - elif api_version == '2023-04-02-preview': + elif api_version == "2023-04-02-preview": from .v2023_04_02_preview.operations import ManagedClusterSnapshotsOperations as OperationClass - elif api_version == '2023-05-02-preview': + elif api_version == "2023-05-02-preview": from .v2023_05_02_preview.operations import ManagedClusterSnapshotsOperations as OperationClass - elif api_version == '2023-06-02-preview': + elif api_version == "2023-06-02-preview": from .v2023_06_02_preview.operations import ManagedClusterSnapshotsOperations as OperationClass - elif api_version == '2023-07-02-preview': + elif api_version == "2023-07-02-preview": from .v2023_07_02_preview.operations import ManagedClusterSnapshotsOperations as OperationClass - elif api_version == '2023-08-02-preview': + elif api_version == "2023-08-02-preview": from .v2023_08_02_preview.operations import ManagedClusterSnapshotsOperations as OperationClass - elif api_version == '2023-09-02-preview': + elif api_version == "2023-09-02-preview": from .v2023_09_02_preview.operations import ManagedClusterSnapshotsOperations as OperationClass - elif api_version == '2023-10-02-preview': + elif api_version == "2023-10-02-preview": from .v2023_10_02_preview.operations import ManagedClusterSnapshotsOperations as OperationClass - elif api_version == '2023-11-02-preview': + elif api_version == "2023-11-02-preview": from .v2023_11_02_preview.operations import ManagedClusterSnapshotsOperations as OperationClass - elif api_version == '2024-01-02-preview': + elif api_version == "2024-01-02-preview": from .v2024_01_02_preview.operations import ManagedClusterSnapshotsOperations as OperationClass - elif api_version == '2024-02-02-preview': + elif api_version == "2024-02-02-preview": from .v2024_02_02_preview.operations import ManagedClusterSnapshotsOperations as OperationClass - elif api_version == '2024-03-02-preview': + elif api_version == "2024-03-02-preview": from .v2024_03_02_preview.operations import ManagedClusterSnapshotsOperations as OperationClass - elif api_version == '2024-04-02-preview': + elif api_version == "2024-04-02-preview": from .v2024_04_02_preview.operations import ManagedClusterSnapshotsOperations as OperationClass - elif api_version == '2024-05-02-preview': + elif api_version == "2024-05-02-preview": from .v2024_05_02_preview.operations import ManagedClusterSnapshotsOperations as OperationClass - elif api_version == '2024-06-02-preview': + elif api_version == "2024-06-02-preview": from .v2024_06_02_preview.operations import ManagedClusterSnapshotsOperations as OperationClass - elif api_version == '2024-07-02-preview': + elif api_version == "2024-07-02-preview": from .v2024_07_02_preview.operations import ManagedClusterSnapshotsOperations as OperationClass else: - raise ValueError("API version {} does not have operation group 'managed_cluster_snapshots'".format(api_version)) + raise ValueError( + "API version {} does not have operation group 'managed_cluster_snapshots'".format(api_version) + ) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) + return OperationClass( + self._client, + self._config, + Serializer(self._models_dict(api_version)), + Deserializer(self._models_dict(api_version)), + api_version, + ) @property def managed_clusters(self): """Instance depends on the API version: - * 2018-03-31: :class:`ManagedClustersOperations` - * 2018-08-01-preview: :class:`ManagedClustersOperations` - * 2019-02-01: :class:`ManagedClustersOperations` - * 2019-04-01: :class:`ManagedClustersOperations` - * 2019-06-01: :class:`ManagedClustersOperations` - * 2019-08-01: :class:`ManagedClustersOperations` - * 2019-10-01: :class:`ManagedClustersOperations` - * 2019-11-01: :class:`ManagedClustersOperations` - * 2020-01-01: :class:`ManagedClustersOperations` - * 2020-02-01: :class:`ManagedClustersOperations` - * 2020-03-01: :class:`ManagedClustersOperations` - * 2020-04-01: :class:`ManagedClustersOperations` - * 2020-06-01: :class:`ManagedClustersOperations` - * 2020-07-01: :class:`ManagedClustersOperations` - * 2020-09-01: :class:`ManagedClustersOperations` - * 2020-11-01: :class:`ManagedClustersOperations` - * 2020-12-01: :class:`ManagedClustersOperations` - * 2021-02-01: :class:`ManagedClustersOperations` - * 2021-03-01: :class:`ManagedClustersOperations` - * 2021-05-01: :class:`ManagedClustersOperations` - * 2021-07-01: :class:`ManagedClustersOperations` - * 2021-08-01: :class:`ManagedClustersOperations` - * 2021-09-01: :class:`ManagedClustersOperations` - * 2021-10-01: :class:`ManagedClustersOperations` - * 2021-11-01-preview: :class:`ManagedClustersOperations` - * 2022-01-01: :class:`ManagedClustersOperations` - * 2022-01-02-preview: :class:`ManagedClustersOperations` - * 2022-02-01: :class:`ManagedClustersOperations` - * 2022-02-02-preview: :class:`ManagedClustersOperations` - * 2022-03-01: :class:`ManagedClustersOperations` - * 2022-03-02-preview: :class:`ManagedClustersOperations` - * 2022-04-01: :class:`ManagedClustersOperations` - * 2022-04-02-preview: :class:`ManagedClustersOperations` - * 2022-05-02-preview: :class:`ManagedClustersOperations` - * 2022-06-01: :class:`ManagedClustersOperations` - * 2022-06-02-preview: :class:`ManagedClustersOperations` - * 2022-07-01: :class:`ManagedClustersOperations` - * 2022-07-02-preview: :class:`ManagedClustersOperations` - * 2022-08-02-preview: :class:`ManagedClustersOperations` - * 2022-08-03-preview: :class:`ManagedClustersOperations` - * 2022-09-01: :class:`ManagedClustersOperations` - * 2022-09-02-preview: :class:`ManagedClustersOperations` - * 2022-10-02-preview: :class:`ManagedClustersOperations` - * 2022-11-01: :class:`ManagedClustersOperations` - * 2022-11-02-preview: :class:`ManagedClustersOperations` - * 2023-01-01: :class:`ManagedClustersOperations` - * 2023-01-02-preview: :class:`ManagedClustersOperations` - * 2023-02-01: :class:`ManagedClustersOperations` - * 2023-02-02-preview: :class:`ManagedClustersOperations` - * 2023-03-01: :class:`ManagedClustersOperations` - * 2023-03-02-preview: :class:`ManagedClustersOperations` - * 2023-04-01: :class:`ManagedClustersOperations` - * 2023-04-02-preview: :class:`ManagedClustersOperations` - * 2023-05-01: :class:`ManagedClustersOperations` - * 2023-05-02-preview: :class:`ManagedClustersOperations` - * 2023-06-01: :class:`ManagedClustersOperations` - * 2023-06-02-preview: :class:`ManagedClustersOperations` - * 2023-07-01: :class:`ManagedClustersOperations` - * 2023-07-02-preview: :class:`ManagedClustersOperations` - * 2023-08-01: :class:`ManagedClustersOperations` - * 2023-08-02-preview: :class:`ManagedClustersOperations` - * 2023-09-01: :class:`ManagedClustersOperations` - * 2023-09-02-preview: :class:`ManagedClustersOperations` - * 2023-10-01: :class:`ManagedClustersOperations` - * 2023-10-02-preview: :class:`ManagedClustersOperations` - * 2023-11-01: :class:`ManagedClustersOperations` - * 2023-11-02-preview: :class:`ManagedClustersOperations` - * 2024-01-01: :class:`ManagedClustersOperations` - * 2024-01-02-preview: :class:`ManagedClustersOperations` - * 2024-02-01: :class:`ManagedClustersOperations` - * 2024-02-02-preview: :class:`ManagedClustersOperations` - * 2024-03-02-preview: :class:`ManagedClustersOperations` - * 2024-04-02-preview: :class:`ManagedClustersOperations` - * 2024-05-01: :class:`ManagedClustersOperations` - * 2024-05-02-preview: :class:`ManagedClustersOperations` - * 2024-06-02-preview: :class:`ManagedClustersOperations` - * 2024-07-01: :class:`ManagedClustersOperations` - * 2024-07-02-preview: :class:`ManagedClustersOperations` - * 2024-08-01: :class:`ManagedClustersOperations` + * 2018-03-31: :class:`ManagedClustersOperations` + * 2018-08-01-preview: :class:`ManagedClustersOperations` + * 2019-02-01: :class:`ManagedClustersOperations` + * 2019-04-01: :class:`ManagedClustersOperations` + * 2019-06-01: :class:`ManagedClustersOperations` + * 2019-08-01: :class:`ManagedClustersOperations` + * 2019-10-01: :class:`ManagedClustersOperations` + * 2019-11-01: :class:`ManagedClustersOperations` + * 2020-01-01: :class:`ManagedClustersOperations` + * 2020-02-01: :class:`ManagedClustersOperations` + * 2020-03-01: :class:`ManagedClustersOperations` + * 2020-04-01: :class:`ManagedClustersOperations` + * 2020-06-01: :class:`ManagedClustersOperations` + * 2020-07-01: :class:`ManagedClustersOperations` + * 2020-09-01: :class:`ManagedClustersOperations` + * 2020-11-01: :class:`ManagedClustersOperations` + * 2020-12-01: :class:`ManagedClustersOperations` + * 2021-02-01: :class:`ManagedClustersOperations` + * 2021-03-01: :class:`ManagedClustersOperations` + * 2021-05-01: :class:`ManagedClustersOperations` + * 2021-07-01: :class:`ManagedClustersOperations` + * 2021-08-01: :class:`ManagedClustersOperations` + * 2021-09-01: :class:`ManagedClustersOperations` + * 2021-10-01: :class:`ManagedClustersOperations` + * 2021-11-01-preview: :class:`ManagedClustersOperations` + * 2022-01-01: :class:`ManagedClustersOperations` + * 2022-01-02-preview: :class:`ManagedClustersOperations` + * 2022-02-01: :class:`ManagedClustersOperations` + * 2022-02-02-preview: :class:`ManagedClustersOperations` + * 2022-03-01: :class:`ManagedClustersOperations` + * 2022-03-02-preview: :class:`ManagedClustersOperations` + * 2022-04-01: :class:`ManagedClustersOperations` + * 2022-04-02-preview: :class:`ManagedClustersOperations` + * 2022-05-02-preview: :class:`ManagedClustersOperations` + * 2022-06-01: :class:`ManagedClustersOperations` + * 2022-06-02-preview: :class:`ManagedClustersOperations` + * 2022-07-01: :class:`ManagedClustersOperations` + * 2022-07-02-preview: :class:`ManagedClustersOperations` + * 2022-08-02-preview: :class:`ManagedClustersOperations` + * 2022-08-03-preview: :class:`ManagedClustersOperations` + * 2022-09-01: :class:`ManagedClustersOperations` + * 2022-09-02-preview: :class:`ManagedClustersOperations` + * 2022-10-02-preview: :class:`ManagedClustersOperations` + * 2022-11-01: :class:`ManagedClustersOperations` + * 2022-11-02-preview: :class:`ManagedClustersOperations` + * 2023-01-01: :class:`ManagedClustersOperations` + * 2023-01-02-preview: :class:`ManagedClustersOperations` + * 2023-02-01: :class:`ManagedClustersOperations` + * 2023-02-02-preview: :class:`ManagedClustersOperations` + * 2023-03-01: :class:`ManagedClustersOperations` + * 2023-03-02-preview: :class:`ManagedClustersOperations` + * 2023-04-01: :class:`ManagedClustersOperations` + * 2023-04-02-preview: :class:`ManagedClustersOperations` + * 2023-05-01: :class:`ManagedClustersOperations` + * 2023-05-02-preview: :class:`ManagedClustersOperations` + * 2023-06-01: :class:`ManagedClustersOperations` + * 2023-06-02-preview: :class:`ManagedClustersOperations` + * 2023-07-01: :class:`ManagedClustersOperations` + * 2023-07-02-preview: :class:`ManagedClustersOperations` + * 2023-08-01: :class:`ManagedClustersOperations` + * 2023-08-02-preview: :class:`ManagedClustersOperations` + * 2023-09-01: :class:`ManagedClustersOperations` + * 2023-09-02-preview: :class:`ManagedClustersOperations` + * 2023-10-01: :class:`ManagedClustersOperations` + * 2023-10-02-preview: :class:`ManagedClustersOperations` + * 2023-11-01: :class:`ManagedClustersOperations` + * 2023-11-02-preview: :class:`ManagedClustersOperations` + * 2024-01-01: :class:`ManagedClustersOperations` + * 2024-01-02-preview: :class:`ManagedClustersOperations` + * 2024-02-01: :class:`ManagedClustersOperations` + * 2024-02-02-preview: :class:`ManagedClustersOperations` + * 2024-03-02-preview: :class:`ManagedClustersOperations` + * 2024-04-02-preview: :class:`ManagedClustersOperations` + * 2024-05-01: :class:`ManagedClustersOperations` + * 2024-05-02-preview: :class:`ManagedClustersOperations` + * 2024-06-02-preview: :class:`ManagedClustersOperations` + * 2024-07-01: :class:`ManagedClustersOperations` + * 2024-07-02-preview: :class:`ManagedClustersOperations` + * 2024-08-01: :class:`ManagedClustersOperations` """ - api_version = self._get_api_version('managed_clusters') - if api_version == '2018-03-31': + api_version = self._get_api_version("managed_clusters") + if api_version == "2018-03-31": from .v2018_03_31.operations import ManagedClustersOperations as OperationClass - elif api_version == '2018-08-01-preview': + elif api_version == "2018-08-01-preview": from .v2018_08_01_preview.operations import ManagedClustersOperations as OperationClass - elif api_version == '2019-02-01': + elif api_version == "2019-02-01": from .v2019_02_01.operations import ManagedClustersOperations as OperationClass - elif api_version == '2019-04-01': + elif api_version == "2019-04-01": from .v2019_04_01.operations import ManagedClustersOperations as OperationClass - elif api_version == '2019-06-01': + elif api_version == "2019-06-01": from .v2019_06_01.operations import ManagedClustersOperations as OperationClass - elif api_version == '2019-08-01': + elif api_version == "2019-08-01": from .v2019_08_01.operations import ManagedClustersOperations as OperationClass - elif api_version == '2019-10-01': + elif api_version == "2019-10-01": from .v2019_10_01.operations import ManagedClustersOperations as OperationClass - elif api_version == '2019-11-01': + elif api_version == "2019-11-01": from .v2019_11_01.operations import ManagedClustersOperations as OperationClass - elif api_version == '2020-01-01': + elif api_version == "2020-01-01": from .v2020_01_01.operations import ManagedClustersOperations as OperationClass - elif api_version == '2020-02-01': + elif api_version == "2020-02-01": from .v2020_02_01.operations import ManagedClustersOperations as OperationClass - elif api_version == '2020-03-01': + elif api_version == "2020-03-01": from .v2020_03_01.operations import ManagedClustersOperations as OperationClass - elif api_version == '2020-04-01': + elif api_version == "2020-04-01": from .v2020_04_01.operations import ManagedClustersOperations as OperationClass - elif api_version == '2020-06-01': + elif api_version == "2020-06-01": from .v2020_06_01.operations import ManagedClustersOperations as OperationClass - elif api_version == '2020-07-01': + elif api_version == "2020-07-01": from .v2020_07_01.operations import ManagedClustersOperations as OperationClass - elif api_version == '2020-09-01': + elif api_version == "2020-09-01": from .v2020_09_01.operations import ManagedClustersOperations as OperationClass - elif api_version == '2020-11-01': + elif api_version == "2020-11-01": from .v2020_11_01.operations import ManagedClustersOperations as OperationClass - elif api_version == '2020-12-01': + elif api_version == "2020-12-01": from .v2020_12_01.operations import ManagedClustersOperations as OperationClass - elif api_version == '2021-02-01': + elif api_version == "2021-02-01": from .v2021_02_01.operations import ManagedClustersOperations as OperationClass - elif api_version == '2021-03-01': + elif api_version == "2021-03-01": from .v2021_03_01.operations import ManagedClustersOperations as OperationClass - elif api_version == '2021-05-01': + elif api_version == "2021-05-01": from .v2021_05_01.operations import ManagedClustersOperations as OperationClass - elif api_version == '2021-07-01': + elif api_version == "2021-07-01": from .v2021_07_01.operations import ManagedClustersOperations as OperationClass - elif api_version == '2021-08-01': + elif api_version == "2021-08-01": from .v2021_08_01.operations import ManagedClustersOperations as OperationClass - elif api_version == '2021-09-01': + elif api_version == "2021-09-01": from .v2021_09_01.operations import ManagedClustersOperations as OperationClass - elif api_version == '2021-10-01': + elif api_version == "2021-10-01": from .v2021_10_01.operations import ManagedClustersOperations as OperationClass - elif api_version == '2021-11-01-preview': + elif api_version == "2021-11-01-preview": from .v2021_11_01_preview.operations import ManagedClustersOperations as OperationClass - elif api_version == '2022-01-01': + elif api_version == "2022-01-01": from .v2022_01_01.operations import ManagedClustersOperations as OperationClass - elif api_version == '2022-01-02-preview': + elif api_version == "2022-01-02-preview": from .v2022_01_02_preview.operations import ManagedClustersOperations as OperationClass - elif api_version == '2022-02-01': + elif api_version == "2022-02-01": from .v2022_02_01.operations import ManagedClustersOperations as OperationClass - elif api_version == '2022-02-02-preview': + elif api_version == "2022-02-02-preview": from .v2022_02_02_preview.operations import ManagedClustersOperations as OperationClass - elif api_version == '2022-03-01': + elif api_version == "2022-03-01": from .v2022_03_01.operations import ManagedClustersOperations as OperationClass - elif api_version == '2022-03-02-preview': + elif api_version == "2022-03-02-preview": from .v2022_03_02_preview.operations import ManagedClustersOperations as OperationClass - elif api_version == '2022-04-01': + elif api_version == "2022-04-01": from .v2022_04_01.operations import ManagedClustersOperations as OperationClass - elif api_version == '2022-04-02-preview': + elif api_version == "2022-04-02-preview": from .v2022_04_02_preview.operations import ManagedClustersOperations as OperationClass - elif api_version == '2022-05-02-preview': + elif api_version == "2022-05-02-preview": from .v2022_05_02_preview.operations import ManagedClustersOperations as OperationClass - elif api_version == '2022-06-01': + elif api_version == "2022-06-01": from .v2022_06_01.operations import ManagedClustersOperations as OperationClass - elif api_version == '2022-06-02-preview': + elif api_version == "2022-06-02-preview": from .v2022_06_02_preview.operations import ManagedClustersOperations as OperationClass - elif api_version == '2022-07-01': + elif api_version == "2022-07-01": from .v2022_07_01.operations import ManagedClustersOperations as OperationClass - elif api_version == '2022-07-02-preview': + elif api_version == "2022-07-02-preview": from .v2022_07_02_preview.operations import ManagedClustersOperations as OperationClass - elif api_version == '2022-08-02-preview': + elif api_version == "2022-08-02-preview": from .v2022_08_02_preview.operations import ManagedClustersOperations as OperationClass - elif api_version == '2022-08-03-preview': + elif api_version == "2022-08-03-preview": from .v2022_08_03_preview.operations import ManagedClustersOperations as OperationClass - elif api_version == '2022-09-01': + elif api_version == "2022-09-01": from .v2022_09_01.operations import ManagedClustersOperations as OperationClass - elif api_version == '2022-09-02-preview': + elif api_version == "2022-09-02-preview": from .v2022_09_02_preview.operations import ManagedClustersOperations as OperationClass - elif api_version == '2022-10-02-preview': + elif api_version == "2022-10-02-preview": from .v2022_10_02_preview.operations import ManagedClustersOperations as OperationClass - elif api_version == '2022-11-01': + elif api_version == "2022-11-01": from .v2022_11_01.operations import ManagedClustersOperations as OperationClass - elif api_version == '2022-11-02-preview': + elif api_version == "2022-11-02-preview": from .v2022_11_02_preview.operations import ManagedClustersOperations as OperationClass - elif api_version == '2023-01-01': + elif api_version == "2023-01-01": from .v2023_01_01.operations import ManagedClustersOperations as OperationClass - elif api_version == '2023-01-02-preview': + elif api_version == "2023-01-02-preview": from .v2023_01_02_preview.operations import ManagedClustersOperations as OperationClass - elif api_version == '2023-02-01': + elif api_version == "2023-02-01": from .v2023_02_01.operations import ManagedClustersOperations as OperationClass - elif api_version == '2023-02-02-preview': + elif api_version == "2023-02-02-preview": from .v2023_02_02_preview.operations import ManagedClustersOperations as OperationClass - elif api_version == '2023-03-01': + elif api_version == "2023-03-01": from .v2023_03_01.operations import ManagedClustersOperations as OperationClass - elif api_version == '2023-03-02-preview': + elif api_version == "2023-03-02-preview": from .v2023_03_02_preview.operations import ManagedClustersOperations as OperationClass - elif api_version == '2023-04-01': + elif api_version == "2023-04-01": from .v2023_04_01.operations import ManagedClustersOperations as OperationClass - elif api_version == '2023-04-02-preview': + elif api_version == "2023-04-02-preview": from .v2023_04_02_preview.operations import ManagedClustersOperations as OperationClass - elif api_version == '2023-05-01': + elif api_version == "2023-05-01": from .v2023_05_01.operations import ManagedClustersOperations as OperationClass - elif api_version == '2023-05-02-preview': + elif api_version == "2023-05-02-preview": from .v2023_05_02_preview.operations import ManagedClustersOperations as OperationClass - elif api_version == '2023-06-01': + elif api_version == "2023-06-01": from .v2023_06_01.operations import ManagedClustersOperations as OperationClass - elif api_version == '2023-06-02-preview': + elif api_version == "2023-06-02-preview": from .v2023_06_02_preview.operations import ManagedClustersOperations as OperationClass - elif api_version == '2023-07-01': + elif api_version == "2023-07-01": from .v2023_07_01.operations import ManagedClustersOperations as OperationClass - elif api_version == '2023-07-02-preview': + elif api_version == "2023-07-02-preview": from .v2023_07_02_preview.operations import ManagedClustersOperations as OperationClass - elif api_version == '2023-08-01': + elif api_version == "2023-08-01": from .v2023_08_01.operations import ManagedClustersOperations as OperationClass - elif api_version == '2023-08-02-preview': + elif api_version == "2023-08-02-preview": from .v2023_08_02_preview.operations import ManagedClustersOperations as OperationClass - elif api_version == '2023-09-01': + elif api_version == "2023-09-01": from .v2023_09_01.operations import ManagedClustersOperations as OperationClass - elif api_version == '2023-09-02-preview': + elif api_version == "2023-09-02-preview": from .v2023_09_02_preview.operations import ManagedClustersOperations as OperationClass - elif api_version == '2023-10-01': + elif api_version == "2023-10-01": from .v2023_10_01.operations import ManagedClustersOperations as OperationClass - elif api_version == '2023-10-02-preview': + elif api_version == "2023-10-02-preview": from .v2023_10_02_preview.operations import ManagedClustersOperations as OperationClass - elif api_version == '2023-11-01': + elif api_version == "2023-11-01": from .v2023_11_01.operations import ManagedClustersOperations as OperationClass - elif api_version == '2023-11-02-preview': + elif api_version == "2023-11-02-preview": from .v2023_11_02_preview.operations import ManagedClustersOperations as OperationClass - elif api_version == '2024-01-01': + elif api_version == "2024-01-01": from .v2024_01_01.operations import ManagedClustersOperations as OperationClass - elif api_version == '2024-01-02-preview': + elif api_version == "2024-01-02-preview": from .v2024_01_02_preview.operations import ManagedClustersOperations as OperationClass - elif api_version == '2024-02-01': + elif api_version == "2024-02-01": from .v2024_02_01.operations import ManagedClustersOperations as OperationClass - elif api_version == '2024-02-02-preview': + elif api_version == "2024-02-02-preview": from .v2024_02_02_preview.operations import ManagedClustersOperations as OperationClass - elif api_version == '2024-03-02-preview': + elif api_version == "2024-03-02-preview": from .v2024_03_02_preview.operations import ManagedClustersOperations as OperationClass - elif api_version == '2024-04-02-preview': + elif api_version == "2024-04-02-preview": from .v2024_04_02_preview.operations import ManagedClustersOperations as OperationClass - elif api_version == '2024-05-01': + elif api_version == "2024-05-01": from .v2024_05_01.operations import ManagedClustersOperations as OperationClass - elif api_version == '2024-05-02-preview': + elif api_version == "2024-05-02-preview": from .v2024_05_02_preview.operations import ManagedClustersOperations as OperationClass - elif api_version == '2024-06-02-preview': + elif api_version == "2024-06-02-preview": from .v2024_06_02_preview.operations import ManagedClustersOperations as OperationClass - elif api_version == '2024-07-01': + elif api_version == "2024-07-01": from .v2024_07_01.operations import ManagedClustersOperations as OperationClass - elif api_version == '2024-07-02-preview': + elif api_version == "2024-07-02-preview": from .v2024_07_02_preview.operations import ManagedClustersOperations as OperationClass - elif api_version == '2024-08-01': + elif api_version == "2024-08-01": from .v2024_08_01.operations import ManagedClustersOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'managed_clusters'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) + return OperationClass( + self._client, + self._config, + Serializer(self._models_dict(api_version)), + Deserializer(self._models_dict(api_version)), + api_version, + ) @property def open_shift_managed_clusters(self): """Instance depends on the API version: - * 2018-09-30-preview: :class:`OpenShiftManagedClustersOperations` - * 2019-04-30: :class:`OpenShiftManagedClustersOperations` - * 2019-09-30-preview: :class:`OpenShiftManagedClustersOperations` - * 2019-10-27-preview: :class:`OpenShiftManagedClustersOperations` + * 2018-09-30-preview: :class:`OpenShiftManagedClustersOperations` + * 2019-04-30: :class:`OpenShiftManagedClustersOperations` + * 2019-09-30-preview: :class:`OpenShiftManagedClustersOperations` + * 2019-10-27-preview: :class:`OpenShiftManagedClustersOperations` """ - api_version = self._get_api_version('open_shift_managed_clusters') - if api_version == '2018-09-30-preview': + api_version = self._get_api_version("open_shift_managed_clusters") + if api_version == "2018-09-30-preview": from .v2018_09_30_preview.operations import OpenShiftManagedClustersOperations as OperationClass - elif api_version == '2019-04-30': + elif api_version == "2019-04-30": from .v2019_04_30.operations import OpenShiftManagedClustersOperations as OperationClass - elif api_version == '2019-09-30-preview': + elif api_version == "2019-09-30-preview": from .v2019_09_30_preview.operations import OpenShiftManagedClustersOperations as OperationClass - elif api_version == '2019-10-27-preview': + elif api_version == "2019-10-27-preview": from .v2019_10_27_preview.operations import OpenShiftManagedClustersOperations as OperationClass else: - raise ValueError("API version {} does not have operation group 'open_shift_managed_clusters'".format(api_version)) + raise ValueError( + "API version {} does not have operation group 'open_shift_managed_clusters'".format(api_version) + ) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) + return OperationClass( + self._client, + self._config, + Serializer(self._models_dict(api_version)), + Deserializer(self._models_dict(api_version)), + api_version, + ) @property def operation_status_result(self): """Instance depends on the API version: - * 2023-10-02-preview: :class:`OperationStatusResultOperations` - * 2023-11-02-preview: :class:`OperationStatusResultOperations` - * 2024-01-02-preview: :class:`OperationStatusResultOperations` - * 2024-02-02-preview: :class:`OperationStatusResultOperations` - * 2024-03-02-preview: :class:`OperationStatusResultOperations` - * 2024-04-02-preview: :class:`OperationStatusResultOperations` - * 2024-05-02-preview: :class:`OperationStatusResultOperations` - * 2024-06-02-preview: :class:`OperationStatusResultOperations` - * 2024-07-02-preview: :class:`OperationStatusResultOperations` + * 2023-10-02-preview: :class:`OperationStatusResultOperations` + * 2023-11-02-preview: :class:`OperationStatusResultOperations` + * 2024-01-02-preview: :class:`OperationStatusResultOperations` + * 2024-02-02-preview: :class:`OperationStatusResultOperations` + * 2024-03-02-preview: :class:`OperationStatusResultOperations` + * 2024-04-02-preview: :class:`OperationStatusResultOperations` + * 2024-05-02-preview: :class:`OperationStatusResultOperations` + * 2024-06-02-preview: :class:`OperationStatusResultOperations` + * 2024-07-02-preview: :class:`OperationStatusResultOperations` """ - api_version = self._get_api_version('operation_status_result') - if api_version == '2023-10-02-preview': + api_version = self._get_api_version("operation_status_result") + if api_version == "2023-10-02-preview": from .v2023_10_02_preview.operations import OperationStatusResultOperations as OperationClass - elif api_version == '2023-11-02-preview': + elif api_version == "2023-11-02-preview": from .v2023_11_02_preview.operations import OperationStatusResultOperations as OperationClass - elif api_version == '2024-01-02-preview': + elif api_version == "2024-01-02-preview": from .v2024_01_02_preview.operations import OperationStatusResultOperations as OperationClass - elif api_version == '2024-02-02-preview': + elif api_version == "2024-02-02-preview": from .v2024_02_02_preview.operations import OperationStatusResultOperations as OperationClass - elif api_version == '2024-03-02-preview': + elif api_version == "2024-03-02-preview": from .v2024_03_02_preview.operations import OperationStatusResultOperations as OperationClass - elif api_version == '2024-04-02-preview': + elif api_version == "2024-04-02-preview": from .v2024_04_02_preview.operations import OperationStatusResultOperations as OperationClass - elif api_version == '2024-05-02-preview': + elif api_version == "2024-05-02-preview": from .v2024_05_02_preview.operations import OperationStatusResultOperations as OperationClass - elif api_version == '2024-06-02-preview': + elif api_version == "2024-06-02-preview": from .v2024_06_02_preview.operations import OperationStatusResultOperations as OperationClass - elif api_version == '2024-07-02-preview': + elif api_version == "2024-07-02-preview": from .v2024_07_02_preview.operations import OperationStatusResultOperations as OperationClass else: - raise ValueError("API version {} does not have operation group 'operation_status_result'".format(api_version)) + raise ValueError( + "API version {} does not have operation group 'operation_status_result'".format(api_version) + ) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) + return OperationClass( + self._client, + self._config, + Serializer(self._models_dict(api_version)), + Deserializer(self._models_dict(api_version)), + api_version, + ) @property def operations(self): """Instance depends on the API version: - * 2018-03-31: :class:`Operations` - * 2018-08-01-preview: :class:`Operations` - * 2019-02-01: :class:`Operations` - * 2019-04-01: :class:`Operations` - * 2019-06-01: :class:`Operations` - * 2019-08-01: :class:`Operations` - * 2019-10-01: :class:`Operations` - * 2019-11-01: :class:`Operations` - * 2020-01-01: :class:`Operations` - * 2020-02-01: :class:`Operations` - * 2020-03-01: :class:`Operations` - * 2020-04-01: :class:`Operations` - * 2020-06-01: :class:`Operations` - * 2020-07-01: :class:`Operations` - * 2020-09-01: :class:`Operations` - * 2020-11-01: :class:`Operations` - * 2020-12-01: :class:`Operations` - * 2021-02-01: :class:`Operations` - * 2021-03-01: :class:`Operations` - * 2021-05-01: :class:`Operations` - * 2021-07-01: :class:`Operations` - * 2021-08-01: :class:`Operations` - * 2021-09-01: :class:`Operations` - * 2021-10-01: :class:`Operations` - * 2021-11-01-preview: :class:`Operations` - * 2022-01-01: :class:`Operations` - * 2022-01-02-preview: :class:`Operations` - * 2022-02-01: :class:`Operations` - * 2022-02-02-preview: :class:`Operations` - * 2022-03-01: :class:`Operations` - * 2022-03-02-preview: :class:`Operations` - * 2022-04-01: :class:`Operations` - * 2022-04-02-preview: :class:`Operations` - * 2022-05-02-preview: :class:`Operations` - * 2022-06-01: :class:`Operations` - * 2022-06-02-preview: :class:`Operations` - * 2022-07-01: :class:`Operations` - * 2022-07-02-preview: :class:`Operations` - * 2022-08-02-preview: :class:`Operations` - * 2022-08-03-preview: :class:`Operations` - * 2022-09-01: :class:`Operations` - * 2022-09-02-preview: :class:`Operations` - * 2022-10-02-preview: :class:`Operations` - * 2022-11-01: :class:`Operations` - * 2022-11-02-preview: :class:`Operations` - * 2023-01-01: :class:`Operations` - * 2023-01-02-preview: :class:`Operations` - * 2023-02-01: :class:`Operations` - * 2023-02-02-preview: :class:`Operations` - * 2023-03-01: :class:`Operations` - * 2023-03-02-preview: :class:`Operations` - * 2023-04-01: :class:`Operations` - * 2023-04-02-preview: :class:`Operations` - * 2023-05-01: :class:`Operations` - * 2023-05-02-preview: :class:`Operations` - * 2023-06-01: :class:`Operations` - * 2023-06-02-preview: :class:`Operations` - * 2023-07-01: :class:`Operations` - * 2023-07-02-preview: :class:`Operations` - * 2023-08-01: :class:`Operations` - * 2023-08-02-preview: :class:`Operations` - * 2023-09-01: :class:`Operations` - * 2023-09-02-preview: :class:`Operations` - * 2023-10-01: :class:`Operations` - * 2023-10-02-preview: :class:`Operations` - * 2023-11-01: :class:`Operations` - * 2023-11-02-preview: :class:`Operations` - * 2024-01-01: :class:`Operations` - * 2024-01-02-preview: :class:`Operations` - * 2024-02-01: :class:`Operations` - * 2024-02-02-preview: :class:`Operations` - * 2024-03-02-preview: :class:`Operations` - * 2024-04-02-preview: :class:`Operations` - * 2024-05-01: :class:`Operations` - * 2024-05-02-preview: :class:`Operations` - * 2024-06-02-preview: :class:`Operations` - * 2024-07-01: :class:`Operations` - * 2024-07-02-preview: :class:`Operations` - * 2024-08-01: :class:`Operations` + * 2018-03-31: :class:`Operations` + * 2018-08-01-preview: :class:`Operations` + * 2019-02-01: :class:`Operations` + * 2019-04-01: :class:`Operations` + * 2019-06-01: :class:`Operations` + * 2019-08-01: :class:`Operations` + * 2019-10-01: :class:`Operations` + * 2019-11-01: :class:`Operations` + * 2020-01-01: :class:`Operations` + * 2020-02-01: :class:`Operations` + * 2020-03-01: :class:`Operations` + * 2020-04-01: :class:`Operations` + * 2020-06-01: :class:`Operations` + * 2020-07-01: :class:`Operations` + * 2020-09-01: :class:`Operations` + * 2020-11-01: :class:`Operations` + * 2020-12-01: :class:`Operations` + * 2021-02-01: :class:`Operations` + * 2021-03-01: :class:`Operations` + * 2021-05-01: :class:`Operations` + * 2021-07-01: :class:`Operations` + * 2021-08-01: :class:`Operations` + * 2021-09-01: :class:`Operations` + * 2021-10-01: :class:`Operations` + * 2021-11-01-preview: :class:`Operations` + * 2022-01-01: :class:`Operations` + * 2022-01-02-preview: :class:`Operations` + * 2022-02-01: :class:`Operations` + * 2022-02-02-preview: :class:`Operations` + * 2022-03-01: :class:`Operations` + * 2022-03-02-preview: :class:`Operations` + * 2022-04-01: :class:`Operations` + * 2022-04-02-preview: :class:`Operations` + * 2022-05-02-preview: :class:`Operations` + * 2022-06-01: :class:`Operations` + * 2022-06-02-preview: :class:`Operations` + * 2022-07-01: :class:`Operations` + * 2022-07-02-preview: :class:`Operations` + * 2022-08-02-preview: :class:`Operations` + * 2022-08-03-preview: :class:`Operations` + * 2022-09-01: :class:`Operations` + * 2022-09-02-preview: :class:`Operations` + * 2022-10-02-preview: :class:`Operations` + * 2022-11-01: :class:`Operations` + * 2022-11-02-preview: :class:`Operations` + * 2023-01-01: :class:`Operations` + * 2023-01-02-preview: :class:`Operations` + * 2023-02-01: :class:`Operations` + * 2023-02-02-preview: :class:`Operations` + * 2023-03-01: :class:`Operations` + * 2023-03-02-preview: :class:`Operations` + * 2023-04-01: :class:`Operations` + * 2023-04-02-preview: :class:`Operations` + * 2023-05-01: :class:`Operations` + * 2023-05-02-preview: :class:`Operations` + * 2023-06-01: :class:`Operations` + * 2023-06-02-preview: :class:`Operations` + * 2023-07-01: :class:`Operations` + * 2023-07-02-preview: :class:`Operations` + * 2023-08-01: :class:`Operations` + * 2023-08-02-preview: :class:`Operations` + * 2023-09-01: :class:`Operations` + * 2023-09-02-preview: :class:`Operations` + * 2023-10-01: :class:`Operations` + * 2023-10-02-preview: :class:`Operations` + * 2023-11-01: :class:`Operations` + * 2023-11-02-preview: :class:`Operations` + * 2024-01-01: :class:`Operations` + * 2024-01-02-preview: :class:`Operations` + * 2024-02-01: :class:`Operations` + * 2024-02-02-preview: :class:`Operations` + * 2024-03-02-preview: :class:`Operations` + * 2024-04-02-preview: :class:`Operations` + * 2024-05-01: :class:`Operations` + * 2024-05-02-preview: :class:`Operations` + * 2024-06-02-preview: :class:`Operations` + * 2024-07-01: :class:`Operations` + * 2024-07-02-preview: :class:`Operations` + * 2024-08-01: :class:`Operations` """ - api_version = self._get_api_version('operations') - if api_version == '2018-03-31': + api_version = self._get_api_version("operations") + if api_version == "2018-03-31": from .v2018_03_31.operations import Operations as OperationClass - elif api_version == '2018-08-01-preview': + elif api_version == "2018-08-01-preview": from .v2018_08_01_preview.operations import Operations as OperationClass - elif api_version == '2019-02-01': + elif api_version == "2019-02-01": from .v2019_02_01.operations import Operations as OperationClass - elif api_version == '2019-04-01': + elif api_version == "2019-04-01": from .v2019_04_01.operations import Operations as OperationClass - elif api_version == '2019-06-01': + elif api_version == "2019-06-01": from .v2019_06_01.operations import Operations as OperationClass - elif api_version == '2019-08-01': + elif api_version == "2019-08-01": from .v2019_08_01.operations import Operations as OperationClass - elif api_version == '2019-10-01': + elif api_version == "2019-10-01": from .v2019_10_01.operations import Operations as OperationClass - elif api_version == '2019-11-01': + elif api_version == "2019-11-01": from .v2019_11_01.operations import Operations as OperationClass - elif api_version == '2020-01-01': + elif api_version == "2020-01-01": from .v2020_01_01.operations import Operations as OperationClass - elif api_version == '2020-02-01': + elif api_version == "2020-02-01": from .v2020_02_01.operations import Operations as OperationClass - elif api_version == '2020-03-01': + elif api_version == "2020-03-01": from .v2020_03_01.operations import Operations as OperationClass - elif api_version == '2020-04-01': + elif api_version == "2020-04-01": from .v2020_04_01.operations import Operations as OperationClass - elif api_version == '2020-06-01': + elif api_version == "2020-06-01": from .v2020_06_01.operations import Operations as OperationClass - elif api_version == '2020-07-01': + elif api_version == "2020-07-01": from .v2020_07_01.operations import Operations as OperationClass - elif api_version == '2020-09-01': + elif api_version == "2020-09-01": from .v2020_09_01.operations import Operations as OperationClass - elif api_version == '2020-11-01': + elif api_version == "2020-11-01": from .v2020_11_01.operations import Operations as OperationClass - elif api_version == '2020-12-01': + elif api_version == "2020-12-01": from .v2020_12_01.operations import Operations as OperationClass - elif api_version == '2021-02-01': + elif api_version == "2021-02-01": from .v2021_02_01.operations import Operations as OperationClass - elif api_version == '2021-03-01': + elif api_version == "2021-03-01": from .v2021_03_01.operations import Operations as OperationClass - elif api_version == '2021-05-01': + elif api_version == "2021-05-01": from .v2021_05_01.operations import Operations as OperationClass - elif api_version == '2021-07-01': + elif api_version == "2021-07-01": from .v2021_07_01.operations import Operations as OperationClass - elif api_version == '2021-08-01': + elif api_version == "2021-08-01": from .v2021_08_01.operations import Operations as OperationClass - elif api_version == '2021-09-01': + elif api_version == "2021-09-01": from .v2021_09_01.operations import Operations as OperationClass - elif api_version == '2021-10-01': + elif api_version == "2021-10-01": from .v2021_10_01.operations import Operations as OperationClass - elif api_version == '2021-11-01-preview': + elif api_version == "2021-11-01-preview": from .v2021_11_01_preview.operations import Operations as OperationClass - elif api_version == '2022-01-01': + elif api_version == "2022-01-01": from .v2022_01_01.operations import Operations as OperationClass - elif api_version == '2022-01-02-preview': + elif api_version == "2022-01-02-preview": from .v2022_01_02_preview.operations import Operations as OperationClass - elif api_version == '2022-02-01': + elif api_version == "2022-02-01": from .v2022_02_01.operations import Operations as OperationClass - elif api_version == '2022-02-02-preview': + elif api_version == "2022-02-02-preview": from .v2022_02_02_preview.operations import Operations as OperationClass - elif api_version == '2022-03-01': + elif api_version == "2022-03-01": from .v2022_03_01.operations import Operations as OperationClass - elif api_version == '2022-03-02-preview': + elif api_version == "2022-03-02-preview": from .v2022_03_02_preview.operations import Operations as OperationClass - elif api_version == '2022-04-01': + elif api_version == "2022-04-01": from .v2022_04_01.operations import Operations as OperationClass - elif api_version == '2022-04-02-preview': + elif api_version == "2022-04-02-preview": from .v2022_04_02_preview.operations import Operations as OperationClass - elif api_version == '2022-05-02-preview': + elif api_version == "2022-05-02-preview": from .v2022_05_02_preview.operations import Operations as OperationClass - elif api_version == '2022-06-01': + elif api_version == "2022-06-01": from .v2022_06_01.operations import Operations as OperationClass - elif api_version == '2022-06-02-preview': + elif api_version == "2022-06-02-preview": from .v2022_06_02_preview.operations import Operations as OperationClass - elif api_version == '2022-07-01': + elif api_version == "2022-07-01": from .v2022_07_01.operations import Operations as OperationClass - elif api_version == '2022-07-02-preview': + elif api_version == "2022-07-02-preview": from .v2022_07_02_preview.operations import Operations as OperationClass - elif api_version == '2022-08-02-preview': + elif api_version == "2022-08-02-preview": from .v2022_08_02_preview.operations import Operations as OperationClass - elif api_version == '2022-08-03-preview': + elif api_version == "2022-08-03-preview": from .v2022_08_03_preview.operations import Operations as OperationClass - elif api_version == '2022-09-01': + elif api_version == "2022-09-01": from .v2022_09_01.operations import Operations as OperationClass - elif api_version == '2022-09-02-preview': + elif api_version == "2022-09-02-preview": from .v2022_09_02_preview.operations import Operations as OperationClass - elif api_version == '2022-10-02-preview': + elif api_version == "2022-10-02-preview": from .v2022_10_02_preview.operations import Operations as OperationClass - elif api_version == '2022-11-01': + elif api_version == "2022-11-01": from .v2022_11_01.operations import Operations as OperationClass - elif api_version == '2022-11-02-preview': + elif api_version == "2022-11-02-preview": from .v2022_11_02_preview.operations import Operations as OperationClass - elif api_version == '2023-01-01': + elif api_version == "2023-01-01": from .v2023_01_01.operations import Operations as OperationClass - elif api_version == '2023-01-02-preview': + elif api_version == "2023-01-02-preview": from .v2023_01_02_preview.operations import Operations as OperationClass - elif api_version == '2023-02-01': + elif api_version == "2023-02-01": from .v2023_02_01.operations import Operations as OperationClass - elif api_version == '2023-02-02-preview': + elif api_version == "2023-02-02-preview": from .v2023_02_02_preview.operations import Operations as OperationClass - elif api_version == '2023-03-01': + elif api_version == "2023-03-01": from .v2023_03_01.operations import Operations as OperationClass - elif api_version == '2023-03-02-preview': + elif api_version == "2023-03-02-preview": from .v2023_03_02_preview.operations import Operations as OperationClass - elif api_version == '2023-04-01': + elif api_version == "2023-04-01": from .v2023_04_01.operations import Operations as OperationClass - elif api_version == '2023-04-02-preview': + elif api_version == "2023-04-02-preview": from .v2023_04_02_preview.operations import Operations as OperationClass - elif api_version == '2023-05-01': + elif api_version == "2023-05-01": from .v2023_05_01.operations import Operations as OperationClass - elif api_version == '2023-05-02-preview': + elif api_version == "2023-05-02-preview": from .v2023_05_02_preview.operations import Operations as OperationClass - elif api_version == '2023-06-01': + elif api_version == "2023-06-01": from .v2023_06_01.operations import Operations as OperationClass - elif api_version == '2023-06-02-preview': + elif api_version == "2023-06-02-preview": from .v2023_06_02_preview.operations import Operations as OperationClass - elif api_version == '2023-07-01': + elif api_version == "2023-07-01": from .v2023_07_01.operations import Operations as OperationClass - elif api_version == '2023-07-02-preview': + elif api_version == "2023-07-02-preview": from .v2023_07_02_preview.operations import Operations as OperationClass - elif api_version == '2023-08-01': + elif api_version == "2023-08-01": from .v2023_08_01.operations import Operations as OperationClass - elif api_version == '2023-08-02-preview': + elif api_version == "2023-08-02-preview": from .v2023_08_02_preview.operations import Operations as OperationClass - elif api_version == '2023-09-01': + elif api_version == "2023-09-01": from .v2023_09_01.operations import Operations as OperationClass - elif api_version == '2023-09-02-preview': + elif api_version == "2023-09-02-preview": from .v2023_09_02_preview.operations import Operations as OperationClass - elif api_version == '2023-10-01': + elif api_version == "2023-10-01": from .v2023_10_01.operations import Operations as OperationClass - elif api_version == '2023-10-02-preview': + elif api_version == "2023-10-02-preview": from .v2023_10_02_preview.operations import Operations as OperationClass - elif api_version == '2023-11-01': + elif api_version == "2023-11-01": from .v2023_11_01.operations import Operations as OperationClass - elif api_version == '2023-11-02-preview': + elif api_version == "2023-11-02-preview": from .v2023_11_02_preview.operations import Operations as OperationClass - elif api_version == '2024-01-01': + elif api_version == "2024-01-01": from .v2024_01_01.operations import Operations as OperationClass - elif api_version == '2024-01-02-preview': + elif api_version == "2024-01-02-preview": from .v2024_01_02_preview.operations import Operations as OperationClass - elif api_version == '2024-02-01': + elif api_version == "2024-02-01": from .v2024_02_01.operations import Operations as OperationClass - elif api_version == '2024-02-02-preview': + elif api_version == "2024-02-02-preview": from .v2024_02_02_preview.operations import Operations as OperationClass - elif api_version == '2024-03-02-preview': + elif api_version == "2024-03-02-preview": from .v2024_03_02_preview.operations import Operations as OperationClass - elif api_version == '2024-04-02-preview': + elif api_version == "2024-04-02-preview": from .v2024_04_02_preview.operations import Operations as OperationClass - elif api_version == '2024-05-01': + elif api_version == "2024-05-01": from .v2024_05_01.operations import Operations as OperationClass - elif api_version == '2024-05-02-preview': + elif api_version == "2024-05-02-preview": from .v2024_05_02_preview.operations import Operations as OperationClass - elif api_version == '2024-06-02-preview': + elif api_version == "2024-06-02-preview": from .v2024_06_02_preview.operations import Operations as OperationClass - elif api_version == '2024-07-01': + elif api_version == "2024-07-01": from .v2024_07_01.operations import Operations as OperationClass - elif api_version == '2024-07-02-preview': + elif api_version == "2024-07-02-preview": from .v2024_07_02_preview.operations import Operations as OperationClass - elif api_version == '2024-08-01': + elif api_version == "2024-08-01": from .v2024_08_01.operations import Operations as OperationClass else: raise ValueError("API version {} does not have operation group 'operations'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) + return OperationClass( + self._client, + self._config, + Serializer(self._models_dict(api_version)), + Deserializer(self._models_dict(api_version)), + api_version, + ) @property def private_endpoint_connections(self): """Instance depends on the API version: - * 2020-06-01: :class:`PrivateEndpointConnectionsOperations` - * 2020-07-01: :class:`PrivateEndpointConnectionsOperations` - * 2020-09-01: :class:`PrivateEndpointConnectionsOperations` - * 2020-11-01: :class:`PrivateEndpointConnectionsOperations` - * 2020-12-01: :class:`PrivateEndpointConnectionsOperations` - * 2021-02-01: :class:`PrivateEndpointConnectionsOperations` - * 2021-03-01: :class:`PrivateEndpointConnectionsOperations` - * 2021-05-01: :class:`PrivateEndpointConnectionsOperations` - * 2021-07-01: :class:`PrivateEndpointConnectionsOperations` - * 2021-08-01: :class:`PrivateEndpointConnectionsOperations` - * 2021-09-01: :class:`PrivateEndpointConnectionsOperations` - * 2021-10-01: :class:`PrivateEndpointConnectionsOperations` - * 2021-11-01-preview: :class:`PrivateEndpointConnectionsOperations` - * 2022-01-01: :class:`PrivateEndpointConnectionsOperations` - * 2022-01-02-preview: :class:`PrivateEndpointConnectionsOperations` - * 2022-02-01: :class:`PrivateEndpointConnectionsOperations` - * 2022-02-02-preview: :class:`PrivateEndpointConnectionsOperations` - * 2022-03-01: :class:`PrivateEndpointConnectionsOperations` - * 2022-03-02-preview: :class:`PrivateEndpointConnectionsOperations` - * 2022-04-01: :class:`PrivateEndpointConnectionsOperations` - * 2022-04-02-preview: :class:`PrivateEndpointConnectionsOperations` - * 2022-05-02-preview: :class:`PrivateEndpointConnectionsOperations` - * 2022-06-01: :class:`PrivateEndpointConnectionsOperations` - * 2022-06-02-preview: :class:`PrivateEndpointConnectionsOperations` - * 2022-07-01: :class:`PrivateEndpointConnectionsOperations` - * 2022-07-02-preview: :class:`PrivateEndpointConnectionsOperations` - * 2022-08-02-preview: :class:`PrivateEndpointConnectionsOperations` - * 2022-08-03-preview: :class:`PrivateEndpointConnectionsOperations` - * 2022-09-01: :class:`PrivateEndpointConnectionsOperations` - * 2022-09-02-preview: :class:`PrivateEndpointConnectionsOperations` - * 2022-10-02-preview: :class:`PrivateEndpointConnectionsOperations` - * 2022-11-01: :class:`PrivateEndpointConnectionsOperations` - * 2022-11-02-preview: :class:`PrivateEndpointConnectionsOperations` - * 2023-01-01: :class:`PrivateEndpointConnectionsOperations` - * 2023-01-02-preview: :class:`PrivateEndpointConnectionsOperations` - * 2023-02-01: :class:`PrivateEndpointConnectionsOperations` - * 2023-02-02-preview: :class:`PrivateEndpointConnectionsOperations` - * 2023-03-01: :class:`PrivateEndpointConnectionsOperations` - * 2023-03-02-preview: :class:`PrivateEndpointConnectionsOperations` - * 2023-04-01: :class:`PrivateEndpointConnectionsOperations` - * 2023-04-02-preview: :class:`PrivateEndpointConnectionsOperations` - * 2023-05-01: :class:`PrivateEndpointConnectionsOperations` - * 2023-05-02-preview: :class:`PrivateEndpointConnectionsOperations` - * 2023-06-01: :class:`PrivateEndpointConnectionsOperations` - * 2023-06-02-preview: :class:`PrivateEndpointConnectionsOperations` - * 2023-07-01: :class:`PrivateEndpointConnectionsOperations` - * 2023-07-02-preview: :class:`PrivateEndpointConnectionsOperations` - * 2023-08-01: :class:`PrivateEndpointConnectionsOperations` - * 2023-08-02-preview: :class:`PrivateEndpointConnectionsOperations` - * 2023-09-01: :class:`PrivateEndpointConnectionsOperations` - * 2023-09-02-preview: :class:`PrivateEndpointConnectionsOperations` - * 2023-10-01: :class:`PrivateEndpointConnectionsOperations` - * 2023-10-02-preview: :class:`PrivateEndpointConnectionsOperations` - * 2023-11-01: :class:`PrivateEndpointConnectionsOperations` - * 2023-11-02-preview: :class:`PrivateEndpointConnectionsOperations` - * 2024-01-01: :class:`PrivateEndpointConnectionsOperations` - * 2024-01-02-preview: :class:`PrivateEndpointConnectionsOperations` - * 2024-02-01: :class:`PrivateEndpointConnectionsOperations` - * 2024-02-02-preview: :class:`PrivateEndpointConnectionsOperations` - * 2024-03-02-preview: :class:`PrivateEndpointConnectionsOperations` - * 2024-04-02-preview: :class:`PrivateEndpointConnectionsOperations` - * 2024-05-01: :class:`PrivateEndpointConnectionsOperations` - * 2024-05-02-preview: :class:`PrivateEndpointConnectionsOperations` - * 2024-06-02-preview: :class:`PrivateEndpointConnectionsOperations` - * 2024-07-01: :class:`PrivateEndpointConnectionsOperations` - * 2024-07-02-preview: :class:`PrivateEndpointConnectionsOperations` - * 2024-08-01: :class:`PrivateEndpointConnectionsOperations` + * 2020-06-01: :class:`PrivateEndpointConnectionsOperations` + * 2020-07-01: :class:`PrivateEndpointConnectionsOperations` + * 2020-09-01: :class:`PrivateEndpointConnectionsOperations` + * 2020-11-01: :class:`PrivateEndpointConnectionsOperations` + * 2020-12-01: :class:`PrivateEndpointConnectionsOperations` + * 2021-02-01: :class:`PrivateEndpointConnectionsOperations` + * 2021-03-01: :class:`PrivateEndpointConnectionsOperations` + * 2021-05-01: :class:`PrivateEndpointConnectionsOperations` + * 2021-07-01: :class:`PrivateEndpointConnectionsOperations` + * 2021-08-01: :class:`PrivateEndpointConnectionsOperations` + * 2021-09-01: :class:`PrivateEndpointConnectionsOperations` + * 2021-10-01: :class:`PrivateEndpointConnectionsOperations` + * 2021-11-01-preview: :class:`PrivateEndpointConnectionsOperations` + * 2022-01-01: :class:`PrivateEndpointConnectionsOperations` + * 2022-01-02-preview: :class:`PrivateEndpointConnectionsOperations` + * 2022-02-01: :class:`PrivateEndpointConnectionsOperations` + * 2022-02-02-preview: :class:`PrivateEndpointConnectionsOperations` + * 2022-03-01: :class:`PrivateEndpointConnectionsOperations` + * 2022-03-02-preview: :class:`PrivateEndpointConnectionsOperations` + * 2022-04-01: :class:`PrivateEndpointConnectionsOperations` + * 2022-04-02-preview: :class:`PrivateEndpointConnectionsOperations` + * 2022-05-02-preview: :class:`PrivateEndpointConnectionsOperations` + * 2022-06-01: :class:`PrivateEndpointConnectionsOperations` + * 2022-06-02-preview: :class:`PrivateEndpointConnectionsOperations` + * 2022-07-01: :class:`PrivateEndpointConnectionsOperations` + * 2022-07-02-preview: :class:`PrivateEndpointConnectionsOperations` + * 2022-08-02-preview: :class:`PrivateEndpointConnectionsOperations` + * 2022-08-03-preview: :class:`PrivateEndpointConnectionsOperations` + * 2022-09-01: :class:`PrivateEndpointConnectionsOperations` + * 2022-09-02-preview: :class:`PrivateEndpointConnectionsOperations` + * 2022-10-02-preview: :class:`PrivateEndpointConnectionsOperations` + * 2022-11-01: :class:`PrivateEndpointConnectionsOperations` + * 2022-11-02-preview: :class:`PrivateEndpointConnectionsOperations` + * 2023-01-01: :class:`PrivateEndpointConnectionsOperations` + * 2023-01-02-preview: :class:`PrivateEndpointConnectionsOperations` + * 2023-02-01: :class:`PrivateEndpointConnectionsOperations` + * 2023-02-02-preview: :class:`PrivateEndpointConnectionsOperations` + * 2023-03-01: :class:`PrivateEndpointConnectionsOperations` + * 2023-03-02-preview: :class:`PrivateEndpointConnectionsOperations` + * 2023-04-01: :class:`PrivateEndpointConnectionsOperations` + * 2023-04-02-preview: :class:`PrivateEndpointConnectionsOperations` + * 2023-05-01: :class:`PrivateEndpointConnectionsOperations` + * 2023-05-02-preview: :class:`PrivateEndpointConnectionsOperations` + * 2023-06-01: :class:`PrivateEndpointConnectionsOperations` + * 2023-06-02-preview: :class:`PrivateEndpointConnectionsOperations` + * 2023-07-01: :class:`PrivateEndpointConnectionsOperations` + * 2023-07-02-preview: :class:`PrivateEndpointConnectionsOperations` + * 2023-08-01: :class:`PrivateEndpointConnectionsOperations` + * 2023-08-02-preview: :class:`PrivateEndpointConnectionsOperations` + * 2023-09-01: :class:`PrivateEndpointConnectionsOperations` + * 2023-09-02-preview: :class:`PrivateEndpointConnectionsOperations` + * 2023-10-01: :class:`PrivateEndpointConnectionsOperations` + * 2023-10-02-preview: :class:`PrivateEndpointConnectionsOperations` + * 2023-11-01: :class:`PrivateEndpointConnectionsOperations` + * 2023-11-02-preview: :class:`PrivateEndpointConnectionsOperations` + * 2024-01-01: :class:`PrivateEndpointConnectionsOperations` + * 2024-01-02-preview: :class:`PrivateEndpointConnectionsOperations` + * 2024-02-01: :class:`PrivateEndpointConnectionsOperations` + * 2024-02-02-preview: :class:`PrivateEndpointConnectionsOperations` + * 2024-03-02-preview: :class:`PrivateEndpointConnectionsOperations` + * 2024-04-02-preview: :class:`PrivateEndpointConnectionsOperations` + * 2024-05-01: :class:`PrivateEndpointConnectionsOperations` + * 2024-05-02-preview: :class:`PrivateEndpointConnectionsOperations` + * 2024-06-02-preview: :class:`PrivateEndpointConnectionsOperations` + * 2024-07-01: :class:`PrivateEndpointConnectionsOperations` + * 2024-07-02-preview: :class:`PrivateEndpointConnectionsOperations` + * 2024-08-01: :class:`PrivateEndpointConnectionsOperations` """ - api_version = self._get_api_version('private_endpoint_connections') - if api_version == '2020-06-01': + api_version = self._get_api_version("private_endpoint_connections") + if api_version == "2020-06-01": from .v2020_06_01.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2020-07-01': + elif api_version == "2020-07-01": from .v2020_07_01.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2020-09-01': + elif api_version == "2020-09-01": from .v2020_09_01.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2020-11-01': + elif api_version == "2020-11-01": from .v2020_11_01.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2020-12-01': + elif api_version == "2020-12-01": from .v2020_12_01.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2021-02-01': + elif api_version == "2021-02-01": from .v2021_02_01.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2021-03-01': + elif api_version == "2021-03-01": from .v2021_03_01.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2021-05-01': + elif api_version == "2021-05-01": from .v2021_05_01.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2021-07-01': + elif api_version == "2021-07-01": from .v2021_07_01.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2021-08-01': + elif api_version == "2021-08-01": from .v2021_08_01.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2021-09-01': + elif api_version == "2021-09-01": from .v2021_09_01.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2021-10-01': + elif api_version == "2021-10-01": from .v2021_10_01.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2021-11-01-preview': + elif api_version == "2021-11-01-preview": from .v2021_11_01_preview.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2022-01-01': + elif api_version == "2022-01-01": from .v2022_01_01.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2022-01-02-preview': + elif api_version == "2022-01-02-preview": from .v2022_01_02_preview.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2022-02-01': + elif api_version == "2022-02-01": from .v2022_02_01.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2022-02-02-preview': + elif api_version == "2022-02-02-preview": from .v2022_02_02_preview.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2022-03-01': + elif api_version == "2022-03-01": from .v2022_03_01.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2022-03-02-preview': + elif api_version == "2022-03-02-preview": from .v2022_03_02_preview.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2022-04-01': + elif api_version == "2022-04-01": from .v2022_04_01.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2022-04-02-preview': + elif api_version == "2022-04-02-preview": from .v2022_04_02_preview.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2022-05-02-preview': + elif api_version == "2022-05-02-preview": from .v2022_05_02_preview.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2022-06-01': + elif api_version == "2022-06-01": from .v2022_06_01.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2022-06-02-preview': + elif api_version == "2022-06-02-preview": from .v2022_06_02_preview.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2022-07-01': + elif api_version == "2022-07-01": from .v2022_07_01.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2022-07-02-preview': + elif api_version == "2022-07-02-preview": from .v2022_07_02_preview.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2022-08-02-preview': + elif api_version == "2022-08-02-preview": from .v2022_08_02_preview.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2022-08-03-preview': + elif api_version == "2022-08-03-preview": from .v2022_08_03_preview.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2022-09-01': + elif api_version == "2022-09-01": from .v2022_09_01.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2022-09-02-preview': + elif api_version == "2022-09-02-preview": from .v2022_09_02_preview.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2022-10-02-preview': + elif api_version == "2022-10-02-preview": from .v2022_10_02_preview.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2022-11-01': + elif api_version == "2022-11-01": from .v2022_11_01.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2022-11-02-preview': + elif api_version == "2022-11-02-preview": from .v2022_11_02_preview.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2023-01-01': + elif api_version == "2023-01-01": from .v2023_01_01.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2023-01-02-preview': + elif api_version == "2023-01-02-preview": from .v2023_01_02_preview.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2023-02-01': + elif api_version == "2023-02-01": from .v2023_02_01.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2023-02-02-preview': + elif api_version == "2023-02-02-preview": from .v2023_02_02_preview.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2023-03-01': + elif api_version == "2023-03-01": from .v2023_03_01.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2023-03-02-preview': + elif api_version == "2023-03-02-preview": from .v2023_03_02_preview.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2023-04-01': + elif api_version == "2023-04-01": from .v2023_04_01.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2023-04-02-preview': + elif api_version == "2023-04-02-preview": from .v2023_04_02_preview.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2023-05-01': + elif api_version == "2023-05-01": from .v2023_05_01.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2023-05-02-preview': + elif api_version == "2023-05-02-preview": from .v2023_05_02_preview.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2023-06-01': + elif api_version == "2023-06-01": from .v2023_06_01.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2023-06-02-preview': + elif api_version == "2023-06-02-preview": from .v2023_06_02_preview.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2023-07-01': + elif api_version == "2023-07-01": from .v2023_07_01.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2023-07-02-preview': + elif api_version == "2023-07-02-preview": from .v2023_07_02_preview.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2023-08-01': + elif api_version == "2023-08-01": from .v2023_08_01.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2023-08-02-preview': + elif api_version == "2023-08-02-preview": from .v2023_08_02_preview.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2023-09-01': + elif api_version == "2023-09-01": from .v2023_09_01.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2023-09-02-preview': + elif api_version == "2023-09-02-preview": from .v2023_09_02_preview.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2023-10-01': + elif api_version == "2023-10-01": from .v2023_10_01.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2023-10-02-preview': + elif api_version == "2023-10-02-preview": from .v2023_10_02_preview.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2023-11-01': + elif api_version == "2023-11-01": from .v2023_11_01.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2023-11-02-preview': + elif api_version == "2023-11-02-preview": from .v2023_11_02_preview.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2024-01-01': + elif api_version == "2024-01-01": from .v2024_01_01.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2024-01-02-preview': + elif api_version == "2024-01-02-preview": from .v2024_01_02_preview.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2024-02-01': + elif api_version == "2024-02-01": from .v2024_02_01.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2024-02-02-preview': + elif api_version == "2024-02-02-preview": from .v2024_02_02_preview.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2024-03-02-preview': + elif api_version == "2024-03-02-preview": from .v2024_03_02_preview.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2024-04-02-preview': + elif api_version == "2024-04-02-preview": from .v2024_04_02_preview.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2024-05-01': + elif api_version == "2024-05-01": from .v2024_05_01.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2024-05-02-preview': + elif api_version == "2024-05-02-preview": from .v2024_05_02_preview.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2024-06-02-preview': + elif api_version == "2024-06-02-preview": from .v2024_06_02_preview.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2024-07-01': + elif api_version == "2024-07-01": from .v2024_07_01.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2024-07-02-preview': + elif api_version == "2024-07-02-preview": from .v2024_07_02_preview.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2024-08-01': + elif api_version == "2024-08-01": from .v2024_08_01.operations import PrivateEndpointConnectionsOperations as OperationClass else: - raise ValueError("API version {} does not have operation group 'private_endpoint_connections'".format(api_version)) + raise ValueError( + "API version {} does not have operation group 'private_endpoint_connections'".format(api_version) + ) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) + return OperationClass( + self._client, + self._config, + Serializer(self._models_dict(api_version)), + Deserializer(self._models_dict(api_version)), + api_version, + ) @property def private_link_resources(self): """Instance depends on the API version: - * 2020-09-01: :class:`PrivateLinkResourcesOperations` - * 2020-11-01: :class:`PrivateLinkResourcesOperations` - * 2020-12-01: :class:`PrivateLinkResourcesOperations` - * 2021-02-01: :class:`PrivateLinkResourcesOperations` - * 2021-03-01: :class:`PrivateLinkResourcesOperations` - * 2021-05-01: :class:`PrivateLinkResourcesOperations` - * 2021-07-01: :class:`PrivateLinkResourcesOperations` - * 2021-08-01: :class:`PrivateLinkResourcesOperations` - * 2021-09-01: :class:`PrivateLinkResourcesOperations` - * 2021-10-01: :class:`PrivateLinkResourcesOperations` - * 2021-11-01-preview: :class:`PrivateLinkResourcesOperations` - * 2022-01-01: :class:`PrivateLinkResourcesOperations` - * 2022-01-02-preview: :class:`PrivateLinkResourcesOperations` - * 2022-02-01: :class:`PrivateLinkResourcesOperations` - * 2022-02-02-preview: :class:`PrivateLinkResourcesOperations` - * 2022-03-01: :class:`PrivateLinkResourcesOperations` - * 2022-03-02-preview: :class:`PrivateLinkResourcesOperations` - * 2022-04-01: :class:`PrivateLinkResourcesOperations` - * 2022-04-02-preview: :class:`PrivateLinkResourcesOperations` - * 2022-05-02-preview: :class:`PrivateLinkResourcesOperations` - * 2022-06-01: :class:`PrivateLinkResourcesOperations` - * 2022-06-02-preview: :class:`PrivateLinkResourcesOperations` - * 2022-07-01: :class:`PrivateLinkResourcesOperations` - * 2022-07-02-preview: :class:`PrivateLinkResourcesOperations` - * 2022-08-02-preview: :class:`PrivateLinkResourcesOperations` - * 2022-08-03-preview: :class:`PrivateLinkResourcesOperations` - * 2022-09-01: :class:`PrivateLinkResourcesOperations` - * 2022-09-02-preview: :class:`PrivateLinkResourcesOperations` - * 2022-10-02-preview: :class:`PrivateLinkResourcesOperations` - * 2022-11-01: :class:`PrivateLinkResourcesOperations` - * 2022-11-02-preview: :class:`PrivateLinkResourcesOperations` - * 2023-01-01: :class:`PrivateLinkResourcesOperations` - * 2023-01-02-preview: :class:`PrivateLinkResourcesOperations` - * 2023-02-01: :class:`PrivateLinkResourcesOperations` - * 2023-02-02-preview: :class:`PrivateLinkResourcesOperations` - * 2023-03-01: :class:`PrivateLinkResourcesOperations` - * 2023-03-02-preview: :class:`PrivateLinkResourcesOperations` - * 2023-04-01: :class:`PrivateLinkResourcesOperations` - * 2023-04-02-preview: :class:`PrivateLinkResourcesOperations` - * 2023-05-01: :class:`PrivateLinkResourcesOperations` - * 2023-05-02-preview: :class:`PrivateLinkResourcesOperations` - * 2023-06-01: :class:`PrivateLinkResourcesOperations` - * 2023-06-02-preview: :class:`PrivateLinkResourcesOperations` - * 2023-07-01: :class:`PrivateLinkResourcesOperations` - * 2023-07-02-preview: :class:`PrivateLinkResourcesOperations` - * 2023-08-01: :class:`PrivateLinkResourcesOperations` - * 2023-08-02-preview: :class:`PrivateLinkResourcesOperations` - * 2023-09-01: :class:`PrivateLinkResourcesOperations` - * 2023-09-02-preview: :class:`PrivateLinkResourcesOperations` - * 2023-10-01: :class:`PrivateLinkResourcesOperations` - * 2023-10-02-preview: :class:`PrivateLinkResourcesOperations` - * 2023-11-01: :class:`PrivateLinkResourcesOperations` - * 2023-11-02-preview: :class:`PrivateLinkResourcesOperations` - * 2024-01-01: :class:`PrivateLinkResourcesOperations` - * 2024-01-02-preview: :class:`PrivateLinkResourcesOperations` - * 2024-02-01: :class:`PrivateLinkResourcesOperations` - * 2024-02-02-preview: :class:`PrivateLinkResourcesOperations` - * 2024-03-02-preview: :class:`PrivateLinkResourcesOperations` - * 2024-04-02-preview: :class:`PrivateLinkResourcesOperations` - * 2024-05-01: :class:`PrivateLinkResourcesOperations` - * 2024-05-02-preview: :class:`PrivateLinkResourcesOperations` - * 2024-06-02-preview: :class:`PrivateLinkResourcesOperations` - * 2024-07-01: :class:`PrivateLinkResourcesOperations` - * 2024-07-02-preview: :class:`PrivateLinkResourcesOperations` - * 2024-08-01: :class:`PrivateLinkResourcesOperations` + * 2020-09-01: :class:`PrivateLinkResourcesOperations` + * 2020-11-01: :class:`PrivateLinkResourcesOperations` + * 2020-12-01: :class:`PrivateLinkResourcesOperations` + * 2021-02-01: :class:`PrivateLinkResourcesOperations` + * 2021-03-01: :class:`PrivateLinkResourcesOperations` + * 2021-05-01: :class:`PrivateLinkResourcesOperations` + * 2021-07-01: :class:`PrivateLinkResourcesOperations` + * 2021-08-01: :class:`PrivateLinkResourcesOperations` + * 2021-09-01: :class:`PrivateLinkResourcesOperations` + * 2021-10-01: :class:`PrivateLinkResourcesOperations` + * 2021-11-01-preview: :class:`PrivateLinkResourcesOperations` + * 2022-01-01: :class:`PrivateLinkResourcesOperations` + * 2022-01-02-preview: :class:`PrivateLinkResourcesOperations` + * 2022-02-01: :class:`PrivateLinkResourcesOperations` + * 2022-02-02-preview: :class:`PrivateLinkResourcesOperations` + * 2022-03-01: :class:`PrivateLinkResourcesOperations` + * 2022-03-02-preview: :class:`PrivateLinkResourcesOperations` + * 2022-04-01: :class:`PrivateLinkResourcesOperations` + * 2022-04-02-preview: :class:`PrivateLinkResourcesOperations` + * 2022-05-02-preview: :class:`PrivateLinkResourcesOperations` + * 2022-06-01: :class:`PrivateLinkResourcesOperations` + * 2022-06-02-preview: :class:`PrivateLinkResourcesOperations` + * 2022-07-01: :class:`PrivateLinkResourcesOperations` + * 2022-07-02-preview: :class:`PrivateLinkResourcesOperations` + * 2022-08-02-preview: :class:`PrivateLinkResourcesOperations` + * 2022-08-03-preview: :class:`PrivateLinkResourcesOperations` + * 2022-09-01: :class:`PrivateLinkResourcesOperations` + * 2022-09-02-preview: :class:`PrivateLinkResourcesOperations` + * 2022-10-02-preview: :class:`PrivateLinkResourcesOperations` + * 2022-11-01: :class:`PrivateLinkResourcesOperations` + * 2022-11-02-preview: :class:`PrivateLinkResourcesOperations` + * 2023-01-01: :class:`PrivateLinkResourcesOperations` + * 2023-01-02-preview: :class:`PrivateLinkResourcesOperations` + * 2023-02-01: :class:`PrivateLinkResourcesOperations` + * 2023-02-02-preview: :class:`PrivateLinkResourcesOperations` + * 2023-03-01: :class:`PrivateLinkResourcesOperations` + * 2023-03-02-preview: :class:`PrivateLinkResourcesOperations` + * 2023-04-01: :class:`PrivateLinkResourcesOperations` + * 2023-04-02-preview: :class:`PrivateLinkResourcesOperations` + * 2023-05-01: :class:`PrivateLinkResourcesOperations` + * 2023-05-02-preview: :class:`PrivateLinkResourcesOperations` + * 2023-06-01: :class:`PrivateLinkResourcesOperations` + * 2023-06-02-preview: :class:`PrivateLinkResourcesOperations` + * 2023-07-01: :class:`PrivateLinkResourcesOperations` + * 2023-07-02-preview: :class:`PrivateLinkResourcesOperations` + * 2023-08-01: :class:`PrivateLinkResourcesOperations` + * 2023-08-02-preview: :class:`PrivateLinkResourcesOperations` + * 2023-09-01: :class:`PrivateLinkResourcesOperations` + * 2023-09-02-preview: :class:`PrivateLinkResourcesOperations` + * 2023-10-01: :class:`PrivateLinkResourcesOperations` + * 2023-10-02-preview: :class:`PrivateLinkResourcesOperations` + * 2023-11-01: :class:`PrivateLinkResourcesOperations` + * 2023-11-02-preview: :class:`PrivateLinkResourcesOperations` + * 2024-01-01: :class:`PrivateLinkResourcesOperations` + * 2024-01-02-preview: :class:`PrivateLinkResourcesOperations` + * 2024-02-01: :class:`PrivateLinkResourcesOperations` + * 2024-02-02-preview: :class:`PrivateLinkResourcesOperations` + * 2024-03-02-preview: :class:`PrivateLinkResourcesOperations` + * 2024-04-02-preview: :class:`PrivateLinkResourcesOperations` + * 2024-05-01: :class:`PrivateLinkResourcesOperations` + * 2024-05-02-preview: :class:`PrivateLinkResourcesOperations` + * 2024-06-02-preview: :class:`PrivateLinkResourcesOperations` + * 2024-07-01: :class:`PrivateLinkResourcesOperations` + * 2024-07-02-preview: :class:`PrivateLinkResourcesOperations` + * 2024-08-01: :class:`PrivateLinkResourcesOperations` """ - api_version = self._get_api_version('private_link_resources') - if api_version == '2020-09-01': + api_version = self._get_api_version("private_link_resources") + if api_version == "2020-09-01": from .v2020_09_01.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2020-11-01': + elif api_version == "2020-11-01": from .v2020_11_01.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2020-12-01': + elif api_version == "2020-12-01": from .v2020_12_01.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2021-02-01': + elif api_version == "2021-02-01": from .v2021_02_01.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2021-03-01': + elif api_version == "2021-03-01": from .v2021_03_01.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2021-05-01': + elif api_version == "2021-05-01": from .v2021_05_01.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2021-07-01': + elif api_version == "2021-07-01": from .v2021_07_01.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2021-08-01': + elif api_version == "2021-08-01": from .v2021_08_01.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2021-09-01': + elif api_version == "2021-09-01": from .v2021_09_01.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2021-10-01': + elif api_version == "2021-10-01": from .v2021_10_01.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2021-11-01-preview': + elif api_version == "2021-11-01-preview": from .v2021_11_01_preview.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2022-01-01': + elif api_version == "2022-01-01": from .v2022_01_01.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2022-01-02-preview': + elif api_version == "2022-01-02-preview": from .v2022_01_02_preview.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2022-02-01': + elif api_version == "2022-02-01": from .v2022_02_01.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2022-02-02-preview': + elif api_version == "2022-02-02-preview": from .v2022_02_02_preview.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2022-03-01': + elif api_version == "2022-03-01": from .v2022_03_01.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2022-03-02-preview': + elif api_version == "2022-03-02-preview": from .v2022_03_02_preview.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2022-04-01': + elif api_version == "2022-04-01": from .v2022_04_01.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2022-04-02-preview': + elif api_version == "2022-04-02-preview": from .v2022_04_02_preview.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2022-05-02-preview': + elif api_version == "2022-05-02-preview": from .v2022_05_02_preview.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2022-06-01': + elif api_version == "2022-06-01": from .v2022_06_01.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2022-06-02-preview': + elif api_version == "2022-06-02-preview": from .v2022_06_02_preview.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2022-07-01': + elif api_version == "2022-07-01": from .v2022_07_01.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2022-07-02-preview': + elif api_version == "2022-07-02-preview": from .v2022_07_02_preview.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2022-08-02-preview': + elif api_version == "2022-08-02-preview": from .v2022_08_02_preview.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2022-08-03-preview': + elif api_version == "2022-08-03-preview": from .v2022_08_03_preview.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2022-09-01': + elif api_version == "2022-09-01": from .v2022_09_01.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2022-09-02-preview': + elif api_version == "2022-09-02-preview": from .v2022_09_02_preview.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2022-10-02-preview': + elif api_version == "2022-10-02-preview": from .v2022_10_02_preview.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2022-11-01': + elif api_version == "2022-11-01": from .v2022_11_01.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2022-11-02-preview': + elif api_version == "2022-11-02-preview": from .v2022_11_02_preview.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2023-01-01': + elif api_version == "2023-01-01": from .v2023_01_01.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2023-01-02-preview': + elif api_version == "2023-01-02-preview": from .v2023_01_02_preview.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2023-02-01': + elif api_version == "2023-02-01": from .v2023_02_01.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2023-02-02-preview': + elif api_version == "2023-02-02-preview": from .v2023_02_02_preview.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2023-03-01': + elif api_version == "2023-03-01": from .v2023_03_01.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2023-03-02-preview': + elif api_version == "2023-03-02-preview": from .v2023_03_02_preview.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2023-04-01': + elif api_version == "2023-04-01": from .v2023_04_01.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2023-04-02-preview': + elif api_version == "2023-04-02-preview": from .v2023_04_02_preview.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2023-05-01': + elif api_version == "2023-05-01": from .v2023_05_01.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2023-05-02-preview': + elif api_version == "2023-05-02-preview": from .v2023_05_02_preview.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2023-06-01': + elif api_version == "2023-06-01": from .v2023_06_01.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2023-06-02-preview': + elif api_version == "2023-06-02-preview": from .v2023_06_02_preview.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2023-07-01': + elif api_version == "2023-07-01": from .v2023_07_01.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2023-07-02-preview': + elif api_version == "2023-07-02-preview": from .v2023_07_02_preview.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2023-08-01': + elif api_version == "2023-08-01": from .v2023_08_01.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2023-08-02-preview': + elif api_version == "2023-08-02-preview": from .v2023_08_02_preview.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2023-09-01': + elif api_version == "2023-09-01": from .v2023_09_01.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2023-09-02-preview': + elif api_version == "2023-09-02-preview": from .v2023_09_02_preview.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2023-10-01': + elif api_version == "2023-10-01": from .v2023_10_01.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2023-10-02-preview': + elif api_version == "2023-10-02-preview": from .v2023_10_02_preview.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2023-11-01': + elif api_version == "2023-11-01": from .v2023_11_01.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2023-11-02-preview': + elif api_version == "2023-11-02-preview": from .v2023_11_02_preview.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2024-01-01': + elif api_version == "2024-01-01": from .v2024_01_01.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2024-01-02-preview': + elif api_version == "2024-01-02-preview": from .v2024_01_02_preview.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2024-02-01': + elif api_version == "2024-02-01": from .v2024_02_01.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2024-02-02-preview': + elif api_version == "2024-02-02-preview": from .v2024_02_02_preview.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2024-03-02-preview': + elif api_version == "2024-03-02-preview": from .v2024_03_02_preview.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2024-04-02-preview': + elif api_version == "2024-04-02-preview": from .v2024_04_02_preview.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2024-05-01': + elif api_version == "2024-05-01": from .v2024_05_01.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2024-05-02-preview': + elif api_version == "2024-05-02-preview": from .v2024_05_02_preview.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2024-06-02-preview': + elif api_version == "2024-06-02-preview": from .v2024_06_02_preview.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2024-07-01': + elif api_version == "2024-07-01": from .v2024_07_01.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2024-07-02-preview': + elif api_version == "2024-07-02-preview": from .v2024_07_02_preview.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2024-08-01': + elif api_version == "2024-08-01": from .v2024_08_01.operations import PrivateLinkResourcesOperations as OperationClass else: - raise ValueError("API version {} does not have operation group 'private_link_resources'".format(api_version)) + raise ValueError( + "API version {} does not have operation group 'private_link_resources'".format(api_version) + ) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) + return OperationClass( + self._client, + self._config, + Serializer(self._models_dict(api_version)), + Deserializer(self._models_dict(api_version)), + api_version, + ) @property def resolve_private_link_service_id(self): """Instance depends on the API version: - * 2020-09-01: :class:`ResolvePrivateLinkServiceIdOperations` - * 2020-11-01: :class:`ResolvePrivateLinkServiceIdOperations` - * 2020-12-01: :class:`ResolvePrivateLinkServiceIdOperations` - * 2021-02-01: :class:`ResolvePrivateLinkServiceIdOperations` - * 2021-03-01: :class:`ResolvePrivateLinkServiceIdOperations` - * 2021-05-01: :class:`ResolvePrivateLinkServiceIdOperations` - * 2021-07-01: :class:`ResolvePrivateLinkServiceIdOperations` - * 2021-08-01: :class:`ResolvePrivateLinkServiceIdOperations` - * 2021-09-01: :class:`ResolvePrivateLinkServiceIdOperations` - * 2021-10-01: :class:`ResolvePrivateLinkServiceIdOperations` - * 2021-11-01-preview: :class:`ResolvePrivateLinkServiceIdOperations` - * 2022-01-01: :class:`ResolvePrivateLinkServiceIdOperations` - * 2022-01-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` - * 2022-02-01: :class:`ResolvePrivateLinkServiceIdOperations` - * 2022-02-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` - * 2022-03-01: :class:`ResolvePrivateLinkServiceIdOperations` - * 2022-03-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` - * 2022-04-01: :class:`ResolvePrivateLinkServiceIdOperations` - * 2022-04-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` - * 2022-05-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` - * 2022-06-01: :class:`ResolvePrivateLinkServiceIdOperations` - * 2022-06-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` - * 2022-07-01: :class:`ResolvePrivateLinkServiceIdOperations` - * 2022-07-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` - * 2022-08-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` - * 2022-08-03-preview: :class:`ResolvePrivateLinkServiceIdOperations` - * 2022-09-01: :class:`ResolvePrivateLinkServiceIdOperations` - * 2022-09-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` - * 2022-10-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` - * 2022-11-01: :class:`ResolvePrivateLinkServiceIdOperations` - * 2022-11-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` - * 2023-01-01: :class:`ResolvePrivateLinkServiceIdOperations` - * 2023-01-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` - * 2023-02-01: :class:`ResolvePrivateLinkServiceIdOperations` - * 2023-02-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` - * 2023-03-01: :class:`ResolvePrivateLinkServiceIdOperations` - * 2023-03-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` - * 2023-04-01: :class:`ResolvePrivateLinkServiceIdOperations` - * 2023-04-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` - * 2023-05-01: :class:`ResolvePrivateLinkServiceIdOperations` - * 2023-05-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` - * 2023-06-01: :class:`ResolvePrivateLinkServiceIdOperations` - * 2023-06-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` - * 2023-07-01: :class:`ResolvePrivateLinkServiceIdOperations` - * 2023-07-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` - * 2023-08-01: :class:`ResolvePrivateLinkServiceIdOperations` - * 2023-08-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` - * 2023-09-01: :class:`ResolvePrivateLinkServiceIdOperations` - * 2023-09-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` - * 2023-10-01: :class:`ResolvePrivateLinkServiceIdOperations` - * 2023-10-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` - * 2023-11-01: :class:`ResolvePrivateLinkServiceIdOperations` - * 2023-11-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` - * 2024-01-01: :class:`ResolvePrivateLinkServiceIdOperations` - * 2024-01-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` - * 2024-02-01: :class:`ResolvePrivateLinkServiceIdOperations` - * 2024-02-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` - * 2024-03-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` - * 2024-04-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` - * 2024-05-01: :class:`ResolvePrivateLinkServiceIdOperations` - * 2024-05-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` - * 2024-06-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` - * 2024-07-01: :class:`ResolvePrivateLinkServiceIdOperations` - * 2024-07-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` - * 2024-08-01: :class:`ResolvePrivateLinkServiceIdOperations` + * 2020-09-01: :class:`ResolvePrivateLinkServiceIdOperations` + * 2020-11-01: :class:`ResolvePrivateLinkServiceIdOperations` + * 2020-12-01: :class:`ResolvePrivateLinkServiceIdOperations` + * 2021-02-01: :class:`ResolvePrivateLinkServiceIdOperations` + * 2021-03-01: :class:`ResolvePrivateLinkServiceIdOperations` + * 2021-05-01: :class:`ResolvePrivateLinkServiceIdOperations` + * 2021-07-01: :class:`ResolvePrivateLinkServiceIdOperations` + * 2021-08-01: :class:`ResolvePrivateLinkServiceIdOperations` + * 2021-09-01: :class:`ResolvePrivateLinkServiceIdOperations` + * 2021-10-01: :class:`ResolvePrivateLinkServiceIdOperations` + * 2021-11-01-preview: :class:`ResolvePrivateLinkServiceIdOperations` + * 2022-01-01: :class:`ResolvePrivateLinkServiceIdOperations` + * 2022-01-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` + * 2022-02-01: :class:`ResolvePrivateLinkServiceIdOperations` + * 2022-02-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` + * 2022-03-01: :class:`ResolvePrivateLinkServiceIdOperations` + * 2022-03-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` + * 2022-04-01: :class:`ResolvePrivateLinkServiceIdOperations` + * 2022-04-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` + * 2022-05-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` + * 2022-06-01: :class:`ResolvePrivateLinkServiceIdOperations` + * 2022-06-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` + * 2022-07-01: :class:`ResolvePrivateLinkServiceIdOperations` + * 2022-07-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` + * 2022-08-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` + * 2022-08-03-preview: :class:`ResolvePrivateLinkServiceIdOperations` + * 2022-09-01: :class:`ResolvePrivateLinkServiceIdOperations` + * 2022-09-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` + * 2022-10-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` + * 2022-11-01: :class:`ResolvePrivateLinkServiceIdOperations` + * 2022-11-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` + * 2023-01-01: :class:`ResolvePrivateLinkServiceIdOperations` + * 2023-01-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` + * 2023-02-01: :class:`ResolvePrivateLinkServiceIdOperations` + * 2023-02-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` + * 2023-03-01: :class:`ResolvePrivateLinkServiceIdOperations` + * 2023-03-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` + * 2023-04-01: :class:`ResolvePrivateLinkServiceIdOperations` + * 2023-04-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` + * 2023-05-01: :class:`ResolvePrivateLinkServiceIdOperations` + * 2023-05-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` + * 2023-06-01: :class:`ResolvePrivateLinkServiceIdOperations` + * 2023-06-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` + * 2023-07-01: :class:`ResolvePrivateLinkServiceIdOperations` + * 2023-07-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` + * 2023-08-01: :class:`ResolvePrivateLinkServiceIdOperations` + * 2023-08-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` + * 2023-09-01: :class:`ResolvePrivateLinkServiceIdOperations` + * 2023-09-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` + * 2023-10-01: :class:`ResolvePrivateLinkServiceIdOperations` + * 2023-10-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` + * 2023-11-01: :class:`ResolvePrivateLinkServiceIdOperations` + * 2023-11-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` + * 2024-01-01: :class:`ResolvePrivateLinkServiceIdOperations` + * 2024-01-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` + * 2024-02-01: :class:`ResolvePrivateLinkServiceIdOperations` + * 2024-02-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` + * 2024-03-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` + * 2024-04-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` + * 2024-05-01: :class:`ResolvePrivateLinkServiceIdOperations` + * 2024-05-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` + * 2024-06-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` + * 2024-07-01: :class:`ResolvePrivateLinkServiceIdOperations` + * 2024-07-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` + * 2024-08-01: :class:`ResolvePrivateLinkServiceIdOperations` """ - api_version = self._get_api_version('resolve_private_link_service_id') - if api_version == '2020-09-01': + api_version = self._get_api_version("resolve_private_link_service_id") + if api_version == "2020-09-01": from .v2020_09_01.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2020-11-01': + elif api_version == "2020-11-01": from .v2020_11_01.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2020-12-01': + elif api_version == "2020-12-01": from .v2020_12_01.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2021-02-01': + elif api_version == "2021-02-01": from .v2021_02_01.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2021-03-01': + elif api_version == "2021-03-01": from .v2021_03_01.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2021-05-01': + elif api_version == "2021-05-01": from .v2021_05_01.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2021-07-01': + elif api_version == "2021-07-01": from .v2021_07_01.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2021-08-01': + elif api_version == "2021-08-01": from .v2021_08_01.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2021-09-01': + elif api_version == "2021-09-01": from .v2021_09_01.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2021-10-01': + elif api_version == "2021-10-01": from .v2021_10_01.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2021-11-01-preview': + elif api_version == "2021-11-01-preview": from .v2021_11_01_preview.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2022-01-01': + elif api_version == "2022-01-01": from .v2022_01_01.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2022-01-02-preview': + elif api_version == "2022-01-02-preview": from .v2022_01_02_preview.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2022-02-01': + elif api_version == "2022-02-01": from .v2022_02_01.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2022-02-02-preview': + elif api_version == "2022-02-02-preview": from .v2022_02_02_preview.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2022-03-01': + elif api_version == "2022-03-01": from .v2022_03_01.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2022-03-02-preview': + elif api_version == "2022-03-02-preview": from .v2022_03_02_preview.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2022-04-01': + elif api_version == "2022-04-01": from .v2022_04_01.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2022-04-02-preview': + elif api_version == "2022-04-02-preview": from .v2022_04_02_preview.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2022-05-02-preview': + elif api_version == "2022-05-02-preview": from .v2022_05_02_preview.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2022-06-01': + elif api_version == "2022-06-01": from .v2022_06_01.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2022-06-02-preview': + elif api_version == "2022-06-02-preview": from .v2022_06_02_preview.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2022-07-01': + elif api_version == "2022-07-01": from .v2022_07_01.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2022-07-02-preview': + elif api_version == "2022-07-02-preview": from .v2022_07_02_preview.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2022-08-02-preview': + elif api_version == "2022-08-02-preview": from .v2022_08_02_preview.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2022-08-03-preview': + elif api_version == "2022-08-03-preview": from .v2022_08_03_preview.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2022-09-01': + elif api_version == "2022-09-01": from .v2022_09_01.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2022-09-02-preview': + elif api_version == "2022-09-02-preview": from .v2022_09_02_preview.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2022-10-02-preview': + elif api_version == "2022-10-02-preview": from .v2022_10_02_preview.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2022-11-01': + elif api_version == "2022-11-01": from .v2022_11_01.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2022-11-02-preview': + elif api_version == "2022-11-02-preview": from .v2022_11_02_preview.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2023-01-01': + elif api_version == "2023-01-01": from .v2023_01_01.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2023-01-02-preview': + elif api_version == "2023-01-02-preview": from .v2023_01_02_preview.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2023-02-01': + elif api_version == "2023-02-01": from .v2023_02_01.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2023-02-02-preview': + elif api_version == "2023-02-02-preview": from .v2023_02_02_preview.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2023-03-01': + elif api_version == "2023-03-01": from .v2023_03_01.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2023-03-02-preview': + elif api_version == "2023-03-02-preview": from .v2023_03_02_preview.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2023-04-01': + elif api_version == "2023-04-01": from .v2023_04_01.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2023-04-02-preview': + elif api_version == "2023-04-02-preview": from .v2023_04_02_preview.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2023-05-01': + elif api_version == "2023-05-01": from .v2023_05_01.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2023-05-02-preview': + elif api_version == "2023-05-02-preview": from .v2023_05_02_preview.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2023-06-01': + elif api_version == "2023-06-01": from .v2023_06_01.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2023-06-02-preview': + elif api_version == "2023-06-02-preview": from .v2023_06_02_preview.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2023-07-01': + elif api_version == "2023-07-01": from .v2023_07_01.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2023-07-02-preview': + elif api_version == "2023-07-02-preview": from .v2023_07_02_preview.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2023-08-01': + elif api_version == "2023-08-01": from .v2023_08_01.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2023-08-02-preview': + elif api_version == "2023-08-02-preview": from .v2023_08_02_preview.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2023-09-01': + elif api_version == "2023-09-01": from .v2023_09_01.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2023-09-02-preview': + elif api_version == "2023-09-02-preview": from .v2023_09_02_preview.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2023-10-01': + elif api_version == "2023-10-01": from .v2023_10_01.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2023-10-02-preview': + elif api_version == "2023-10-02-preview": from .v2023_10_02_preview.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2023-11-01': + elif api_version == "2023-11-01": from .v2023_11_01.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2023-11-02-preview': + elif api_version == "2023-11-02-preview": from .v2023_11_02_preview.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2024-01-01': + elif api_version == "2024-01-01": from .v2024_01_01.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2024-01-02-preview': + elif api_version == "2024-01-02-preview": from .v2024_01_02_preview.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2024-02-01': + elif api_version == "2024-02-01": from .v2024_02_01.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2024-02-02-preview': + elif api_version == "2024-02-02-preview": from .v2024_02_02_preview.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2024-03-02-preview': + elif api_version == "2024-03-02-preview": from .v2024_03_02_preview.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2024-04-02-preview': + elif api_version == "2024-04-02-preview": from .v2024_04_02_preview.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2024-05-01': + elif api_version == "2024-05-01": from .v2024_05_01.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2024-05-02-preview': + elif api_version == "2024-05-02-preview": from .v2024_05_02_preview.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2024-06-02-preview': + elif api_version == "2024-06-02-preview": from .v2024_06_02_preview.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2024-07-01': + elif api_version == "2024-07-01": from .v2024_07_01.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2024-07-02-preview': + elif api_version == "2024-07-02-preview": from .v2024_07_02_preview.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2024-08-01': + elif api_version == "2024-08-01": from .v2024_08_01.operations import ResolvePrivateLinkServiceIdOperations as OperationClass else: - raise ValueError("API version {} does not have operation group 'resolve_private_link_service_id'".format(api_version)) + raise ValueError( + "API version {} does not have operation group 'resolve_private_link_service_id'".format(api_version) + ) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) + return OperationClass( + self._client, + self._config, + Serializer(self._models_dict(api_version)), + Deserializer(self._models_dict(api_version)), + api_version, + ) @property def snapshots(self): """Instance depends on the API version: - * 2021-08-01: :class:`SnapshotsOperations` - * 2021-09-01: :class:`SnapshotsOperations` - * 2021-10-01: :class:`SnapshotsOperations` - * 2021-11-01-preview: :class:`SnapshotsOperations` - * 2022-01-01: :class:`SnapshotsOperations` - * 2022-01-02-preview: :class:`SnapshotsOperations` - * 2022-02-01: :class:`SnapshotsOperations` - * 2022-02-02-preview: :class:`SnapshotsOperations` - * 2022-03-01: :class:`SnapshotsOperations` - * 2022-03-02-preview: :class:`SnapshotsOperations` - * 2022-04-01: :class:`SnapshotsOperations` - * 2022-04-02-preview: :class:`SnapshotsOperations` - * 2022-05-02-preview: :class:`SnapshotsOperations` - * 2022-06-01: :class:`SnapshotsOperations` - * 2022-06-02-preview: :class:`SnapshotsOperations` - * 2022-07-01: :class:`SnapshotsOperations` - * 2022-07-02-preview: :class:`SnapshotsOperations` - * 2022-08-02-preview: :class:`SnapshotsOperations` - * 2022-08-03-preview: :class:`SnapshotsOperations` - * 2022-09-01: :class:`SnapshotsOperations` - * 2022-09-02-preview: :class:`SnapshotsOperations` - * 2022-10-02-preview: :class:`SnapshotsOperations` - * 2022-11-01: :class:`SnapshotsOperations` - * 2022-11-02-preview: :class:`SnapshotsOperations` - * 2023-01-01: :class:`SnapshotsOperations` - * 2023-01-02-preview: :class:`SnapshotsOperations` - * 2023-02-01: :class:`SnapshotsOperations` - * 2023-02-02-preview: :class:`SnapshotsOperations` - * 2023-03-01: :class:`SnapshotsOperations` - * 2023-03-02-preview: :class:`SnapshotsOperations` - * 2023-04-01: :class:`SnapshotsOperations` - * 2023-04-02-preview: :class:`SnapshotsOperations` - * 2023-05-01: :class:`SnapshotsOperations` - * 2023-05-02-preview: :class:`SnapshotsOperations` - * 2023-06-01: :class:`SnapshotsOperations` - * 2023-06-02-preview: :class:`SnapshotsOperations` - * 2023-07-01: :class:`SnapshotsOperations` - * 2023-07-02-preview: :class:`SnapshotsOperations` - * 2023-08-01: :class:`SnapshotsOperations` - * 2023-08-02-preview: :class:`SnapshotsOperations` - * 2023-09-01: :class:`SnapshotsOperations` - * 2023-09-02-preview: :class:`SnapshotsOperations` - * 2023-10-01: :class:`SnapshotsOperations` - * 2023-10-02-preview: :class:`SnapshotsOperations` - * 2023-11-01: :class:`SnapshotsOperations` - * 2023-11-02-preview: :class:`SnapshotsOperations` - * 2024-01-01: :class:`SnapshotsOperations` - * 2024-01-02-preview: :class:`SnapshotsOperations` - * 2024-02-01: :class:`SnapshotsOperations` - * 2024-02-02-preview: :class:`SnapshotsOperations` - * 2024-03-02-preview: :class:`SnapshotsOperations` - * 2024-04-02-preview: :class:`SnapshotsOperations` - * 2024-05-01: :class:`SnapshotsOperations` - * 2024-05-02-preview: :class:`SnapshotsOperations` - * 2024-06-02-preview: :class:`SnapshotsOperations` - * 2024-07-01: :class:`SnapshotsOperations` - * 2024-07-02-preview: :class:`SnapshotsOperations` - * 2024-08-01: :class:`SnapshotsOperations` + * 2021-08-01: :class:`SnapshotsOperations` + * 2021-09-01: :class:`SnapshotsOperations` + * 2021-10-01: :class:`SnapshotsOperations` + * 2021-11-01-preview: :class:`SnapshotsOperations` + * 2022-01-01: :class:`SnapshotsOperations` + * 2022-01-02-preview: :class:`SnapshotsOperations` + * 2022-02-01: :class:`SnapshotsOperations` + * 2022-02-02-preview: :class:`SnapshotsOperations` + * 2022-03-01: :class:`SnapshotsOperations` + * 2022-03-02-preview: :class:`SnapshotsOperations` + * 2022-04-01: :class:`SnapshotsOperations` + * 2022-04-02-preview: :class:`SnapshotsOperations` + * 2022-05-02-preview: :class:`SnapshotsOperations` + * 2022-06-01: :class:`SnapshotsOperations` + * 2022-06-02-preview: :class:`SnapshotsOperations` + * 2022-07-01: :class:`SnapshotsOperations` + * 2022-07-02-preview: :class:`SnapshotsOperations` + * 2022-08-02-preview: :class:`SnapshotsOperations` + * 2022-08-03-preview: :class:`SnapshotsOperations` + * 2022-09-01: :class:`SnapshotsOperations` + * 2022-09-02-preview: :class:`SnapshotsOperations` + * 2022-10-02-preview: :class:`SnapshotsOperations` + * 2022-11-01: :class:`SnapshotsOperations` + * 2022-11-02-preview: :class:`SnapshotsOperations` + * 2023-01-01: :class:`SnapshotsOperations` + * 2023-01-02-preview: :class:`SnapshotsOperations` + * 2023-02-01: :class:`SnapshotsOperations` + * 2023-02-02-preview: :class:`SnapshotsOperations` + * 2023-03-01: :class:`SnapshotsOperations` + * 2023-03-02-preview: :class:`SnapshotsOperations` + * 2023-04-01: :class:`SnapshotsOperations` + * 2023-04-02-preview: :class:`SnapshotsOperations` + * 2023-05-01: :class:`SnapshotsOperations` + * 2023-05-02-preview: :class:`SnapshotsOperations` + * 2023-06-01: :class:`SnapshotsOperations` + * 2023-06-02-preview: :class:`SnapshotsOperations` + * 2023-07-01: :class:`SnapshotsOperations` + * 2023-07-02-preview: :class:`SnapshotsOperations` + * 2023-08-01: :class:`SnapshotsOperations` + * 2023-08-02-preview: :class:`SnapshotsOperations` + * 2023-09-01: :class:`SnapshotsOperations` + * 2023-09-02-preview: :class:`SnapshotsOperations` + * 2023-10-01: :class:`SnapshotsOperations` + * 2023-10-02-preview: :class:`SnapshotsOperations` + * 2023-11-01: :class:`SnapshotsOperations` + * 2023-11-02-preview: :class:`SnapshotsOperations` + * 2024-01-01: :class:`SnapshotsOperations` + * 2024-01-02-preview: :class:`SnapshotsOperations` + * 2024-02-01: :class:`SnapshotsOperations` + * 2024-02-02-preview: :class:`SnapshotsOperations` + * 2024-03-02-preview: :class:`SnapshotsOperations` + * 2024-04-02-preview: :class:`SnapshotsOperations` + * 2024-05-01: :class:`SnapshotsOperations` + * 2024-05-02-preview: :class:`SnapshotsOperations` + * 2024-06-02-preview: :class:`SnapshotsOperations` + * 2024-07-01: :class:`SnapshotsOperations` + * 2024-07-02-preview: :class:`SnapshotsOperations` + * 2024-08-01: :class:`SnapshotsOperations` """ - api_version = self._get_api_version('snapshots') - if api_version == '2021-08-01': + api_version = self._get_api_version("snapshots") + if api_version == "2021-08-01": from .v2021_08_01.operations import SnapshotsOperations as OperationClass - elif api_version == '2021-09-01': + elif api_version == "2021-09-01": from .v2021_09_01.operations import SnapshotsOperations as OperationClass - elif api_version == '2021-10-01': + elif api_version == "2021-10-01": from .v2021_10_01.operations import SnapshotsOperations as OperationClass - elif api_version == '2021-11-01-preview': + elif api_version == "2021-11-01-preview": from .v2021_11_01_preview.operations import SnapshotsOperations as OperationClass - elif api_version == '2022-01-01': + elif api_version == "2022-01-01": from .v2022_01_01.operations import SnapshotsOperations as OperationClass - elif api_version == '2022-01-02-preview': + elif api_version == "2022-01-02-preview": from .v2022_01_02_preview.operations import SnapshotsOperations as OperationClass - elif api_version == '2022-02-01': + elif api_version == "2022-02-01": from .v2022_02_01.operations import SnapshotsOperations as OperationClass - elif api_version == '2022-02-02-preview': + elif api_version == "2022-02-02-preview": from .v2022_02_02_preview.operations import SnapshotsOperations as OperationClass - elif api_version == '2022-03-01': + elif api_version == "2022-03-01": from .v2022_03_01.operations import SnapshotsOperations as OperationClass - elif api_version == '2022-03-02-preview': + elif api_version == "2022-03-02-preview": from .v2022_03_02_preview.operations import SnapshotsOperations as OperationClass - elif api_version == '2022-04-01': + elif api_version == "2022-04-01": from .v2022_04_01.operations import SnapshotsOperations as OperationClass - elif api_version == '2022-04-02-preview': + elif api_version == "2022-04-02-preview": from .v2022_04_02_preview.operations import SnapshotsOperations as OperationClass - elif api_version == '2022-05-02-preview': + elif api_version == "2022-05-02-preview": from .v2022_05_02_preview.operations import SnapshotsOperations as OperationClass - elif api_version == '2022-06-01': + elif api_version == "2022-06-01": from .v2022_06_01.operations import SnapshotsOperations as OperationClass - elif api_version == '2022-06-02-preview': + elif api_version == "2022-06-02-preview": from .v2022_06_02_preview.operations import SnapshotsOperations as OperationClass - elif api_version == '2022-07-01': + elif api_version == "2022-07-01": from .v2022_07_01.operations import SnapshotsOperations as OperationClass - elif api_version == '2022-07-02-preview': + elif api_version == "2022-07-02-preview": from .v2022_07_02_preview.operations import SnapshotsOperations as OperationClass - elif api_version == '2022-08-02-preview': + elif api_version == "2022-08-02-preview": from .v2022_08_02_preview.operations import SnapshotsOperations as OperationClass - elif api_version == '2022-08-03-preview': + elif api_version == "2022-08-03-preview": from .v2022_08_03_preview.operations import SnapshotsOperations as OperationClass - elif api_version == '2022-09-01': + elif api_version == "2022-09-01": from .v2022_09_01.operations import SnapshotsOperations as OperationClass - elif api_version == '2022-09-02-preview': + elif api_version == "2022-09-02-preview": from .v2022_09_02_preview.operations import SnapshotsOperations as OperationClass - elif api_version == '2022-10-02-preview': + elif api_version == "2022-10-02-preview": from .v2022_10_02_preview.operations import SnapshotsOperations as OperationClass - elif api_version == '2022-11-01': + elif api_version == "2022-11-01": from .v2022_11_01.operations import SnapshotsOperations as OperationClass - elif api_version == '2022-11-02-preview': + elif api_version == "2022-11-02-preview": from .v2022_11_02_preview.operations import SnapshotsOperations as OperationClass - elif api_version == '2023-01-01': + elif api_version == "2023-01-01": from .v2023_01_01.operations import SnapshotsOperations as OperationClass - elif api_version == '2023-01-02-preview': + elif api_version == "2023-01-02-preview": from .v2023_01_02_preview.operations import SnapshotsOperations as OperationClass - elif api_version == '2023-02-01': + elif api_version == "2023-02-01": from .v2023_02_01.operations import SnapshotsOperations as OperationClass - elif api_version == '2023-02-02-preview': + elif api_version == "2023-02-02-preview": from .v2023_02_02_preview.operations import SnapshotsOperations as OperationClass - elif api_version == '2023-03-01': + elif api_version == "2023-03-01": from .v2023_03_01.operations import SnapshotsOperations as OperationClass - elif api_version == '2023-03-02-preview': + elif api_version == "2023-03-02-preview": from .v2023_03_02_preview.operations import SnapshotsOperations as OperationClass - elif api_version == '2023-04-01': + elif api_version == "2023-04-01": from .v2023_04_01.operations import SnapshotsOperations as OperationClass - elif api_version == '2023-04-02-preview': + elif api_version == "2023-04-02-preview": from .v2023_04_02_preview.operations import SnapshotsOperations as OperationClass - elif api_version == '2023-05-01': + elif api_version == "2023-05-01": from .v2023_05_01.operations import SnapshotsOperations as OperationClass - elif api_version == '2023-05-02-preview': + elif api_version == "2023-05-02-preview": from .v2023_05_02_preview.operations import SnapshotsOperations as OperationClass - elif api_version == '2023-06-01': + elif api_version == "2023-06-01": from .v2023_06_01.operations import SnapshotsOperations as OperationClass - elif api_version == '2023-06-02-preview': + elif api_version == "2023-06-02-preview": from .v2023_06_02_preview.operations import SnapshotsOperations as OperationClass - elif api_version == '2023-07-01': + elif api_version == "2023-07-01": from .v2023_07_01.operations import SnapshotsOperations as OperationClass - elif api_version == '2023-07-02-preview': + elif api_version == "2023-07-02-preview": from .v2023_07_02_preview.operations import SnapshotsOperations as OperationClass - elif api_version == '2023-08-01': + elif api_version == "2023-08-01": from .v2023_08_01.operations import SnapshotsOperations as OperationClass - elif api_version == '2023-08-02-preview': + elif api_version == "2023-08-02-preview": from .v2023_08_02_preview.operations import SnapshotsOperations as OperationClass - elif api_version == '2023-09-01': + elif api_version == "2023-09-01": from .v2023_09_01.operations import SnapshotsOperations as OperationClass - elif api_version == '2023-09-02-preview': + elif api_version == "2023-09-02-preview": from .v2023_09_02_preview.operations import SnapshotsOperations as OperationClass - elif api_version == '2023-10-01': + elif api_version == "2023-10-01": from .v2023_10_01.operations import SnapshotsOperations as OperationClass - elif api_version == '2023-10-02-preview': + elif api_version == "2023-10-02-preview": from .v2023_10_02_preview.operations import SnapshotsOperations as OperationClass - elif api_version == '2023-11-01': + elif api_version == "2023-11-01": from .v2023_11_01.operations import SnapshotsOperations as OperationClass - elif api_version == '2023-11-02-preview': + elif api_version == "2023-11-02-preview": from .v2023_11_02_preview.operations import SnapshotsOperations as OperationClass - elif api_version == '2024-01-01': + elif api_version == "2024-01-01": from .v2024_01_01.operations import SnapshotsOperations as OperationClass - elif api_version == '2024-01-02-preview': + elif api_version == "2024-01-02-preview": from .v2024_01_02_preview.operations import SnapshotsOperations as OperationClass - elif api_version == '2024-02-01': + elif api_version == "2024-02-01": from .v2024_02_01.operations import SnapshotsOperations as OperationClass - elif api_version == '2024-02-02-preview': + elif api_version == "2024-02-02-preview": from .v2024_02_02_preview.operations import SnapshotsOperations as OperationClass - elif api_version == '2024-03-02-preview': + elif api_version == "2024-03-02-preview": from .v2024_03_02_preview.operations import SnapshotsOperations as OperationClass - elif api_version == '2024-04-02-preview': + elif api_version == "2024-04-02-preview": from .v2024_04_02_preview.operations import SnapshotsOperations as OperationClass - elif api_version == '2024-05-01': + elif api_version == "2024-05-01": from .v2024_05_01.operations import SnapshotsOperations as OperationClass - elif api_version == '2024-05-02-preview': + elif api_version == "2024-05-02-preview": from .v2024_05_02_preview.operations import SnapshotsOperations as OperationClass - elif api_version == '2024-06-02-preview': + elif api_version == "2024-06-02-preview": from .v2024_06_02_preview.operations import SnapshotsOperations as OperationClass - elif api_version == '2024-07-01': + elif api_version == "2024-07-01": from .v2024_07_01.operations import SnapshotsOperations as OperationClass - elif api_version == '2024-07-02-preview': + elif api_version == "2024-07-02-preview": from .v2024_07_02_preview.operations import SnapshotsOperations as OperationClass - elif api_version == '2024-08-01': + elif api_version == "2024-08-01": from .v2024_08_01.operations import SnapshotsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'snapshots'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) + return OperationClass( + self._client, + self._config, + Serializer(self._models_dict(api_version)), + Deserializer(self._models_dict(api_version)), + api_version, + ) @property def trusted_access_role_bindings(self): """Instance depends on the API version: - * 2022-04-02-preview: :class:`TrustedAccessRoleBindingsOperations` - * 2022-05-02-preview: :class:`TrustedAccessRoleBindingsOperations` - * 2022-06-02-preview: :class:`TrustedAccessRoleBindingsOperations` - * 2022-07-02-preview: :class:`TrustedAccessRoleBindingsOperations` - * 2022-08-02-preview: :class:`TrustedAccessRoleBindingsOperations` - * 2022-08-03-preview: :class:`TrustedAccessRoleBindingsOperations` - * 2022-09-02-preview: :class:`TrustedAccessRoleBindingsOperations` - * 2022-10-02-preview: :class:`TrustedAccessRoleBindingsOperations` - * 2022-11-02-preview: :class:`TrustedAccessRoleBindingsOperations` - * 2023-01-02-preview: :class:`TrustedAccessRoleBindingsOperations` - * 2023-02-02-preview: :class:`TrustedAccessRoleBindingsOperations` - * 2023-03-02-preview: :class:`TrustedAccessRoleBindingsOperations` - * 2023-04-02-preview: :class:`TrustedAccessRoleBindingsOperations` - * 2023-05-02-preview: :class:`TrustedAccessRoleBindingsOperations` - * 2023-06-02-preview: :class:`TrustedAccessRoleBindingsOperations` - * 2023-07-02-preview: :class:`TrustedAccessRoleBindingsOperations` - * 2023-08-02-preview: :class:`TrustedAccessRoleBindingsOperations` - * 2023-09-01: :class:`TrustedAccessRoleBindingsOperations` - * 2023-09-02-preview: :class:`TrustedAccessRoleBindingsOperations` - * 2023-10-01: :class:`TrustedAccessRoleBindingsOperations` - * 2023-10-02-preview: :class:`TrustedAccessRoleBindingsOperations` - * 2023-11-01: :class:`TrustedAccessRoleBindingsOperations` - * 2023-11-02-preview: :class:`TrustedAccessRoleBindingsOperations` - * 2024-01-01: :class:`TrustedAccessRoleBindingsOperations` - * 2024-01-02-preview: :class:`TrustedAccessRoleBindingsOperations` - * 2024-02-01: :class:`TrustedAccessRoleBindingsOperations` - * 2024-02-02-preview: :class:`TrustedAccessRoleBindingsOperations` - * 2024-03-02-preview: :class:`TrustedAccessRoleBindingsOperations` - * 2024-04-02-preview: :class:`TrustedAccessRoleBindingsOperations` - * 2024-05-01: :class:`TrustedAccessRoleBindingsOperations` - * 2024-05-02-preview: :class:`TrustedAccessRoleBindingsOperations` - * 2024-06-02-preview: :class:`TrustedAccessRoleBindingsOperations` - * 2024-07-01: :class:`TrustedAccessRoleBindingsOperations` - * 2024-07-02-preview: :class:`TrustedAccessRoleBindingsOperations` - * 2024-08-01: :class:`TrustedAccessRoleBindingsOperations` + * 2022-04-02-preview: :class:`TrustedAccessRoleBindingsOperations` + * 2022-05-02-preview: :class:`TrustedAccessRoleBindingsOperations` + * 2022-06-02-preview: :class:`TrustedAccessRoleBindingsOperations` + * 2022-07-02-preview: :class:`TrustedAccessRoleBindingsOperations` + * 2022-08-02-preview: :class:`TrustedAccessRoleBindingsOperations` + * 2022-08-03-preview: :class:`TrustedAccessRoleBindingsOperations` + * 2022-09-02-preview: :class:`TrustedAccessRoleBindingsOperations` + * 2022-10-02-preview: :class:`TrustedAccessRoleBindingsOperations` + * 2022-11-02-preview: :class:`TrustedAccessRoleBindingsOperations` + * 2023-01-02-preview: :class:`TrustedAccessRoleBindingsOperations` + * 2023-02-02-preview: :class:`TrustedAccessRoleBindingsOperations` + * 2023-03-02-preview: :class:`TrustedAccessRoleBindingsOperations` + * 2023-04-02-preview: :class:`TrustedAccessRoleBindingsOperations` + * 2023-05-02-preview: :class:`TrustedAccessRoleBindingsOperations` + * 2023-06-02-preview: :class:`TrustedAccessRoleBindingsOperations` + * 2023-07-02-preview: :class:`TrustedAccessRoleBindingsOperations` + * 2023-08-02-preview: :class:`TrustedAccessRoleBindingsOperations` + * 2023-09-01: :class:`TrustedAccessRoleBindingsOperations` + * 2023-09-02-preview: :class:`TrustedAccessRoleBindingsOperations` + * 2023-10-01: :class:`TrustedAccessRoleBindingsOperations` + * 2023-10-02-preview: :class:`TrustedAccessRoleBindingsOperations` + * 2023-11-01: :class:`TrustedAccessRoleBindingsOperations` + * 2023-11-02-preview: :class:`TrustedAccessRoleBindingsOperations` + * 2024-01-01: :class:`TrustedAccessRoleBindingsOperations` + * 2024-01-02-preview: :class:`TrustedAccessRoleBindingsOperations` + * 2024-02-01: :class:`TrustedAccessRoleBindingsOperations` + * 2024-02-02-preview: :class:`TrustedAccessRoleBindingsOperations` + * 2024-03-02-preview: :class:`TrustedAccessRoleBindingsOperations` + * 2024-04-02-preview: :class:`TrustedAccessRoleBindingsOperations` + * 2024-05-01: :class:`TrustedAccessRoleBindingsOperations` + * 2024-05-02-preview: :class:`TrustedAccessRoleBindingsOperations` + * 2024-06-02-preview: :class:`TrustedAccessRoleBindingsOperations` + * 2024-07-01: :class:`TrustedAccessRoleBindingsOperations` + * 2024-07-02-preview: :class:`TrustedAccessRoleBindingsOperations` + * 2024-08-01: :class:`TrustedAccessRoleBindingsOperations` """ - api_version = self._get_api_version('trusted_access_role_bindings') - if api_version == '2022-04-02-preview': + api_version = self._get_api_version("trusted_access_role_bindings") + if api_version == "2022-04-02-preview": from .v2022_04_02_preview.operations import TrustedAccessRoleBindingsOperations as OperationClass - elif api_version == '2022-05-02-preview': + elif api_version == "2022-05-02-preview": from .v2022_05_02_preview.operations import TrustedAccessRoleBindingsOperations as OperationClass - elif api_version == '2022-06-02-preview': + elif api_version == "2022-06-02-preview": from .v2022_06_02_preview.operations import TrustedAccessRoleBindingsOperations as OperationClass - elif api_version == '2022-07-02-preview': + elif api_version == "2022-07-02-preview": from .v2022_07_02_preview.operations import TrustedAccessRoleBindingsOperations as OperationClass - elif api_version == '2022-08-02-preview': + elif api_version == "2022-08-02-preview": from .v2022_08_02_preview.operations import TrustedAccessRoleBindingsOperations as OperationClass - elif api_version == '2022-08-03-preview': + elif api_version == "2022-08-03-preview": from .v2022_08_03_preview.operations import TrustedAccessRoleBindingsOperations as OperationClass - elif api_version == '2022-09-02-preview': + elif api_version == "2022-09-02-preview": from .v2022_09_02_preview.operations import TrustedAccessRoleBindingsOperations as OperationClass - elif api_version == '2022-10-02-preview': + elif api_version == "2022-10-02-preview": from .v2022_10_02_preview.operations import TrustedAccessRoleBindingsOperations as OperationClass - elif api_version == '2022-11-02-preview': + elif api_version == "2022-11-02-preview": from .v2022_11_02_preview.operations import TrustedAccessRoleBindingsOperations as OperationClass - elif api_version == '2023-01-02-preview': + elif api_version == "2023-01-02-preview": from .v2023_01_02_preview.operations import TrustedAccessRoleBindingsOperations as OperationClass - elif api_version == '2023-02-02-preview': + elif api_version == "2023-02-02-preview": from .v2023_02_02_preview.operations import TrustedAccessRoleBindingsOperations as OperationClass - elif api_version == '2023-03-02-preview': + elif api_version == "2023-03-02-preview": from .v2023_03_02_preview.operations import TrustedAccessRoleBindingsOperations as OperationClass - elif api_version == '2023-04-02-preview': + elif api_version == "2023-04-02-preview": from .v2023_04_02_preview.operations import TrustedAccessRoleBindingsOperations as OperationClass - elif api_version == '2023-05-02-preview': + elif api_version == "2023-05-02-preview": from .v2023_05_02_preview.operations import TrustedAccessRoleBindingsOperations as OperationClass - elif api_version == '2023-06-02-preview': + elif api_version == "2023-06-02-preview": from .v2023_06_02_preview.operations import TrustedAccessRoleBindingsOperations as OperationClass - elif api_version == '2023-07-02-preview': + elif api_version == "2023-07-02-preview": from .v2023_07_02_preview.operations import TrustedAccessRoleBindingsOperations as OperationClass - elif api_version == '2023-08-02-preview': + elif api_version == "2023-08-02-preview": from .v2023_08_02_preview.operations import TrustedAccessRoleBindingsOperations as OperationClass - elif api_version == '2023-09-01': + elif api_version == "2023-09-01": from .v2023_09_01.operations import TrustedAccessRoleBindingsOperations as OperationClass - elif api_version == '2023-09-02-preview': + elif api_version == "2023-09-02-preview": from .v2023_09_02_preview.operations import TrustedAccessRoleBindingsOperations as OperationClass - elif api_version == '2023-10-01': + elif api_version == "2023-10-01": from .v2023_10_01.operations import TrustedAccessRoleBindingsOperations as OperationClass - elif api_version == '2023-10-02-preview': + elif api_version == "2023-10-02-preview": from .v2023_10_02_preview.operations import TrustedAccessRoleBindingsOperations as OperationClass - elif api_version == '2023-11-01': + elif api_version == "2023-11-01": from .v2023_11_01.operations import TrustedAccessRoleBindingsOperations as OperationClass - elif api_version == '2023-11-02-preview': + elif api_version == "2023-11-02-preview": from .v2023_11_02_preview.operations import TrustedAccessRoleBindingsOperations as OperationClass - elif api_version == '2024-01-01': + elif api_version == "2024-01-01": from .v2024_01_01.operations import TrustedAccessRoleBindingsOperations as OperationClass - elif api_version == '2024-01-02-preview': + elif api_version == "2024-01-02-preview": from .v2024_01_02_preview.operations import TrustedAccessRoleBindingsOperations as OperationClass - elif api_version == '2024-02-01': + elif api_version == "2024-02-01": from .v2024_02_01.operations import TrustedAccessRoleBindingsOperations as OperationClass - elif api_version == '2024-02-02-preview': + elif api_version == "2024-02-02-preview": from .v2024_02_02_preview.operations import TrustedAccessRoleBindingsOperations as OperationClass - elif api_version == '2024-03-02-preview': + elif api_version == "2024-03-02-preview": from .v2024_03_02_preview.operations import TrustedAccessRoleBindingsOperations as OperationClass - elif api_version == '2024-04-02-preview': + elif api_version == "2024-04-02-preview": from .v2024_04_02_preview.operations import TrustedAccessRoleBindingsOperations as OperationClass - elif api_version == '2024-05-01': + elif api_version == "2024-05-01": from .v2024_05_01.operations import TrustedAccessRoleBindingsOperations as OperationClass - elif api_version == '2024-05-02-preview': + elif api_version == "2024-05-02-preview": from .v2024_05_02_preview.operations import TrustedAccessRoleBindingsOperations as OperationClass - elif api_version == '2024-06-02-preview': + elif api_version == "2024-06-02-preview": from .v2024_06_02_preview.operations import TrustedAccessRoleBindingsOperations as OperationClass - elif api_version == '2024-07-01': + elif api_version == "2024-07-01": from .v2024_07_01.operations import TrustedAccessRoleBindingsOperations as OperationClass - elif api_version == '2024-07-02-preview': + elif api_version == "2024-07-02-preview": from .v2024_07_02_preview.operations import TrustedAccessRoleBindingsOperations as OperationClass - elif api_version == '2024-08-01': + elif api_version == "2024-08-01": from .v2024_08_01.operations import TrustedAccessRoleBindingsOperations as OperationClass else: - raise ValueError("API version {} does not have operation group 'trusted_access_role_bindings'".format(api_version)) + raise ValueError( + "API version {} does not have operation group 'trusted_access_role_bindings'".format(api_version) + ) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) + return OperationClass( + self._client, + self._config, + Serializer(self._models_dict(api_version)), + Deserializer(self._models_dict(api_version)), + api_version, + ) @property def trusted_access_roles(self): """Instance depends on the API version: - * 2022-04-02-preview: :class:`TrustedAccessRolesOperations` - * 2022-05-02-preview: :class:`TrustedAccessRolesOperations` - * 2022-06-02-preview: :class:`TrustedAccessRolesOperations` - * 2022-07-02-preview: :class:`TrustedAccessRolesOperations` - * 2022-08-02-preview: :class:`TrustedAccessRolesOperations` - * 2022-08-03-preview: :class:`TrustedAccessRolesOperations` - * 2022-09-02-preview: :class:`TrustedAccessRolesOperations` - * 2022-10-02-preview: :class:`TrustedAccessRolesOperations` - * 2022-11-02-preview: :class:`TrustedAccessRolesOperations` - * 2023-01-02-preview: :class:`TrustedAccessRolesOperations` - * 2023-02-02-preview: :class:`TrustedAccessRolesOperations` - * 2023-03-02-preview: :class:`TrustedAccessRolesOperations` - * 2023-04-02-preview: :class:`TrustedAccessRolesOperations` - * 2023-05-02-preview: :class:`TrustedAccessRolesOperations` - * 2023-06-02-preview: :class:`TrustedAccessRolesOperations` - * 2023-07-02-preview: :class:`TrustedAccessRolesOperations` - * 2023-08-02-preview: :class:`TrustedAccessRolesOperations` - * 2023-09-01: :class:`TrustedAccessRolesOperations` - * 2023-09-02-preview: :class:`TrustedAccessRolesOperations` - * 2023-10-01: :class:`TrustedAccessRolesOperations` - * 2023-10-02-preview: :class:`TrustedAccessRolesOperations` - * 2023-11-01: :class:`TrustedAccessRolesOperations` - * 2023-11-02-preview: :class:`TrustedAccessRolesOperations` - * 2024-01-01: :class:`TrustedAccessRolesOperations` - * 2024-01-02-preview: :class:`TrustedAccessRolesOperations` - * 2024-02-01: :class:`TrustedAccessRolesOperations` - * 2024-02-02-preview: :class:`TrustedAccessRolesOperations` - * 2024-03-02-preview: :class:`TrustedAccessRolesOperations` - * 2024-04-02-preview: :class:`TrustedAccessRolesOperations` - * 2024-05-01: :class:`TrustedAccessRolesOperations` - * 2024-05-02-preview: :class:`TrustedAccessRolesOperations` - * 2024-06-02-preview: :class:`TrustedAccessRolesOperations` - * 2024-07-01: :class:`TrustedAccessRolesOperations` - * 2024-07-02-preview: :class:`TrustedAccessRolesOperations` - * 2024-08-01: :class:`TrustedAccessRolesOperations` + * 2022-04-02-preview: :class:`TrustedAccessRolesOperations` + * 2022-05-02-preview: :class:`TrustedAccessRolesOperations` + * 2022-06-02-preview: :class:`TrustedAccessRolesOperations` + * 2022-07-02-preview: :class:`TrustedAccessRolesOperations` + * 2022-08-02-preview: :class:`TrustedAccessRolesOperations` + * 2022-08-03-preview: :class:`TrustedAccessRolesOperations` + * 2022-09-02-preview: :class:`TrustedAccessRolesOperations` + * 2022-10-02-preview: :class:`TrustedAccessRolesOperations` + * 2022-11-02-preview: :class:`TrustedAccessRolesOperations` + * 2023-01-02-preview: :class:`TrustedAccessRolesOperations` + * 2023-02-02-preview: :class:`TrustedAccessRolesOperations` + * 2023-03-02-preview: :class:`TrustedAccessRolesOperations` + * 2023-04-02-preview: :class:`TrustedAccessRolesOperations` + * 2023-05-02-preview: :class:`TrustedAccessRolesOperations` + * 2023-06-02-preview: :class:`TrustedAccessRolesOperations` + * 2023-07-02-preview: :class:`TrustedAccessRolesOperations` + * 2023-08-02-preview: :class:`TrustedAccessRolesOperations` + * 2023-09-01: :class:`TrustedAccessRolesOperations` + * 2023-09-02-preview: :class:`TrustedAccessRolesOperations` + * 2023-10-01: :class:`TrustedAccessRolesOperations` + * 2023-10-02-preview: :class:`TrustedAccessRolesOperations` + * 2023-11-01: :class:`TrustedAccessRolesOperations` + * 2023-11-02-preview: :class:`TrustedAccessRolesOperations` + * 2024-01-01: :class:`TrustedAccessRolesOperations` + * 2024-01-02-preview: :class:`TrustedAccessRolesOperations` + * 2024-02-01: :class:`TrustedAccessRolesOperations` + * 2024-02-02-preview: :class:`TrustedAccessRolesOperations` + * 2024-03-02-preview: :class:`TrustedAccessRolesOperations` + * 2024-04-02-preview: :class:`TrustedAccessRolesOperations` + * 2024-05-01: :class:`TrustedAccessRolesOperations` + * 2024-05-02-preview: :class:`TrustedAccessRolesOperations` + * 2024-06-02-preview: :class:`TrustedAccessRolesOperations` + * 2024-07-01: :class:`TrustedAccessRolesOperations` + * 2024-07-02-preview: :class:`TrustedAccessRolesOperations` + * 2024-08-01: :class:`TrustedAccessRolesOperations` """ - api_version = self._get_api_version('trusted_access_roles') - if api_version == '2022-04-02-preview': + api_version = self._get_api_version("trusted_access_roles") + if api_version == "2022-04-02-preview": from .v2022_04_02_preview.operations import TrustedAccessRolesOperations as OperationClass - elif api_version == '2022-05-02-preview': + elif api_version == "2022-05-02-preview": from .v2022_05_02_preview.operations import TrustedAccessRolesOperations as OperationClass - elif api_version == '2022-06-02-preview': + elif api_version == "2022-06-02-preview": from .v2022_06_02_preview.operations import TrustedAccessRolesOperations as OperationClass - elif api_version == '2022-07-02-preview': + elif api_version == "2022-07-02-preview": from .v2022_07_02_preview.operations import TrustedAccessRolesOperations as OperationClass - elif api_version == '2022-08-02-preview': + elif api_version == "2022-08-02-preview": from .v2022_08_02_preview.operations import TrustedAccessRolesOperations as OperationClass - elif api_version == '2022-08-03-preview': + elif api_version == "2022-08-03-preview": from .v2022_08_03_preview.operations import TrustedAccessRolesOperations as OperationClass - elif api_version == '2022-09-02-preview': + elif api_version == "2022-09-02-preview": from .v2022_09_02_preview.operations import TrustedAccessRolesOperations as OperationClass - elif api_version == '2022-10-02-preview': + elif api_version == "2022-10-02-preview": from .v2022_10_02_preview.operations import TrustedAccessRolesOperations as OperationClass - elif api_version == '2022-11-02-preview': + elif api_version == "2022-11-02-preview": from .v2022_11_02_preview.operations import TrustedAccessRolesOperations as OperationClass - elif api_version == '2023-01-02-preview': + elif api_version == "2023-01-02-preview": from .v2023_01_02_preview.operations import TrustedAccessRolesOperations as OperationClass - elif api_version == '2023-02-02-preview': + elif api_version == "2023-02-02-preview": from .v2023_02_02_preview.operations import TrustedAccessRolesOperations as OperationClass - elif api_version == '2023-03-02-preview': + elif api_version == "2023-03-02-preview": from .v2023_03_02_preview.operations import TrustedAccessRolesOperations as OperationClass - elif api_version == '2023-04-02-preview': + elif api_version == "2023-04-02-preview": from .v2023_04_02_preview.operations import TrustedAccessRolesOperations as OperationClass - elif api_version == '2023-05-02-preview': + elif api_version == "2023-05-02-preview": from .v2023_05_02_preview.operations import TrustedAccessRolesOperations as OperationClass - elif api_version == '2023-06-02-preview': + elif api_version == "2023-06-02-preview": from .v2023_06_02_preview.operations import TrustedAccessRolesOperations as OperationClass - elif api_version == '2023-07-02-preview': + elif api_version == "2023-07-02-preview": from .v2023_07_02_preview.operations import TrustedAccessRolesOperations as OperationClass - elif api_version == '2023-08-02-preview': + elif api_version == "2023-08-02-preview": from .v2023_08_02_preview.operations import TrustedAccessRolesOperations as OperationClass - elif api_version == '2023-09-01': + elif api_version == "2023-09-01": from .v2023_09_01.operations import TrustedAccessRolesOperations as OperationClass - elif api_version == '2023-09-02-preview': + elif api_version == "2023-09-02-preview": from .v2023_09_02_preview.operations import TrustedAccessRolesOperations as OperationClass - elif api_version == '2023-10-01': + elif api_version == "2023-10-01": from .v2023_10_01.operations import TrustedAccessRolesOperations as OperationClass - elif api_version == '2023-10-02-preview': + elif api_version == "2023-10-02-preview": from .v2023_10_02_preview.operations import TrustedAccessRolesOperations as OperationClass - elif api_version == '2023-11-01': + elif api_version == "2023-11-01": from .v2023_11_01.operations import TrustedAccessRolesOperations as OperationClass - elif api_version == '2023-11-02-preview': + elif api_version == "2023-11-02-preview": from .v2023_11_02_preview.operations import TrustedAccessRolesOperations as OperationClass - elif api_version == '2024-01-01': + elif api_version == "2024-01-01": from .v2024_01_01.operations import TrustedAccessRolesOperations as OperationClass - elif api_version == '2024-01-02-preview': + elif api_version == "2024-01-02-preview": from .v2024_01_02_preview.operations import TrustedAccessRolesOperations as OperationClass - elif api_version == '2024-02-01': + elif api_version == "2024-02-01": from .v2024_02_01.operations import TrustedAccessRolesOperations as OperationClass - elif api_version == '2024-02-02-preview': + elif api_version == "2024-02-02-preview": from .v2024_02_02_preview.operations import TrustedAccessRolesOperations as OperationClass - elif api_version == '2024-03-02-preview': + elif api_version == "2024-03-02-preview": from .v2024_03_02_preview.operations import TrustedAccessRolesOperations as OperationClass - elif api_version == '2024-04-02-preview': + elif api_version == "2024-04-02-preview": from .v2024_04_02_preview.operations import TrustedAccessRolesOperations as OperationClass - elif api_version == '2024-05-01': + elif api_version == "2024-05-01": from .v2024_05_01.operations import TrustedAccessRolesOperations as OperationClass - elif api_version == '2024-05-02-preview': + elif api_version == "2024-05-02-preview": from .v2024_05_02_preview.operations import TrustedAccessRolesOperations as OperationClass - elif api_version == '2024-06-02-preview': + elif api_version == "2024-06-02-preview": from .v2024_06_02_preview.operations import TrustedAccessRolesOperations as OperationClass - elif api_version == '2024-07-01': + elif api_version == "2024-07-01": from .v2024_07_01.operations import TrustedAccessRolesOperations as OperationClass - elif api_version == '2024-07-02-preview': + elif api_version == "2024-07-02-preview": from .v2024_07_02_preview.operations import TrustedAccessRolesOperations as OperationClass - elif api_version == '2024-08-01': + elif api_version == "2024-08-01": from .v2024_08_01.operations import TrustedAccessRolesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'trusted_access_roles'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) + return OperationClass( + self._client, + self._config, + Serializer(self._models_dict(api_version)), + Deserializer(self._models_dict(api_version)), + api_version, + ) def close(self): self._client.close() + def __enter__(self): self._client.__enter__() return self + def __exit__(self, *exc_details): self._client.__exit__(*exc_details) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/_serialization.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/_serialization.py index 59f1fcf71bc97..8139854b97bb8 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/_serialization.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/_serialization.py @@ -351,9 +351,7 @@ def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: def as_dict( self, keep_readonly: bool = True, - key_transformer: Callable[ - [str, Dict[str, Any], Any], Any - ] = attribute_transformer, + key_transformer: Callable[[str, Dict[str, Any], Any], Any] = attribute_transformer, **kwargs: Any ) -> JSON: """Return a dict that can be serialized using json.dump. @@ -542,7 +540,7 @@ class Serializer(object): "multiple": lambda x, y: x % y != 0, } - def __init__(self, classes: Optional[Mapping[str, type]]=None): + def __init__(self, classes: Optional[Mapping[str, type]] = None): self.serialize_type = { "iso-8601": Serializer.serialize_iso, "rfc-1123": Serializer.serialize_rfc, @@ -750,7 +748,7 @@ def query(self, name, data, data_type, **kwargs): # Treat the list aside, since we don't want to encode the div separator if data_type.startswith("["): internal_data_type = data_type[1:-1] - do_quote = not kwargs.get('skip_quote', False) + do_quote = not kwargs.get("skip_quote", False) return self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs) # Not a list, regular serialization @@ -909,12 +907,8 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs): raise serialized.append(None) - if kwargs.get('do_quote', False): - serialized = [ - '' if s is None else quote(str(s), safe='') - for s - in serialized - ] + if kwargs.get("do_quote", False): + serialized = ["" if s is None else quote(str(s), safe="") for s in serialized] if div: serialized = ["" if s is None else str(s) for s in serialized] @@ -1371,7 +1365,7 @@ class Deserializer(object): valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - def __init__(self, classes: Optional[Mapping[str, type]]=None): + def __init__(self, classes: Optional[Mapping[str, type]] = None): self.deserialize_type = { "iso-8601": Deserializer.deserialize_iso, "rfc-1123": Deserializer.deserialize_rfc, diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/aio/__init__.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/aio/__init__.py index 4ad2bb20096ae..85ecd9f6945a1 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/aio/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/aio/__init__.py @@ -7,4 +7,5 @@ # -------------------------------------------------------------------------- from ._container_service_client import ContainerServiceClient -__all__ = ['ContainerServiceClient'] + +__all__ = ["ContainerServiceClient"] diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/aio/_configuration.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/aio/_configuration.py index 5cb904176b593..d9ca4ef75b017 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/aio/_configuration.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/aio/_configuration.py @@ -19,6 +19,7 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential + class ContainerServiceClientConfiguration: """Configuration for ContainerServiceClient. @@ -31,12 +32,7 @@ class ContainerServiceClientConfiguration: :type subscription_id: str """ - def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - **kwargs: Any - ) -> None: + 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: @@ -44,23 +40,22 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'azure-mgmt-containerservice/{}'.format(VERSION)) + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "azure-mgmt-containerservice/{}".format(VERSION)) self.polling_interval = kwargs.get("polling_interval", 30) 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') + def _configure(self, **kwargs: Any) -> None: + self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs) + self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs) + self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs) + self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs) + self.http_logging_policy = kwargs.get("http_logging_policy") or ARMHttpLoggingPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/aio/_container_service_client.py b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/aio/_container_service_client.py index 98621e3a1944b..01124443a6c93 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/aio/_container_service_client.py +++ b/sdk/containerservice/azure-mgmt-containerservice/azure/mgmt/containerservice/aio/_container_service_client.py @@ -25,6 +25,7 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential + class _SDKClient(object): def __init__(self, *args, **kwargs): """This is a fake class to support current implemetation of MultiApiClientMixin." @@ -32,6 +33,7 @@ def __init__(self, *args, **kwargs): """ pass + class ContainerServiceClient(MultiApiClientMixin, _SDKClient): """The Container Service Client. @@ -56,20 +58,22 @@ class ContainerServiceClient(MultiApiClientMixin, _SDKClient): :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. """ - DEFAULT_API_VERSION = '2024-08-01' + DEFAULT_API_VERSION = "2024-08-01" _PROFILE_TAG = "azure.mgmt.containerservice.ContainerServiceClient" - LATEST_PROFILE = ProfileDefinition({ - _PROFILE_TAG: { - None: DEFAULT_API_VERSION, - 'container_services': '2019-04-01', - 'fleet_members': '2022-09-02-preview', - 'fleets': '2022-09-02-preview', - 'load_balancers': '2024-07-02-preview', - 'managed_cluster_snapshots': '2024-07-02-preview', - 'open_shift_managed_clusters': '2019-04-30', - 'operation_status_result': '2024-07-02-preview', - }}, - _PROFILE_TAG + " latest" + LATEST_PROFILE = ProfileDefinition( + { + _PROFILE_TAG: { + None: DEFAULT_API_VERSION, + "container_services": "2019-04-01", + "fleet_members": "2022-09-02-preview", + "fleets": "2022-09-02-preview", + "load_balancers": "2024-07-02-preview", + "managed_cluster_snapshots": "2024-07-02-preview", + "open_shift_managed_clusters": "2019-04-30", + "operation_status_result": "2024-07-02-preview", + } + }, + _PROFILE_TAG + " latest", ) def __init__( @@ -82,7 +86,7 @@ def __init__( **kwargs: Any ) -> None: if api_version: - kwargs.setdefault('api_version', api_version) + kwargs.setdefault("api_version", api_version) self._config = ContainerServiceClientConfiguration(credential, subscription_id, **kwargs) _policies = kwargs.pop("policies", None) if _policies is None: @@ -103,10 +107,7 @@ def __init__( self._config.http_logging_policy, ] self._client = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) - super(ContainerServiceClient, self).__init__( - api_version=api_version, - profile=profile - ) + super(ContainerServiceClient, self).__init__(api_version=api_version, profile=profile) @classmethod def _models_dict(cls, api_version): @@ -116,342 +117,426 @@ def _models_dict(cls, api_version): def models(cls, api_version=DEFAULT_API_VERSION): """Module depends on the API version: - * 2017-07-01: :mod:`v2017_07_01.models` - * 2018-03-31: :mod:`v2018_03_31.models` - * 2018-08-01-preview: :mod:`v2018_08_01_preview.models` - * 2018-09-30-preview: :mod:`v2018_09_30_preview.models` - * 2019-02-01: :mod:`v2019_02_01.models` - * 2019-04-01: :mod:`v2019_04_01.models` - * 2019-04-30: :mod:`v2019_04_30.models` - * 2019-06-01: :mod:`v2019_06_01.models` - * 2019-08-01: :mod:`v2019_08_01.models` - * 2019-09-30-preview: :mod:`v2019_09_30_preview.models` - * 2019-10-01: :mod:`v2019_10_01.models` - * 2019-10-27-preview: :mod:`v2019_10_27_preview.models` - * 2019-11-01: :mod:`v2019_11_01.models` - * 2020-01-01: :mod:`v2020_01_01.models` - * 2020-02-01: :mod:`v2020_02_01.models` - * 2020-03-01: :mod:`v2020_03_01.models` - * 2020-04-01: :mod:`v2020_04_01.models` - * 2020-06-01: :mod:`v2020_06_01.models` - * 2020-07-01: :mod:`v2020_07_01.models` - * 2020-09-01: :mod:`v2020_09_01.models` - * 2020-11-01: :mod:`v2020_11_01.models` - * 2020-12-01: :mod:`v2020_12_01.models` - * 2021-02-01: :mod:`v2021_02_01.models` - * 2021-03-01: :mod:`v2021_03_01.models` - * 2021-05-01: :mod:`v2021_05_01.models` - * 2021-07-01: :mod:`v2021_07_01.models` - * 2021-08-01: :mod:`v2021_08_01.models` - * 2021-09-01: :mod:`v2021_09_01.models` - * 2021-10-01: :mod:`v2021_10_01.models` - * 2021-11-01-preview: :mod:`v2021_11_01_preview.models` - * 2022-01-01: :mod:`v2022_01_01.models` - * 2022-01-02-preview: :mod:`v2022_01_02_preview.models` - * 2022-02-01: :mod:`v2022_02_01.models` - * 2022-02-02-preview: :mod:`v2022_02_02_preview.models` - * 2022-03-01: :mod:`v2022_03_01.models` - * 2022-03-02-preview: :mod:`v2022_03_02_preview.models` - * 2022-04-01: :mod:`v2022_04_01.models` - * 2022-04-02-preview: :mod:`v2022_04_02_preview.models` - * 2022-05-02-preview: :mod:`v2022_05_02_preview.models` - * 2022-06-01: :mod:`v2022_06_01.models` - * 2022-06-02-preview: :mod:`v2022_06_02_preview.models` - * 2022-07-01: :mod:`v2022_07_01.models` - * 2022-07-02-preview: :mod:`v2022_07_02_preview.models` - * 2022-08-02-preview: :mod:`v2022_08_02_preview.models` - * 2022-08-03-preview: :mod:`v2022_08_03_preview.models` - * 2022-09-01: :mod:`v2022_09_01.models` - * 2022-09-02-preview: :mod:`v2022_09_02_preview.models` - * 2022-10-02-preview: :mod:`v2022_10_02_preview.models` - * 2022-11-01: :mod:`v2022_11_01.models` - * 2022-11-02-preview: :mod:`v2022_11_02_preview.models` - * 2023-01-01: :mod:`v2023_01_01.models` - * 2023-01-02-preview: :mod:`v2023_01_02_preview.models` - * 2023-02-01: :mod:`v2023_02_01.models` - * 2023-02-02-preview: :mod:`v2023_02_02_preview.models` - * 2023-03-01: :mod:`v2023_03_01.models` - * 2023-03-02-preview: :mod:`v2023_03_02_preview.models` - * 2023-04-01: :mod:`v2023_04_01.models` - * 2023-04-02-preview: :mod:`v2023_04_02_preview.models` - * 2023-05-01: :mod:`v2023_05_01.models` - * 2023-05-02-preview: :mod:`v2023_05_02_preview.models` - * 2023-06-01: :mod:`v2023_06_01.models` - * 2023-06-02-preview: :mod:`v2023_06_02_preview.models` - * 2023-07-01: :mod:`v2023_07_01.models` - * 2023-07-02-preview: :mod:`v2023_07_02_preview.models` - * 2023-08-01: :mod:`v2023_08_01.models` - * 2023-08-02-preview: :mod:`v2023_08_02_preview.models` - * 2023-09-01: :mod:`v2023_09_01.models` - * 2023-09-02-preview: :mod:`v2023_09_02_preview.models` - * 2023-10-01: :mod:`v2023_10_01.models` - * 2023-10-02-preview: :mod:`v2023_10_02_preview.models` - * 2023-11-01: :mod:`v2023_11_01.models` - * 2023-11-02-preview: :mod:`v2023_11_02_preview.models` - * 2024-01-01: :mod:`v2024_01_01.models` - * 2024-01-02-preview: :mod:`v2024_01_02_preview.models` - * 2024-02-01: :mod:`v2024_02_01.models` - * 2024-02-02-preview: :mod:`v2024_02_02_preview.models` - * 2024-03-02-preview: :mod:`v2024_03_02_preview.models` - * 2024-04-02-preview: :mod:`v2024_04_02_preview.models` - * 2024-05-01: :mod:`v2024_05_01.models` - * 2024-05-02-preview: :mod:`v2024_05_02_preview.models` - * 2024-06-02-preview: :mod:`v2024_06_02_preview.models` - * 2024-07-01: :mod:`v2024_07_01.models` - * 2024-07-02-preview: :mod:`v2024_07_02_preview.models` - * 2024-08-01: :mod:`v2024_08_01.models` + * 2017-07-01: :mod:`v2017_07_01.models` + * 2018-03-31: :mod:`v2018_03_31.models` + * 2018-08-01-preview: :mod:`v2018_08_01_preview.models` + * 2018-09-30-preview: :mod:`v2018_09_30_preview.models` + * 2019-02-01: :mod:`v2019_02_01.models` + * 2019-04-01: :mod:`v2019_04_01.models` + * 2019-04-30: :mod:`v2019_04_30.models` + * 2019-06-01: :mod:`v2019_06_01.models` + * 2019-08-01: :mod:`v2019_08_01.models` + * 2019-09-30-preview: :mod:`v2019_09_30_preview.models` + * 2019-10-01: :mod:`v2019_10_01.models` + * 2019-10-27-preview: :mod:`v2019_10_27_preview.models` + * 2019-11-01: :mod:`v2019_11_01.models` + * 2020-01-01: :mod:`v2020_01_01.models` + * 2020-02-01: :mod:`v2020_02_01.models` + * 2020-03-01: :mod:`v2020_03_01.models` + * 2020-04-01: :mod:`v2020_04_01.models` + * 2020-06-01: :mod:`v2020_06_01.models` + * 2020-07-01: :mod:`v2020_07_01.models` + * 2020-09-01: :mod:`v2020_09_01.models` + * 2020-11-01: :mod:`v2020_11_01.models` + * 2020-12-01: :mod:`v2020_12_01.models` + * 2021-02-01: :mod:`v2021_02_01.models` + * 2021-03-01: :mod:`v2021_03_01.models` + * 2021-05-01: :mod:`v2021_05_01.models` + * 2021-07-01: :mod:`v2021_07_01.models` + * 2021-08-01: :mod:`v2021_08_01.models` + * 2021-09-01: :mod:`v2021_09_01.models` + * 2021-10-01: :mod:`v2021_10_01.models` + * 2021-11-01-preview: :mod:`v2021_11_01_preview.models` + * 2022-01-01: :mod:`v2022_01_01.models` + * 2022-01-02-preview: :mod:`v2022_01_02_preview.models` + * 2022-02-01: :mod:`v2022_02_01.models` + * 2022-02-02-preview: :mod:`v2022_02_02_preview.models` + * 2022-03-01: :mod:`v2022_03_01.models` + * 2022-03-02-preview: :mod:`v2022_03_02_preview.models` + * 2022-04-01: :mod:`v2022_04_01.models` + * 2022-04-02-preview: :mod:`v2022_04_02_preview.models` + * 2022-05-02-preview: :mod:`v2022_05_02_preview.models` + * 2022-06-01: :mod:`v2022_06_01.models` + * 2022-06-02-preview: :mod:`v2022_06_02_preview.models` + * 2022-07-01: :mod:`v2022_07_01.models` + * 2022-07-02-preview: :mod:`v2022_07_02_preview.models` + * 2022-08-02-preview: :mod:`v2022_08_02_preview.models` + * 2022-08-03-preview: :mod:`v2022_08_03_preview.models` + * 2022-09-01: :mod:`v2022_09_01.models` + * 2022-09-02-preview: :mod:`v2022_09_02_preview.models` + * 2022-10-02-preview: :mod:`v2022_10_02_preview.models` + * 2022-11-01: :mod:`v2022_11_01.models` + * 2022-11-02-preview: :mod:`v2022_11_02_preview.models` + * 2023-01-01: :mod:`v2023_01_01.models` + * 2023-01-02-preview: :mod:`v2023_01_02_preview.models` + * 2023-02-01: :mod:`v2023_02_01.models` + * 2023-02-02-preview: :mod:`v2023_02_02_preview.models` + * 2023-03-01: :mod:`v2023_03_01.models` + * 2023-03-02-preview: :mod:`v2023_03_02_preview.models` + * 2023-04-01: :mod:`v2023_04_01.models` + * 2023-04-02-preview: :mod:`v2023_04_02_preview.models` + * 2023-05-01: :mod:`v2023_05_01.models` + * 2023-05-02-preview: :mod:`v2023_05_02_preview.models` + * 2023-06-01: :mod:`v2023_06_01.models` + * 2023-06-02-preview: :mod:`v2023_06_02_preview.models` + * 2023-07-01: :mod:`v2023_07_01.models` + * 2023-07-02-preview: :mod:`v2023_07_02_preview.models` + * 2023-08-01: :mod:`v2023_08_01.models` + * 2023-08-02-preview: :mod:`v2023_08_02_preview.models` + * 2023-09-01: :mod:`v2023_09_01.models` + * 2023-09-02-preview: :mod:`v2023_09_02_preview.models` + * 2023-10-01: :mod:`v2023_10_01.models` + * 2023-10-02-preview: :mod:`v2023_10_02_preview.models` + * 2023-11-01: :mod:`v2023_11_01.models` + * 2023-11-02-preview: :mod:`v2023_11_02_preview.models` + * 2024-01-01: :mod:`v2024_01_01.models` + * 2024-01-02-preview: :mod:`v2024_01_02_preview.models` + * 2024-02-01: :mod:`v2024_02_01.models` + * 2024-02-02-preview: :mod:`v2024_02_02_preview.models` + * 2024-03-02-preview: :mod:`v2024_03_02_preview.models` + * 2024-04-02-preview: :mod:`v2024_04_02_preview.models` + * 2024-05-01: :mod:`v2024_05_01.models` + * 2024-05-02-preview: :mod:`v2024_05_02_preview.models` + * 2024-06-02-preview: :mod:`v2024_06_02_preview.models` + * 2024-07-01: :mod:`v2024_07_01.models` + * 2024-07-02-preview: :mod:`v2024_07_02_preview.models` + * 2024-08-01: :mod:`v2024_08_01.models` """ - if api_version == '2017-07-01': + if api_version == "2017-07-01": from ..v2017_07_01 import models + return models - elif api_version == '2018-03-31': + elif api_version == "2018-03-31": from ..v2018_03_31 import models + return models - elif api_version == '2018-08-01-preview': + elif api_version == "2018-08-01-preview": from ..v2018_08_01_preview import models + return models - elif api_version == '2018-09-30-preview': + elif api_version == "2018-09-30-preview": from ..v2018_09_30_preview import models + return models - elif api_version == '2019-02-01': + elif api_version == "2019-02-01": from ..v2019_02_01 import models + return models - elif api_version == '2019-04-01': + elif api_version == "2019-04-01": from ..v2019_04_01 import models + return models - elif api_version == '2019-04-30': + elif api_version == "2019-04-30": from ..v2019_04_30 import models + return models - elif api_version == '2019-06-01': + elif api_version == "2019-06-01": from ..v2019_06_01 import models + return models - elif api_version == '2019-08-01': + elif api_version == "2019-08-01": from ..v2019_08_01 import models + return models - elif api_version == '2019-09-30-preview': + elif api_version == "2019-09-30-preview": from ..v2019_09_30_preview import models + return models - elif api_version == '2019-10-01': + elif api_version == "2019-10-01": from ..v2019_10_01 import models + return models - elif api_version == '2019-10-27-preview': + elif api_version == "2019-10-27-preview": from ..v2019_10_27_preview import models + return models - elif api_version == '2019-11-01': + elif api_version == "2019-11-01": from ..v2019_11_01 import models + return models - elif api_version == '2020-01-01': + elif api_version == "2020-01-01": from ..v2020_01_01 import models + return models - elif api_version == '2020-02-01': + elif api_version == "2020-02-01": from ..v2020_02_01 import models + return models - elif api_version == '2020-03-01': + elif api_version == "2020-03-01": from ..v2020_03_01 import models + return models - elif api_version == '2020-04-01': + elif api_version == "2020-04-01": from ..v2020_04_01 import models + return models - elif api_version == '2020-06-01': + elif api_version == "2020-06-01": from ..v2020_06_01 import models + return models - elif api_version == '2020-07-01': + elif api_version == "2020-07-01": from ..v2020_07_01 import models + return models - elif api_version == '2020-09-01': + elif api_version == "2020-09-01": from ..v2020_09_01 import models + return models - elif api_version == '2020-11-01': + elif api_version == "2020-11-01": from ..v2020_11_01 import models + return models - elif api_version == '2020-12-01': + elif api_version == "2020-12-01": from ..v2020_12_01 import models + return models - elif api_version == '2021-02-01': + elif api_version == "2021-02-01": from ..v2021_02_01 import models + return models - elif api_version == '2021-03-01': + elif api_version == "2021-03-01": from ..v2021_03_01 import models + return models - elif api_version == '2021-05-01': + elif api_version == "2021-05-01": from ..v2021_05_01 import models + return models - elif api_version == '2021-07-01': + elif api_version == "2021-07-01": from ..v2021_07_01 import models + return models - elif api_version == '2021-08-01': + elif api_version == "2021-08-01": from ..v2021_08_01 import models + return models - elif api_version == '2021-09-01': + elif api_version == "2021-09-01": from ..v2021_09_01 import models + return models - elif api_version == '2021-10-01': + elif api_version == "2021-10-01": from ..v2021_10_01 import models + return models - elif api_version == '2021-11-01-preview': + elif api_version == "2021-11-01-preview": from ..v2021_11_01_preview import models + return models - elif api_version == '2022-01-01': + elif api_version == "2022-01-01": from ..v2022_01_01 import models + return models - elif api_version == '2022-01-02-preview': + elif api_version == "2022-01-02-preview": from ..v2022_01_02_preview import models + return models - elif api_version == '2022-02-01': + elif api_version == "2022-02-01": from ..v2022_02_01 import models + return models - elif api_version == '2022-02-02-preview': + elif api_version == "2022-02-02-preview": from ..v2022_02_02_preview import models + return models - elif api_version == '2022-03-01': + elif api_version == "2022-03-01": from ..v2022_03_01 import models + return models - elif api_version == '2022-03-02-preview': + elif api_version == "2022-03-02-preview": from ..v2022_03_02_preview import models + return models - elif api_version == '2022-04-01': + elif api_version == "2022-04-01": from ..v2022_04_01 import models + return models - elif api_version == '2022-04-02-preview': + elif api_version == "2022-04-02-preview": from ..v2022_04_02_preview import models + return models - elif api_version == '2022-05-02-preview': + elif api_version == "2022-05-02-preview": from ..v2022_05_02_preview import models + return models - elif api_version == '2022-06-01': + elif api_version == "2022-06-01": from ..v2022_06_01 import models + return models - elif api_version == '2022-06-02-preview': + elif api_version == "2022-06-02-preview": from ..v2022_06_02_preview import models + return models - elif api_version == '2022-07-01': + elif api_version == "2022-07-01": from ..v2022_07_01 import models + return models - elif api_version == '2022-07-02-preview': + elif api_version == "2022-07-02-preview": from ..v2022_07_02_preview import models + return models - elif api_version == '2022-08-02-preview': + elif api_version == "2022-08-02-preview": from ..v2022_08_02_preview import models + return models - elif api_version == '2022-08-03-preview': + elif api_version == "2022-08-03-preview": from ..v2022_08_03_preview import models + return models - elif api_version == '2022-09-01': + elif api_version == "2022-09-01": from ..v2022_09_01 import models + return models - elif api_version == '2022-09-02-preview': + elif api_version == "2022-09-02-preview": from ..v2022_09_02_preview import models + return models - elif api_version == '2022-10-02-preview': + elif api_version == "2022-10-02-preview": from ..v2022_10_02_preview import models + return models - elif api_version == '2022-11-01': + elif api_version == "2022-11-01": from ..v2022_11_01 import models + return models - elif api_version == '2022-11-02-preview': + elif api_version == "2022-11-02-preview": from ..v2022_11_02_preview import models + return models - elif api_version == '2023-01-01': + elif api_version == "2023-01-01": from ..v2023_01_01 import models + return models - elif api_version == '2023-01-02-preview': + elif api_version == "2023-01-02-preview": from ..v2023_01_02_preview import models + return models - elif api_version == '2023-02-01': + elif api_version == "2023-02-01": from ..v2023_02_01 import models + return models - elif api_version == '2023-02-02-preview': + elif api_version == "2023-02-02-preview": from ..v2023_02_02_preview import models + return models - elif api_version == '2023-03-01': + elif api_version == "2023-03-01": from ..v2023_03_01 import models + return models - elif api_version == '2023-03-02-preview': + elif api_version == "2023-03-02-preview": from ..v2023_03_02_preview import models + return models - elif api_version == '2023-04-01': + elif api_version == "2023-04-01": from ..v2023_04_01 import models + return models - elif api_version == '2023-04-02-preview': + elif api_version == "2023-04-02-preview": from ..v2023_04_02_preview import models + return models - elif api_version == '2023-05-01': + elif api_version == "2023-05-01": from ..v2023_05_01 import models + return models - elif api_version == '2023-05-02-preview': + elif api_version == "2023-05-02-preview": from ..v2023_05_02_preview import models + return models - elif api_version == '2023-06-01': + elif api_version == "2023-06-01": from ..v2023_06_01 import models + return models - elif api_version == '2023-06-02-preview': + elif api_version == "2023-06-02-preview": from ..v2023_06_02_preview import models + return models - elif api_version == '2023-07-01': + elif api_version == "2023-07-01": from ..v2023_07_01 import models + return models - elif api_version == '2023-07-02-preview': + elif api_version == "2023-07-02-preview": from ..v2023_07_02_preview import models + return models - elif api_version == '2023-08-01': + elif api_version == "2023-08-01": from ..v2023_08_01 import models + return models - elif api_version == '2023-08-02-preview': + elif api_version == "2023-08-02-preview": from ..v2023_08_02_preview import models + return models - elif api_version == '2023-09-01': + elif api_version == "2023-09-01": from ..v2023_09_01 import models + return models - elif api_version == '2023-09-02-preview': + elif api_version == "2023-09-02-preview": from ..v2023_09_02_preview import models + return models - elif api_version == '2023-10-01': + elif api_version == "2023-10-01": from ..v2023_10_01 import models + return models - elif api_version == '2023-10-02-preview': + elif api_version == "2023-10-02-preview": from ..v2023_10_02_preview import models + return models - elif api_version == '2023-11-01': + elif api_version == "2023-11-01": from ..v2023_11_01 import models + return models - elif api_version == '2023-11-02-preview': + elif api_version == "2023-11-02-preview": from ..v2023_11_02_preview import models + return models - elif api_version == '2024-01-01': + elif api_version == "2024-01-01": from ..v2024_01_01 import models + return models - elif api_version == '2024-01-02-preview': + elif api_version == "2024-01-02-preview": from ..v2024_01_02_preview import models + return models - elif api_version == '2024-02-01': + elif api_version == "2024-02-01": from ..v2024_02_01 import models + return models - elif api_version == '2024-02-02-preview': + elif api_version == "2024-02-02-preview": from ..v2024_02_02_preview import models + return models - elif api_version == '2024-03-02-preview': + elif api_version == "2024-03-02-preview": from ..v2024_03_02_preview import models + return models - elif api_version == '2024-04-02-preview': + elif api_version == "2024-04-02-preview": from ..v2024_04_02_preview import models + return models - elif api_version == '2024-05-01': + elif api_version == "2024-05-01": from ..v2024_05_01 import models + return models - elif api_version == '2024-05-02-preview': + elif api_version == "2024-05-02-preview": from ..v2024_05_02_preview import models + return models - elif api_version == '2024-06-02-preview': + elif api_version == "2024-06-02-preview": from ..v2024_06_02_preview import models + return models - elif api_version == '2024-07-01': + elif api_version == "2024-07-01": from ..v2024_07_01 import models + return models - elif api_version == '2024-07-02-preview': + elif api_version == "2024-07-02-preview": from ..v2024_07_02_preview import models + return models - elif api_version == '2024-08-01': + elif api_version == "2024-08-01": from ..v2024_08_01 import models + return models raise ValueError("API version {} is not available".format(api_version)) @@ -459,2280 +544,2406 @@ def models(cls, api_version=DEFAULT_API_VERSION): def agent_pools(self): """Instance depends on the API version: - * 2019-02-01: :class:`AgentPoolsOperations` - * 2019-04-01: :class:`AgentPoolsOperations` - * 2019-06-01: :class:`AgentPoolsOperations` - * 2019-08-01: :class:`AgentPoolsOperations` - * 2019-10-01: :class:`AgentPoolsOperations` - * 2019-11-01: :class:`AgentPoolsOperations` - * 2020-01-01: :class:`AgentPoolsOperations` - * 2020-02-01: :class:`AgentPoolsOperations` - * 2020-03-01: :class:`AgentPoolsOperations` - * 2020-04-01: :class:`AgentPoolsOperations` - * 2020-06-01: :class:`AgentPoolsOperations` - * 2020-07-01: :class:`AgentPoolsOperations` - * 2020-09-01: :class:`AgentPoolsOperations` - * 2020-11-01: :class:`AgentPoolsOperations` - * 2020-12-01: :class:`AgentPoolsOperations` - * 2021-02-01: :class:`AgentPoolsOperations` - * 2021-03-01: :class:`AgentPoolsOperations` - * 2021-05-01: :class:`AgentPoolsOperations` - * 2021-07-01: :class:`AgentPoolsOperations` - * 2021-08-01: :class:`AgentPoolsOperations` - * 2021-09-01: :class:`AgentPoolsOperations` - * 2021-10-01: :class:`AgentPoolsOperations` - * 2021-11-01-preview: :class:`AgentPoolsOperations` - * 2022-01-01: :class:`AgentPoolsOperations` - * 2022-01-02-preview: :class:`AgentPoolsOperations` - * 2022-02-01: :class:`AgentPoolsOperations` - * 2022-02-02-preview: :class:`AgentPoolsOperations` - * 2022-03-01: :class:`AgentPoolsOperations` - * 2022-03-02-preview: :class:`AgentPoolsOperations` - * 2022-04-01: :class:`AgentPoolsOperations` - * 2022-04-02-preview: :class:`AgentPoolsOperations` - * 2022-05-02-preview: :class:`AgentPoolsOperations` - * 2022-06-01: :class:`AgentPoolsOperations` - * 2022-06-02-preview: :class:`AgentPoolsOperations` - * 2022-07-01: :class:`AgentPoolsOperations` - * 2022-07-02-preview: :class:`AgentPoolsOperations` - * 2022-08-02-preview: :class:`AgentPoolsOperations` - * 2022-08-03-preview: :class:`AgentPoolsOperations` - * 2022-09-01: :class:`AgentPoolsOperations` - * 2022-09-02-preview: :class:`AgentPoolsOperations` - * 2022-10-02-preview: :class:`AgentPoolsOperations` - * 2022-11-01: :class:`AgentPoolsOperations` - * 2022-11-02-preview: :class:`AgentPoolsOperations` - * 2023-01-01: :class:`AgentPoolsOperations` - * 2023-01-02-preview: :class:`AgentPoolsOperations` - * 2023-02-01: :class:`AgentPoolsOperations` - * 2023-02-02-preview: :class:`AgentPoolsOperations` - * 2023-03-01: :class:`AgentPoolsOperations` - * 2023-03-02-preview: :class:`AgentPoolsOperations` - * 2023-04-01: :class:`AgentPoolsOperations` - * 2023-04-02-preview: :class:`AgentPoolsOperations` - * 2023-05-01: :class:`AgentPoolsOperations` - * 2023-05-02-preview: :class:`AgentPoolsOperations` - * 2023-06-01: :class:`AgentPoolsOperations` - * 2023-06-02-preview: :class:`AgentPoolsOperations` - * 2023-07-01: :class:`AgentPoolsOperations` - * 2023-07-02-preview: :class:`AgentPoolsOperations` - * 2023-08-01: :class:`AgentPoolsOperations` - * 2023-08-02-preview: :class:`AgentPoolsOperations` - * 2023-09-01: :class:`AgentPoolsOperations` - * 2023-09-02-preview: :class:`AgentPoolsOperations` - * 2023-10-01: :class:`AgentPoolsOperations` - * 2023-10-02-preview: :class:`AgentPoolsOperations` - * 2023-11-01: :class:`AgentPoolsOperations` - * 2023-11-02-preview: :class:`AgentPoolsOperations` - * 2024-01-01: :class:`AgentPoolsOperations` - * 2024-01-02-preview: :class:`AgentPoolsOperations` - * 2024-02-01: :class:`AgentPoolsOperations` - * 2024-02-02-preview: :class:`AgentPoolsOperations` - * 2024-03-02-preview: :class:`AgentPoolsOperations` - * 2024-04-02-preview: :class:`AgentPoolsOperations` - * 2024-05-01: :class:`AgentPoolsOperations` - * 2024-05-02-preview: :class:`AgentPoolsOperations` - * 2024-06-02-preview: :class:`AgentPoolsOperations` - * 2024-07-01: :class:`AgentPoolsOperations` - * 2024-07-02-preview: :class:`AgentPoolsOperations` - * 2024-08-01: :class:`AgentPoolsOperations` + * 2019-02-01: :class:`AgentPoolsOperations` + * 2019-04-01: :class:`AgentPoolsOperations` + * 2019-06-01: :class:`AgentPoolsOperations` + * 2019-08-01: :class:`AgentPoolsOperations` + * 2019-10-01: :class:`AgentPoolsOperations` + * 2019-11-01: :class:`AgentPoolsOperations` + * 2020-01-01: :class:`AgentPoolsOperations` + * 2020-02-01: :class:`AgentPoolsOperations` + * 2020-03-01: :class:`AgentPoolsOperations` + * 2020-04-01: :class:`AgentPoolsOperations` + * 2020-06-01: :class:`AgentPoolsOperations` + * 2020-07-01: :class:`AgentPoolsOperations` + * 2020-09-01: :class:`AgentPoolsOperations` + * 2020-11-01: :class:`AgentPoolsOperations` + * 2020-12-01: :class:`AgentPoolsOperations` + * 2021-02-01: :class:`AgentPoolsOperations` + * 2021-03-01: :class:`AgentPoolsOperations` + * 2021-05-01: :class:`AgentPoolsOperations` + * 2021-07-01: :class:`AgentPoolsOperations` + * 2021-08-01: :class:`AgentPoolsOperations` + * 2021-09-01: :class:`AgentPoolsOperations` + * 2021-10-01: :class:`AgentPoolsOperations` + * 2021-11-01-preview: :class:`AgentPoolsOperations` + * 2022-01-01: :class:`AgentPoolsOperations` + * 2022-01-02-preview: :class:`AgentPoolsOperations` + * 2022-02-01: :class:`AgentPoolsOperations` + * 2022-02-02-preview: :class:`AgentPoolsOperations` + * 2022-03-01: :class:`AgentPoolsOperations` + * 2022-03-02-preview: :class:`AgentPoolsOperations` + * 2022-04-01: :class:`AgentPoolsOperations` + * 2022-04-02-preview: :class:`AgentPoolsOperations` + * 2022-05-02-preview: :class:`AgentPoolsOperations` + * 2022-06-01: :class:`AgentPoolsOperations` + * 2022-06-02-preview: :class:`AgentPoolsOperations` + * 2022-07-01: :class:`AgentPoolsOperations` + * 2022-07-02-preview: :class:`AgentPoolsOperations` + * 2022-08-02-preview: :class:`AgentPoolsOperations` + * 2022-08-03-preview: :class:`AgentPoolsOperations` + * 2022-09-01: :class:`AgentPoolsOperations` + * 2022-09-02-preview: :class:`AgentPoolsOperations` + * 2022-10-02-preview: :class:`AgentPoolsOperations` + * 2022-11-01: :class:`AgentPoolsOperations` + * 2022-11-02-preview: :class:`AgentPoolsOperations` + * 2023-01-01: :class:`AgentPoolsOperations` + * 2023-01-02-preview: :class:`AgentPoolsOperations` + * 2023-02-01: :class:`AgentPoolsOperations` + * 2023-02-02-preview: :class:`AgentPoolsOperations` + * 2023-03-01: :class:`AgentPoolsOperations` + * 2023-03-02-preview: :class:`AgentPoolsOperations` + * 2023-04-01: :class:`AgentPoolsOperations` + * 2023-04-02-preview: :class:`AgentPoolsOperations` + * 2023-05-01: :class:`AgentPoolsOperations` + * 2023-05-02-preview: :class:`AgentPoolsOperations` + * 2023-06-01: :class:`AgentPoolsOperations` + * 2023-06-02-preview: :class:`AgentPoolsOperations` + * 2023-07-01: :class:`AgentPoolsOperations` + * 2023-07-02-preview: :class:`AgentPoolsOperations` + * 2023-08-01: :class:`AgentPoolsOperations` + * 2023-08-02-preview: :class:`AgentPoolsOperations` + * 2023-09-01: :class:`AgentPoolsOperations` + * 2023-09-02-preview: :class:`AgentPoolsOperations` + * 2023-10-01: :class:`AgentPoolsOperations` + * 2023-10-02-preview: :class:`AgentPoolsOperations` + * 2023-11-01: :class:`AgentPoolsOperations` + * 2023-11-02-preview: :class:`AgentPoolsOperations` + * 2024-01-01: :class:`AgentPoolsOperations` + * 2024-01-02-preview: :class:`AgentPoolsOperations` + * 2024-02-01: :class:`AgentPoolsOperations` + * 2024-02-02-preview: :class:`AgentPoolsOperations` + * 2024-03-02-preview: :class:`AgentPoolsOperations` + * 2024-04-02-preview: :class:`AgentPoolsOperations` + * 2024-05-01: :class:`AgentPoolsOperations` + * 2024-05-02-preview: :class:`AgentPoolsOperations` + * 2024-06-02-preview: :class:`AgentPoolsOperations` + * 2024-07-01: :class:`AgentPoolsOperations` + * 2024-07-02-preview: :class:`AgentPoolsOperations` + * 2024-08-01: :class:`AgentPoolsOperations` """ - api_version = self._get_api_version('agent_pools') - if api_version == '2019-02-01': + api_version = self._get_api_version("agent_pools") + if api_version == "2019-02-01": from ..v2019_02_01.aio.operations import AgentPoolsOperations as OperationClass - elif api_version == '2019-04-01': + elif api_version == "2019-04-01": from ..v2019_04_01.aio.operations import AgentPoolsOperations as OperationClass - elif api_version == '2019-06-01': + elif api_version == "2019-06-01": from ..v2019_06_01.aio.operations import AgentPoolsOperations as OperationClass - elif api_version == '2019-08-01': + elif api_version == "2019-08-01": from ..v2019_08_01.aio.operations import AgentPoolsOperations as OperationClass - elif api_version == '2019-10-01': + elif api_version == "2019-10-01": from ..v2019_10_01.aio.operations import AgentPoolsOperations as OperationClass - elif api_version == '2019-11-01': + elif api_version == "2019-11-01": from ..v2019_11_01.aio.operations import AgentPoolsOperations as OperationClass - elif api_version == '2020-01-01': + elif api_version == "2020-01-01": from ..v2020_01_01.aio.operations import AgentPoolsOperations as OperationClass - elif api_version == '2020-02-01': + elif api_version == "2020-02-01": from ..v2020_02_01.aio.operations import AgentPoolsOperations as OperationClass - elif api_version == '2020-03-01': + elif api_version == "2020-03-01": from ..v2020_03_01.aio.operations import AgentPoolsOperations as OperationClass - elif api_version == '2020-04-01': + elif api_version == "2020-04-01": from ..v2020_04_01.aio.operations import AgentPoolsOperations as OperationClass - elif api_version == '2020-06-01': + elif api_version == "2020-06-01": from ..v2020_06_01.aio.operations import AgentPoolsOperations as OperationClass - elif api_version == '2020-07-01': + elif api_version == "2020-07-01": from ..v2020_07_01.aio.operations import AgentPoolsOperations as OperationClass - elif api_version == '2020-09-01': + elif api_version == "2020-09-01": from ..v2020_09_01.aio.operations import AgentPoolsOperations as OperationClass - elif api_version == '2020-11-01': + elif api_version == "2020-11-01": from ..v2020_11_01.aio.operations import AgentPoolsOperations as OperationClass - elif api_version == '2020-12-01': + elif api_version == "2020-12-01": from ..v2020_12_01.aio.operations import AgentPoolsOperations as OperationClass - elif api_version == '2021-02-01': + elif api_version == "2021-02-01": from ..v2021_02_01.aio.operations import AgentPoolsOperations as OperationClass - elif api_version == '2021-03-01': + elif api_version == "2021-03-01": from ..v2021_03_01.aio.operations import AgentPoolsOperations as OperationClass - elif api_version == '2021-05-01': + elif api_version == "2021-05-01": from ..v2021_05_01.aio.operations import AgentPoolsOperations as OperationClass - elif api_version == '2021-07-01': + elif api_version == "2021-07-01": from ..v2021_07_01.aio.operations import AgentPoolsOperations as OperationClass - elif api_version == '2021-08-01': + elif api_version == "2021-08-01": from ..v2021_08_01.aio.operations import AgentPoolsOperations as OperationClass - elif api_version == '2021-09-01': + elif api_version == "2021-09-01": from ..v2021_09_01.aio.operations import AgentPoolsOperations as OperationClass - elif api_version == '2021-10-01': + elif api_version == "2021-10-01": from ..v2021_10_01.aio.operations import AgentPoolsOperations as OperationClass - elif api_version == '2021-11-01-preview': + elif api_version == "2021-11-01-preview": from ..v2021_11_01_preview.aio.operations import AgentPoolsOperations as OperationClass - elif api_version == '2022-01-01': + elif api_version == "2022-01-01": from ..v2022_01_01.aio.operations import AgentPoolsOperations as OperationClass - elif api_version == '2022-01-02-preview': + elif api_version == "2022-01-02-preview": from ..v2022_01_02_preview.aio.operations import AgentPoolsOperations as OperationClass - elif api_version == '2022-02-01': + elif api_version == "2022-02-01": from ..v2022_02_01.aio.operations import AgentPoolsOperations as OperationClass - elif api_version == '2022-02-02-preview': + elif api_version == "2022-02-02-preview": from ..v2022_02_02_preview.aio.operations import AgentPoolsOperations as OperationClass - elif api_version == '2022-03-01': + elif api_version == "2022-03-01": from ..v2022_03_01.aio.operations import AgentPoolsOperations as OperationClass - elif api_version == '2022-03-02-preview': + elif api_version == "2022-03-02-preview": from ..v2022_03_02_preview.aio.operations import AgentPoolsOperations as OperationClass - elif api_version == '2022-04-01': + elif api_version == "2022-04-01": from ..v2022_04_01.aio.operations import AgentPoolsOperations as OperationClass - elif api_version == '2022-04-02-preview': + elif api_version == "2022-04-02-preview": from ..v2022_04_02_preview.aio.operations import AgentPoolsOperations as OperationClass - elif api_version == '2022-05-02-preview': + elif api_version == "2022-05-02-preview": from ..v2022_05_02_preview.aio.operations import AgentPoolsOperations as OperationClass - elif api_version == '2022-06-01': + elif api_version == "2022-06-01": from ..v2022_06_01.aio.operations import AgentPoolsOperations as OperationClass - elif api_version == '2022-06-02-preview': + elif api_version == "2022-06-02-preview": from ..v2022_06_02_preview.aio.operations import AgentPoolsOperations as OperationClass - elif api_version == '2022-07-01': + elif api_version == "2022-07-01": from ..v2022_07_01.aio.operations import AgentPoolsOperations as OperationClass - elif api_version == '2022-07-02-preview': + elif api_version == "2022-07-02-preview": from ..v2022_07_02_preview.aio.operations import AgentPoolsOperations as OperationClass - elif api_version == '2022-08-02-preview': + elif api_version == "2022-08-02-preview": from ..v2022_08_02_preview.aio.operations import AgentPoolsOperations as OperationClass - elif api_version == '2022-08-03-preview': + elif api_version == "2022-08-03-preview": from ..v2022_08_03_preview.aio.operations import AgentPoolsOperations as OperationClass - elif api_version == '2022-09-01': + elif api_version == "2022-09-01": from ..v2022_09_01.aio.operations import AgentPoolsOperations as OperationClass - elif api_version == '2022-09-02-preview': + elif api_version == "2022-09-02-preview": from ..v2022_09_02_preview.aio.operations import AgentPoolsOperations as OperationClass - elif api_version == '2022-10-02-preview': + elif api_version == "2022-10-02-preview": from ..v2022_10_02_preview.aio.operations import AgentPoolsOperations as OperationClass - elif api_version == '2022-11-01': + elif api_version == "2022-11-01": from ..v2022_11_01.aio.operations import AgentPoolsOperations as OperationClass - elif api_version == '2022-11-02-preview': + elif api_version == "2022-11-02-preview": from ..v2022_11_02_preview.aio.operations import AgentPoolsOperations as OperationClass - elif api_version == '2023-01-01': + elif api_version == "2023-01-01": from ..v2023_01_01.aio.operations import AgentPoolsOperations as OperationClass - elif api_version == '2023-01-02-preview': + elif api_version == "2023-01-02-preview": from ..v2023_01_02_preview.aio.operations import AgentPoolsOperations as OperationClass - elif api_version == '2023-02-01': + elif api_version == "2023-02-01": from ..v2023_02_01.aio.operations import AgentPoolsOperations as OperationClass - elif api_version == '2023-02-02-preview': + elif api_version == "2023-02-02-preview": from ..v2023_02_02_preview.aio.operations import AgentPoolsOperations as OperationClass - elif api_version == '2023-03-01': + elif api_version == "2023-03-01": from ..v2023_03_01.aio.operations import AgentPoolsOperations as OperationClass - elif api_version == '2023-03-02-preview': + elif api_version == "2023-03-02-preview": from ..v2023_03_02_preview.aio.operations import AgentPoolsOperations as OperationClass - elif api_version == '2023-04-01': + elif api_version == "2023-04-01": from ..v2023_04_01.aio.operations import AgentPoolsOperations as OperationClass - elif api_version == '2023-04-02-preview': + elif api_version == "2023-04-02-preview": from ..v2023_04_02_preview.aio.operations import AgentPoolsOperations as OperationClass - elif api_version == '2023-05-01': + elif api_version == "2023-05-01": from ..v2023_05_01.aio.operations import AgentPoolsOperations as OperationClass - elif api_version == '2023-05-02-preview': + elif api_version == "2023-05-02-preview": from ..v2023_05_02_preview.aio.operations import AgentPoolsOperations as OperationClass - elif api_version == '2023-06-01': + elif api_version == "2023-06-01": from ..v2023_06_01.aio.operations import AgentPoolsOperations as OperationClass - elif api_version == '2023-06-02-preview': + elif api_version == "2023-06-02-preview": from ..v2023_06_02_preview.aio.operations import AgentPoolsOperations as OperationClass - elif api_version == '2023-07-01': + elif api_version == "2023-07-01": from ..v2023_07_01.aio.operations import AgentPoolsOperations as OperationClass - elif api_version == '2023-07-02-preview': + elif api_version == "2023-07-02-preview": from ..v2023_07_02_preview.aio.operations import AgentPoolsOperations as OperationClass - elif api_version == '2023-08-01': + elif api_version == "2023-08-01": from ..v2023_08_01.aio.operations import AgentPoolsOperations as OperationClass - elif api_version == '2023-08-02-preview': + elif api_version == "2023-08-02-preview": from ..v2023_08_02_preview.aio.operations import AgentPoolsOperations as OperationClass - elif api_version == '2023-09-01': + elif api_version == "2023-09-01": from ..v2023_09_01.aio.operations import AgentPoolsOperations as OperationClass - elif api_version == '2023-09-02-preview': + elif api_version == "2023-09-02-preview": from ..v2023_09_02_preview.aio.operations import AgentPoolsOperations as OperationClass - elif api_version == '2023-10-01': + elif api_version == "2023-10-01": from ..v2023_10_01.aio.operations import AgentPoolsOperations as OperationClass - elif api_version == '2023-10-02-preview': + elif api_version == "2023-10-02-preview": from ..v2023_10_02_preview.aio.operations import AgentPoolsOperations as OperationClass - elif api_version == '2023-11-01': + elif api_version == "2023-11-01": from ..v2023_11_01.aio.operations import AgentPoolsOperations as OperationClass - elif api_version == '2023-11-02-preview': + elif api_version == "2023-11-02-preview": from ..v2023_11_02_preview.aio.operations import AgentPoolsOperations as OperationClass - elif api_version == '2024-01-01': + elif api_version == "2024-01-01": from ..v2024_01_01.aio.operations import AgentPoolsOperations as OperationClass - elif api_version == '2024-01-02-preview': + elif api_version == "2024-01-02-preview": from ..v2024_01_02_preview.aio.operations import AgentPoolsOperations as OperationClass - elif api_version == '2024-02-01': + elif api_version == "2024-02-01": from ..v2024_02_01.aio.operations import AgentPoolsOperations as OperationClass - elif api_version == '2024-02-02-preview': + elif api_version == "2024-02-02-preview": from ..v2024_02_02_preview.aio.operations import AgentPoolsOperations as OperationClass - elif api_version == '2024-03-02-preview': + elif api_version == "2024-03-02-preview": from ..v2024_03_02_preview.aio.operations import AgentPoolsOperations as OperationClass - elif api_version == '2024-04-02-preview': + elif api_version == "2024-04-02-preview": from ..v2024_04_02_preview.aio.operations import AgentPoolsOperations as OperationClass - elif api_version == '2024-05-01': + elif api_version == "2024-05-01": from ..v2024_05_01.aio.operations import AgentPoolsOperations as OperationClass - elif api_version == '2024-05-02-preview': + elif api_version == "2024-05-02-preview": from ..v2024_05_02_preview.aio.operations import AgentPoolsOperations as OperationClass - elif api_version == '2024-06-02-preview': + elif api_version == "2024-06-02-preview": from ..v2024_06_02_preview.aio.operations import AgentPoolsOperations as OperationClass - elif api_version == '2024-07-01': + elif api_version == "2024-07-01": from ..v2024_07_01.aio.operations import AgentPoolsOperations as OperationClass - elif api_version == '2024-07-02-preview': + elif api_version == "2024-07-02-preview": from ..v2024_07_02_preview.aio.operations import AgentPoolsOperations as OperationClass - elif api_version == '2024-08-01': + elif api_version == "2024-08-01": from ..v2024_08_01.aio.operations import AgentPoolsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'agent_pools'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) + return OperationClass( + self._client, + self._config, + Serializer(self._models_dict(api_version)), + Deserializer(self._models_dict(api_version)), + api_version, + ) @property def container_services(self): """Instance depends on the API version: - * 2017-07-01: :class:`ContainerServicesOperations` - * 2019-04-01: :class:`ContainerServicesOperations` + * 2017-07-01: :class:`ContainerServicesOperations` + * 2019-04-01: :class:`ContainerServicesOperations` """ - api_version = self._get_api_version('container_services') - if api_version == '2017-07-01': + api_version = self._get_api_version("container_services") + if api_version == "2017-07-01": from ..v2017_07_01.aio.operations import ContainerServicesOperations as OperationClass - elif api_version == '2019-04-01': + elif api_version == "2019-04-01": from ..v2019_04_01.aio.operations import ContainerServicesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'container_services'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) + return OperationClass( + self._client, + self._config, + Serializer(self._models_dict(api_version)), + Deserializer(self._models_dict(api_version)), + api_version, + ) @property def fleet_members(self): """Instance depends on the API version: - * 2022-06-02-preview: :class:`FleetMembersOperations` - * 2022-07-02-preview: :class:`FleetMembersOperations` - * 2022-09-02-preview: :class:`FleetMembersOperations` + * 2022-06-02-preview: :class:`FleetMembersOperations` + * 2022-07-02-preview: :class:`FleetMembersOperations` + * 2022-09-02-preview: :class:`FleetMembersOperations` """ - api_version = self._get_api_version('fleet_members') - if api_version == '2022-06-02-preview': + api_version = self._get_api_version("fleet_members") + if api_version == "2022-06-02-preview": from ..v2022_06_02_preview.aio.operations import FleetMembersOperations as OperationClass - elif api_version == '2022-07-02-preview': + elif api_version == "2022-07-02-preview": from ..v2022_07_02_preview.aio.operations import FleetMembersOperations as OperationClass - elif api_version == '2022-09-02-preview': + elif api_version == "2022-09-02-preview": from ..v2022_09_02_preview.aio.operations import FleetMembersOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'fleet_members'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) + return OperationClass( + self._client, + self._config, + Serializer(self._models_dict(api_version)), + Deserializer(self._models_dict(api_version)), + api_version, + ) @property def fleets(self): """Instance depends on the API version: - * 2022-06-02-preview: :class:`FleetsOperations` - * 2022-07-02-preview: :class:`FleetsOperations` - * 2022-09-02-preview: :class:`FleetsOperations` + * 2022-06-02-preview: :class:`FleetsOperations` + * 2022-07-02-preview: :class:`FleetsOperations` + * 2022-09-02-preview: :class:`FleetsOperations` """ - api_version = self._get_api_version('fleets') - if api_version == '2022-06-02-preview': + api_version = self._get_api_version("fleets") + if api_version == "2022-06-02-preview": from ..v2022_06_02_preview.aio.operations import FleetsOperations as OperationClass - elif api_version == '2022-07-02-preview': + elif api_version == "2022-07-02-preview": from ..v2022_07_02_preview.aio.operations import FleetsOperations as OperationClass - elif api_version == '2022-09-02-preview': + elif api_version == "2022-09-02-preview": from ..v2022_09_02_preview.aio.operations import FleetsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'fleets'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) + return OperationClass( + self._client, + self._config, + Serializer(self._models_dict(api_version)), + Deserializer(self._models_dict(api_version)), + api_version, + ) @property def load_balancers(self): """Instance depends on the API version: - * 2024-03-02-preview: :class:`LoadBalancersOperations` - * 2024-04-02-preview: :class:`LoadBalancersOperations` - * 2024-05-02-preview: :class:`LoadBalancersOperations` - * 2024-06-02-preview: :class:`LoadBalancersOperations` - * 2024-07-02-preview: :class:`LoadBalancersOperations` + * 2024-03-02-preview: :class:`LoadBalancersOperations` + * 2024-04-02-preview: :class:`LoadBalancersOperations` + * 2024-05-02-preview: :class:`LoadBalancersOperations` + * 2024-06-02-preview: :class:`LoadBalancersOperations` + * 2024-07-02-preview: :class:`LoadBalancersOperations` """ - api_version = self._get_api_version('load_balancers') - if api_version == '2024-03-02-preview': + api_version = self._get_api_version("load_balancers") + if api_version == "2024-03-02-preview": from ..v2024_03_02_preview.aio.operations import LoadBalancersOperations as OperationClass - elif api_version == '2024-04-02-preview': + elif api_version == "2024-04-02-preview": from ..v2024_04_02_preview.aio.operations import LoadBalancersOperations as OperationClass - elif api_version == '2024-05-02-preview': + elif api_version == "2024-05-02-preview": from ..v2024_05_02_preview.aio.operations import LoadBalancersOperations as OperationClass - elif api_version == '2024-06-02-preview': + elif api_version == "2024-06-02-preview": from ..v2024_06_02_preview.aio.operations import LoadBalancersOperations as OperationClass - elif api_version == '2024-07-02-preview': + elif api_version == "2024-07-02-preview": from ..v2024_07_02_preview.aio.operations import LoadBalancersOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'load_balancers'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) + return OperationClass( + self._client, + self._config, + Serializer(self._models_dict(api_version)), + Deserializer(self._models_dict(api_version)), + api_version, + ) @property def machines(self): """Instance depends on the API version: - * 2023-07-02-preview: :class:`MachinesOperations` - * 2023-08-02-preview: :class:`MachinesOperations` - * 2023-09-02-preview: :class:`MachinesOperations` - * 2023-10-02-preview: :class:`MachinesOperations` - * 2023-11-02-preview: :class:`MachinesOperations` - * 2024-01-02-preview: :class:`MachinesOperations` - * 2024-02-02-preview: :class:`MachinesOperations` - * 2024-03-02-preview: :class:`MachinesOperations` - * 2024-04-02-preview: :class:`MachinesOperations` - * 2024-05-02-preview: :class:`MachinesOperations` - * 2024-06-02-preview: :class:`MachinesOperations` - * 2024-07-01: :class:`MachinesOperations` - * 2024-07-02-preview: :class:`MachinesOperations` - * 2024-08-01: :class:`MachinesOperations` + * 2023-07-02-preview: :class:`MachinesOperations` + * 2023-08-02-preview: :class:`MachinesOperations` + * 2023-09-02-preview: :class:`MachinesOperations` + * 2023-10-02-preview: :class:`MachinesOperations` + * 2023-11-02-preview: :class:`MachinesOperations` + * 2024-01-02-preview: :class:`MachinesOperations` + * 2024-02-02-preview: :class:`MachinesOperations` + * 2024-03-02-preview: :class:`MachinesOperations` + * 2024-04-02-preview: :class:`MachinesOperations` + * 2024-05-02-preview: :class:`MachinesOperations` + * 2024-06-02-preview: :class:`MachinesOperations` + * 2024-07-01: :class:`MachinesOperations` + * 2024-07-02-preview: :class:`MachinesOperations` + * 2024-08-01: :class:`MachinesOperations` """ - api_version = self._get_api_version('machines') - if api_version == '2023-07-02-preview': + api_version = self._get_api_version("machines") + if api_version == "2023-07-02-preview": from ..v2023_07_02_preview.aio.operations import MachinesOperations as OperationClass - elif api_version == '2023-08-02-preview': + elif api_version == "2023-08-02-preview": from ..v2023_08_02_preview.aio.operations import MachinesOperations as OperationClass - elif api_version == '2023-09-02-preview': + elif api_version == "2023-09-02-preview": from ..v2023_09_02_preview.aio.operations import MachinesOperations as OperationClass - elif api_version == '2023-10-02-preview': + elif api_version == "2023-10-02-preview": from ..v2023_10_02_preview.aio.operations import MachinesOperations as OperationClass - elif api_version == '2023-11-02-preview': + elif api_version == "2023-11-02-preview": from ..v2023_11_02_preview.aio.operations import MachinesOperations as OperationClass - elif api_version == '2024-01-02-preview': + elif api_version == "2024-01-02-preview": from ..v2024_01_02_preview.aio.operations import MachinesOperations as OperationClass - elif api_version == '2024-02-02-preview': + elif api_version == "2024-02-02-preview": from ..v2024_02_02_preview.aio.operations import MachinesOperations as OperationClass - elif api_version == '2024-03-02-preview': + elif api_version == "2024-03-02-preview": from ..v2024_03_02_preview.aio.operations import MachinesOperations as OperationClass - elif api_version == '2024-04-02-preview': + elif api_version == "2024-04-02-preview": from ..v2024_04_02_preview.aio.operations import MachinesOperations as OperationClass - elif api_version == '2024-05-02-preview': + elif api_version == "2024-05-02-preview": from ..v2024_05_02_preview.aio.operations import MachinesOperations as OperationClass - elif api_version == '2024-06-02-preview': + elif api_version == "2024-06-02-preview": from ..v2024_06_02_preview.aio.operations import MachinesOperations as OperationClass - elif api_version == '2024-07-01': + elif api_version == "2024-07-01": from ..v2024_07_01.aio.operations import MachinesOperations as OperationClass - elif api_version == '2024-07-02-preview': + elif api_version == "2024-07-02-preview": from ..v2024_07_02_preview.aio.operations import MachinesOperations as OperationClass - elif api_version == '2024-08-01': + elif api_version == "2024-08-01": from ..v2024_08_01.aio.operations import MachinesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'machines'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) + return OperationClass( + self._client, + self._config, + Serializer(self._models_dict(api_version)), + Deserializer(self._models_dict(api_version)), + api_version, + ) @property def maintenance_configurations(self): """Instance depends on the API version: - * 2020-12-01: :class:`MaintenanceConfigurationsOperations` - * 2021-02-01: :class:`MaintenanceConfigurationsOperations` - * 2021-03-01: :class:`MaintenanceConfigurationsOperations` - * 2021-05-01: :class:`MaintenanceConfigurationsOperations` - * 2021-07-01: :class:`MaintenanceConfigurationsOperations` - * 2021-08-01: :class:`MaintenanceConfigurationsOperations` - * 2021-09-01: :class:`MaintenanceConfigurationsOperations` - * 2021-10-01: :class:`MaintenanceConfigurationsOperations` - * 2021-11-01-preview: :class:`MaintenanceConfigurationsOperations` - * 2022-01-01: :class:`MaintenanceConfigurationsOperations` - * 2022-01-02-preview: :class:`MaintenanceConfigurationsOperations` - * 2022-02-01: :class:`MaintenanceConfigurationsOperations` - * 2022-02-02-preview: :class:`MaintenanceConfigurationsOperations` - * 2022-03-01: :class:`MaintenanceConfigurationsOperations` - * 2022-03-02-preview: :class:`MaintenanceConfigurationsOperations` - * 2022-04-01: :class:`MaintenanceConfigurationsOperations` - * 2022-04-02-preview: :class:`MaintenanceConfigurationsOperations` - * 2022-05-02-preview: :class:`MaintenanceConfigurationsOperations` - * 2022-06-01: :class:`MaintenanceConfigurationsOperations` - * 2022-06-02-preview: :class:`MaintenanceConfigurationsOperations` - * 2022-07-01: :class:`MaintenanceConfigurationsOperations` - * 2022-07-02-preview: :class:`MaintenanceConfigurationsOperations` - * 2022-08-02-preview: :class:`MaintenanceConfigurationsOperations` - * 2022-08-03-preview: :class:`MaintenanceConfigurationsOperations` - * 2022-09-01: :class:`MaintenanceConfigurationsOperations` - * 2022-09-02-preview: :class:`MaintenanceConfigurationsOperations` - * 2022-10-02-preview: :class:`MaintenanceConfigurationsOperations` - * 2022-11-01: :class:`MaintenanceConfigurationsOperations` - * 2022-11-02-preview: :class:`MaintenanceConfigurationsOperations` - * 2023-01-01: :class:`MaintenanceConfigurationsOperations` - * 2023-01-02-preview: :class:`MaintenanceConfigurationsOperations` - * 2023-02-01: :class:`MaintenanceConfigurationsOperations` - * 2023-02-02-preview: :class:`MaintenanceConfigurationsOperations` - * 2023-03-01: :class:`MaintenanceConfigurationsOperations` - * 2023-03-02-preview: :class:`MaintenanceConfigurationsOperations` - * 2023-04-01: :class:`MaintenanceConfigurationsOperations` - * 2023-04-02-preview: :class:`MaintenanceConfigurationsOperations` - * 2023-05-01: :class:`MaintenanceConfigurationsOperations` - * 2023-05-02-preview: :class:`MaintenanceConfigurationsOperations` - * 2023-06-01: :class:`MaintenanceConfigurationsOperations` - * 2023-06-02-preview: :class:`MaintenanceConfigurationsOperations` - * 2023-07-01: :class:`MaintenanceConfigurationsOperations` - * 2023-07-02-preview: :class:`MaintenanceConfigurationsOperations` - * 2023-08-01: :class:`MaintenanceConfigurationsOperations` - * 2023-08-02-preview: :class:`MaintenanceConfigurationsOperations` - * 2023-09-01: :class:`MaintenanceConfigurationsOperations` - * 2023-09-02-preview: :class:`MaintenanceConfigurationsOperations` - * 2023-10-01: :class:`MaintenanceConfigurationsOperations` - * 2023-10-02-preview: :class:`MaintenanceConfigurationsOperations` - * 2023-11-01: :class:`MaintenanceConfigurationsOperations` - * 2023-11-02-preview: :class:`MaintenanceConfigurationsOperations` - * 2024-01-01: :class:`MaintenanceConfigurationsOperations` - * 2024-01-02-preview: :class:`MaintenanceConfigurationsOperations` - * 2024-02-01: :class:`MaintenanceConfigurationsOperations` - * 2024-02-02-preview: :class:`MaintenanceConfigurationsOperations` - * 2024-03-02-preview: :class:`MaintenanceConfigurationsOperations` - * 2024-04-02-preview: :class:`MaintenanceConfigurationsOperations` - * 2024-05-01: :class:`MaintenanceConfigurationsOperations` - * 2024-05-02-preview: :class:`MaintenanceConfigurationsOperations` - * 2024-06-02-preview: :class:`MaintenanceConfigurationsOperations` - * 2024-07-01: :class:`MaintenanceConfigurationsOperations` - * 2024-07-02-preview: :class:`MaintenanceConfigurationsOperations` - * 2024-08-01: :class:`MaintenanceConfigurationsOperations` + * 2020-12-01: :class:`MaintenanceConfigurationsOperations` + * 2021-02-01: :class:`MaintenanceConfigurationsOperations` + * 2021-03-01: :class:`MaintenanceConfigurationsOperations` + * 2021-05-01: :class:`MaintenanceConfigurationsOperations` + * 2021-07-01: :class:`MaintenanceConfigurationsOperations` + * 2021-08-01: :class:`MaintenanceConfigurationsOperations` + * 2021-09-01: :class:`MaintenanceConfigurationsOperations` + * 2021-10-01: :class:`MaintenanceConfigurationsOperations` + * 2021-11-01-preview: :class:`MaintenanceConfigurationsOperations` + * 2022-01-01: :class:`MaintenanceConfigurationsOperations` + * 2022-01-02-preview: :class:`MaintenanceConfigurationsOperations` + * 2022-02-01: :class:`MaintenanceConfigurationsOperations` + * 2022-02-02-preview: :class:`MaintenanceConfigurationsOperations` + * 2022-03-01: :class:`MaintenanceConfigurationsOperations` + * 2022-03-02-preview: :class:`MaintenanceConfigurationsOperations` + * 2022-04-01: :class:`MaintenanceConfigurationsOperations` + * 2022-04-02-preview: :class:`MaintenanceConfigurationsOperations` + * 2022-05-02-preview: :class:`MaintenanceConfigurationsOperations` + * 2022-06-01: :class:`MaintenanceConfigurationsOperations` + * 2022-06-02-preview: :class:`MaintenanceConfigurationsOperations` + * 2022-07-01: :class:`MaintenanceConfigurationsOperations` + * 2022-07-02-preview: :class:`MaintenanceConfigurationsOperations` + * 2022-08-02-preview: :class:`MaintenanceConfigurationsOperations` + * 2022-08-03-preview: :class:`MaintenanceConfigurationsOperations` + * 2022-09-01: :class:`MaintenanceConfigurationsOperations` + * 2022-09-02-preview: :class:`MaintenanceConfigurationsOperations` + * 2022-10-02-preview: :class:`MaintenanceConfigurationsOperations` + * 2022-11-01: :class:`MaintenanceConfigurationsOperations` + * 2022-11-02-preview: :class:`MaintenanceConfigurationsOperations` + * 2023-01-01: :class:`MaintenanceConfigurationsOperations` + * 2023-01-02-preview: :class:`MaintenanceConfigurationsOperations` + * 2023-02-01: :class:`MaintenanceConfigurationsOperations` + * 2023-02-02-preview: :class:`MaintenanceConfigurationsOperations` + * 2023-03-01: :class:`MaintenanceConfigurationsOperations` + * 2023-03-02-preview: :class:`MaintenanceConfigurationsOperations` + * 2023-04-01: :class:`MaintenanceConfigurationsOperations` + * 2023-04-02-preview: :class:`MaintenanceConfigurationsOperations` + * 2023-05-01: :class:`MaintenanceConfigurationsOperations` + * 2023-05-02-preview: :class:`MaintenanceConfigurationsOperations` + * 2023-06-01: :class:`MaintenanceConfigurationsOperations` + * 2023-06-02-preview: :class:`MaintenanceConfigurationsOperations` + * 2023-07-01: :class:`MaintenanceConfigurationsOperations` + * 2023-07-02-preview: :class:`MaintenanceConfigurationsOperations` + * 2023-08-01: :class:`MaintenanceConfigurationsOperations` + * 2023-08-02-preview: :class:`MaintenanceConfigurationsOperations` + * 2023-09-01: :class:`MaintenanceConfigurationsOperations` + * 2023-09-02-preview: :class:`MaintenanceConfigurationsOperations` + * 2023-10-01: :class:`MaintenanceConfigurationsOperations` + * 2023-10-02-preview: :class:`MaintenanceConfigurationsOperations` + * 2023-11-01: :class:`MaintenanceConfigurationsOperations` + * 2023-11-02-preview: :class:`MaintenanceConfigurationsOperations` + * 2024-01-01: :class:`MaintenanceConfigurationsOperations` + * 2024-01-02-preview: :class:`MaintenanceConfigurationsOperations` + * 2024-02-01: :class:`MaintenanceConfigurationsOperations` + * 2024-02-02-preview: :class:`MaintenanceConfigurationsOperations` + * 2024-03-02-preview: :class:`MaintenanceConfigurationsOperations` + * 2024-04-02-preview: :class:`MaintenanceConfigurationsOperations` + * 2024-05-01: :class:`MaintenanceConfigurationsOperations` + * 2024-05-02-preview: :class:`MaintenanceConfigurationsOperations` + * 2024-06-02-preview: :class:`MaintenanceConfigurationsOperations` + * 2024-07-01: :class:`MaintenanceConfigurationsOperations` + * 2024-07-02-preview: :class:`MaintenanceConfigurationsOperations` + * 2024-08-01: :class:`MaintenanceConfigurationsOperations` """ - api_version = self._get_api_version('maintenance_configurations') - if api_version == '2020-12-01': + api_version = self._get_api_version("maintenance_configurations") + if api_version == "2020-12-01": from ..v2020_12_01.aio.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2021-02-01': + elif api_version == "2021-02-01": from ..v2021_02_01.aio.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2021-03-01': + elif api_version == "2021-03-01": from ..v2021_03_01.aio.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2021-05-01': + elif api_version == "2021-05-01": from ..v2021_05_01.aio.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2021-07-01': + elif api_version == "2021-07-01": from ..v2021_07_01.aio.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2021-08-01': + elif api_version == "2021-08-01": from ..v2021_08_01.aio.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2021-09-01': + elif api_version == "2021-09-01": from ..v2021_09_01.aio.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2021-10-01': + elif api_version == "2021-10-01": from ..v2021_10_01.aio.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2021-11-01-preview': + elif api_version == "2021-11-01-preview": from ..v2021_11_01_preview.aio.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2022-01-01': + elif api_version == "2022-01-01": from ..v2022_01_01.aio.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2022-01-02-preview': + elif api_version == "2022-01-02-preview": from ..v2022_01_02_preview.aio.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2022-02-01': + elif api_version == "2022-02-01": from ..v2022_02_01.aio.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2022-02-02-preview': + elif api_version == "2022-02-02-preview": from ..v2022_02_02_preview.aio.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2022-03-01': + elif api_version == "2022-03-01": from ..v2022_03_01.aio.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2022-03-02-preview': + elif api_version == "2022-03-02-preview": from ..v2022_03_02_preview.aio.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2022-04-01': + elif api_version == "2022-04-01": from ..v2022_04_01.aio.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2022-04-02-preview': + elif api_version == "2022-04-02-preview": from ..v2022_04_02_preview.aio.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2022-05-02-preview': + elif api_version == "2022-05-02-preview": from ..v2022_05_02_preview.aio.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2022-06-01': + elif api_version == "2022-06-01": from ..v2022_06_01.aio.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2022-06-02-preview': + elif api_version == "2022-06-02-preview": from ..v2022_06_02_preview.aio.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2022-07-01': + elif api_version == "2022-07-01": from ..v2022_07_01.aio.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2022-07-02-preview': + elif api_version == "2022-07-02-preview": from ..v2022_07_02_preview.aio.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2022-08-02-preview': + elif api_version == "2022-08-02-preview": from ..v2022_08_02_preview.aio.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2022-08-03-preview': + elif api_version == "2022-08-03-preview": from ..v2022_08_03_preview.aio.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2022-09-01': + elif api_version == "2022-09-01": from ..v2022_09_01.aio.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2022-09-02-preview': + elif api_version == "2022-09-02-preview": from ..v2022_09_02_preview.aio.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2022-10-02-preview': + elif api_version == "2022-10-02-preview": from ..v2022_10_02_preview.aio.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2022-11-01': + elif api_version == "2022-11-01": from ..v2022_11_01.aio.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2022-11-02-preview': + elif api_version == "2022-11-02-preview": from ..v2022_11_02_preview.aio.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2023-01-01': + elif api_version == "2023-01-01": from ..v2023_01_01.aio.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2023-01-02-preview': + elif api_version == "2023-01-02-preview": from ..v2023_01_02_preview.aio.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2023-02-01': + elif api_version == "2023-02-01": from ..v2023_02_01.aio.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2023-02-02-preview': + elif api_version == "2023-02-02-preview": from ..v2023_02_02_preview.aio.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2023-03-01': + elif api_version == "2023-03-01": from ..v2023_03_01.aio.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2023-03-02-preview': + elif api_version == "2023-03-02-preview": from ..v2023_03_02_preview.aio.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2023-04-01': + elif api_version == "2023-04-01": from ..v2023_04_01.aio.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2023-04-02-preview': + elif api_version == "2023-04-02-preview": from ..v2023_04_02_preview.aio.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2023-05-01': + elif api_version == "2023-05-01": from ..v2023_05_01.aio.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2023-05-02-preview': + elif api_version == "2023-05-02-preview": from ..v2023_05_02_preview.aio.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2023-06-01': + elif api_version == "2023-06-01": from ..v2023_06_01.aio.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2023-06-02-preview': + elif api_version == "2023-06-02-preview": from ..v2023_06_02_preview.aio.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2023-07-01': + elif api_version == "2023-07-01": from ..v2023_07_01.aio.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2023-07-02-preview': + elif api_version == "2023-07-02-preview": from ..v2023_07_02_preview.aio.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2023-08-01': + elif api_version == "2023-08-01": from ..v2023_08_01.aio.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2023-08-02-preview': + elif api_version == "2023-08-02-preview": from ..v2023_08_02_preview.aio.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2023-09-01': + elif api_version == "2023-09-01": from ..v2023_09_01.aio.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2023-09-02-preview': + elif api_version == "2023-09-02-preview": from ..v2023_09_02_preview.aio.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2023-10-01': + elif api_version == "2023-10-01": from ..v2023_10_01.aio.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2023-10-02-preview': + elif api_version == "2023-10-02-preview": from ..v2023_10_02_preview.aio.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2023-11-01': + elif api_version == "2023-11-01": from ..v2023_11_01.aio.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2023-11-02-preview': + elif api_version == "2023-11-02-preview": from ..v2023_11_02_preview.aio.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2024-01-01': + elif api_version == "2024-01-01": from ..v2024_01_01.aio.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2024-01-02-preview': + elif api_version == "2024-01-02-preview": from ..v2024_01_02_preview.aio.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2024-02-01': + elif api_version == "2024-02-01": from ..v2024_02_01.aio.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2024-02-02-preview': + elif api_version == "2024-02-02-preview": from ..v2024_02_02_preview.aio.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2024-03-02-preview': + elif api_version == "2024-03-02-preview": from ..v2024_03_02_preview.aio.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2024-04-02-preview': + elif api_version == "2024-04-02-preview": from ..v2024_04_02_preview.aio.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2024-05-01': + elif api_version == "2024-05-01": from ..v2024_05_01.aio.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2024-05-02-preview': + elif api_version == "2024-05-02-preview": from ..v2024_05_02_preview.aio.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2024-06-02-preview': + elif api_version == "2024-06-02-preview": from ..v2024_06_02_preview.aio.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2024-07-01': + elif api_version == "2024-07-01": from ..v2024_07_01.aio.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2024-07-02-preview': + elif api_version == "2024-07-02-preview": from ..v2024_07_02_preview.aio.operations import MaintenanceConfigurationsOperations as OperationClass - elif api_version == '2024-08-01': + elif api_version == "2024-08-01": from ..v2024_08_01.aio.operations import MaintenanceConfigurationsOperations as OperationClass else: - raise ValueError("API version {} does not have operation group 'maintenance_configurations'".format(api_version)) + raise ValueError( + "API version {} does not have operation group 'maintenance_configurations'".format(api_version) + ) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) + return OperationClass( + self._client, + self._config, + Serializer(self._models_dict(api_version)), + Deserializer(self._models_dict(api_version)), + api_version, + ) @property def managed_cluster_snapshots(self): """Instance depends on the API version: - * 2022-02-02-preview: :class:`ManagedClusterSnapshotsOperations` - * 2022-03-02-preview: :class:`ManagedClusterSnapshotsOperations` - * 2022-04-02-preview: :class:`ManagedClusterSnapshotsOperations` - * 2022-05-02-preview: :class:`ManagedClusterSnapshotsOperations` - * 2022-06-02-preview: :class:`ManagedClusterSnapshotsOperations` - * 2022-07-02-preview: :class:`ManagedClusterSnapshotsOperations` - * 2022-08-02-preview: :class:`ManagedClusterSnapshotsOperations` - * 2022-08-03-preview: :class:`ManagedClusterSnapshotsOperations` - * 2022-09-02-preview: :class:`ManagedClusterSnapshotsOperations` - * 2022-10-02-preview: :class:`ManagedClusterSnapshotsOperations` - * 2022-11-02-preview: :class:`ManagedClusterSnapshotsOperations` - * 2023-01-02-preview: :class:`ManagedClusterSnapshotsOperations` - * 2023-02-02-preview: :class:`ManagedClusterSnapshotsOperations` - * 2023-03-02-preview: :class:`ManagedClusterSnapshotsOperations` - * 2023-04-02-preview: :class:`ManagedClusterSnapshotsOperations` - * 2023-05-02-preview: :class:`ManagedClusterSnapshotsOperations` - * 2023-06-02-preview: :class:`ManagedClusterSnapshotsOperations` - * 2023-07-02-preview: :class:`ManagedClusterSnapshotsOperations` - * 2023-08-02-preview: :class:`ManagedClusterSnapshotsOperations` - * 2023-09-02-preview: :class:`ManagedClusterSnapshotsOperations` - * 2023-10-02-preview: :class:`ManagedClusterSnapshotsOperations` - * 2023-11-02-preview: :class:`ManagedClusterSnapshotsOperations` - * 2024-01-02-preview: :class:`ManagedClusterSnapshotsOperations` - * 2024-02-02-preview: :class:`ManagedClusterSnapshotsOperations` - * 2024-03-02-preview: :class:`ManagedClusterSnapshotsOperations` - * 2024-04-02-preview: :class:`ManagedClusterSnapshotsOperations` - * 2024-05-02-preview: :class:`ManagedClusterSnapshotsOperations` - * 2024-06-02-preview: :class:`ManagedClusterSnapshotsOperations` - * 2024-07-02-preview: :class:`ManagedClusterSnapshotsOperations` + * 2022-02-02-preview: :class:`ManagedClusterSnapshotsOperations` + * 2022-03-02-preview: :class:`ManagedClusterSnapshotsOperations` + * 2022-04-02-preview: :class:`ManagedClusterSnapshotsOperations` + * 2022-05-02-preview: :class:`ManagedClusterSnapshotsOperations` + * 2022-06-02-preview: :class:`ManagedClusterSnapshotsOperations` + * 2022-07-02-preview: :class:`ManagedClusterSnapshotsOperations` + * 2022-08-02-preview: :class:`ManagedClusterSnapshotsOperations` + * 2022-08-03-preview: :class:`ManagedClusterSnapshotsOperations` + * 2022-09-02-preview: :class:`ManagedClusterSnapshotsOperations` + * 2022-10-02-preview: :class:`ManagedClusterSnapshotsOperations` + * 2022-11-02-preview: :class:`ManagedClusterSnapshotsOperations` + * 2023-01-02-preview: :class:`ManagedClusterSnapshotsOperations` + * 2023-02-02-preview: :class:`ManagedClusterSnapshotsOperations` + * 2023-03-02-preview: :class:`ManagedClusterSnapshotsOperations` + * 2023-04-02-preview: :class:`ManagedClusterSnapshotsOperations` + * 2023-05-02-preview: :class:`ManagedClusterSnapshotsOperations` + * 2023-06-02-preview: :class:`ManagedClusterSnapshotsOperations` + * 2023-07-02-preview: :class:`ManagedClusterSnapshotsOperations` + * 2023-08-02-preview: :class:`ManagedClusterSnapshotsOperations` + * 2023-09-02-preview: :class:`ManagedClusterSnapshotsOperations` + * 2023-10-02-preview: :class:`ManagedClusterSnapshotsOperations` + * 2023-11-02-preview: :class:`ManagedClusterSnapshotsOperations` + * 2024-01-02-preview: :class:`ManagedClusterSnapshotsOperations` + * 2024-02-02-preview: :class:`ManagedClusterSnapshotsOperations` + * 2024-03-02-preview: :class:`ManagedClusterSnapshotsOperations` + * 2024-04-02-preview: :class:`ManagedClusterSnapshotsOperations` + * 2024-05-02-preview: :class:`ManagedClusterSnapshotsOperations` + * 2024-06-02-preview: :class:`ManagedClusterSnapshotsOperations` + * 2024-07-02-preview: :class:`ManagedClusterSnapshotsOperations` """ - api_version = self._get_api_version('managed_cluster_snapshots') - if api_version == '2022-02-02-preview': + api_version = self._get_api_version("managed_cluster_snapshots") + if api_version == "2022-02-02-preview": from ..v2022_02_02_preview.aio.operations import ManagedClusterSnapshotsOperations as OperationClass - elif api_version == '2022-03-02-preview': + elif api_version == "2022-03-02-preview": from ..v2022_03_02_preview.aio.operations import ManagedClusterSnapshotsOperations as OperationClass - elif api_version == '2022-04-02-preview': + elif api_version == "2022-04-02-preview": from ..v2022_04_02_preview.aio.operations import ManagedClusterSnapshotsOperations as OperationClass - elif api_version == '2022-05-02-preview': + elif api_version == "2022-05-02-preview": from ..v2022_05_02_preview.aio.operations import ManagedClusterSnapshotsOperations as OperationClass - elif api_version == '2022-06-02-preview': + elif api_version == "2022-06-02-preview": from ..v2022_06_02_preview.aio.operations import ManagedClusterSnapshotsOperations as OperationClass - elif api_version == '2022-07-02-preview': + elif api_version == "2022-07-02-preview": from ..v2022_07_02_preview.aio.operations import ManagedClusterSnapshotsOperations as OperationClass - elif api_version == '2022-08-02-preview': + elif api_version == "2022-08-02-preview": from ..v2022_08_02_preview.aio.operations import ManagedClusterSnapshotsOperations as OperationClass - elif api_version == '2022-08-03-preview': + elif api_version == "2022-08-03-preview": from ..v2022_08_03_preview.aio.operations import ManagedClusterSnapshotsOperations as OperationClass - elif api_version == '2022-09-02-preview': + elif api_version == "2022-09-02-preview": from ..v2022_09_02_preview.aio.operations import ManagedClusterSnapshotsOperations as OperationClass - elif api_version == '2022-10-02-preview': + elif api_version == "2022-10-02-preview": from ..v2022_10_02_preview.aio.operations import ManagedClusterSnapshotsOperations as OperationClass - elif api_version == '2022-11-02-preview': + elif api_version == "2022-11-02-preview": from ..v2022_11_02_preview.aio.operations import ManagedClusterSnapshotsOperations as OperationClass - elif api_version == '2023-01-02-preview': + elif api_version == "2023-01-02-preview": from ..v2023_01_02_preview.aio.operations import ManagedClusterSnapshotsOperations as OperationClass - elif api_version == '2023-02-02-preview': + elif api_version == "2023-02-02-preview": from ..v2023_02_02_preview.aio.operations import ManagedClusterSnapshotsOperations as OperationClass - elif api_version == '2023-03-02-preview': + elif api_version == "2023-03-02-preview": from ..v2023_03_02_preview.aio.operations import ManagedClusterSnapshotsOperations as OperationClass - elif api_version == '2023-04-02-preview': + elif api_version == "2023-04-02-preview": from ..v2023_04_02_preview.aio.operations import ManagedClusterSnapshotsOperations as OperationClass - elif api_version == '2023-05-02-preview': + elif api_version == "2023-05-02-preview": from ..v2023_05_02_preview.aio.operations import ManagedClusterSnapshotsOperations as OperationClass - elif api_version == '2023-06-02-preview': + elif api_version == "2023-06-02-preview": from ..v2023_06_02_preview.aio.operations import ManagedClusterSnapshotsOperations as OperationClass - elif api_version == '2023-07-02-preview': + elif api_version == "2023-07-02-preview": from ..v2023_07_02_preview.aio.operations import ManagedClusterSnapshotsOperations as OperationClass - elif api_version == '2023-08-02-preview': + elif api_version == "2023-08-02-preview": from ..v2023_08_02_preview.aio.operations import ManagedClusterSnapshotsOperations as OperationClass - elif api_version == '2023-09-02-preview': + elif api_version == "2023-09-02-preview": from ..v2023_09_02_preview.aio.operations import ManagedClusterSnapshotsOperations as OperationClass - elif api_version == '2023-10-02-preview': + elif api_version == "2023-10-02-preview": from ..v2023_10_02_preview.aio.operations import ManagedClusterSnapshotsOperations as OperationClass - elif api_version == '2023-11-02-preview': + elif api_version == "2023-11-02-preview": from ..v2023_11_02_preview.aio.operations import ManagedClusterSnapshotsOperations as OperationClass - elif api_version == '2024-01-02-preview': + elif api_version == "2024-01-02-preview": from ..v2024_01_02_preview.aio.operations import ManagedClusterSnapshotsOperations as OperationClass - elif api_version == '2024-02-02-preview': + elif api_version == "2024-02-02-preview": from ..v2024_02_02_preview.aio.operations import ManagedClusterSnapshotsOperations as OperationClass - elif api_version == '2024-03-02-preview': + elif api_version == "2024-03-02-preview": from ..v2024_03_02_preview.aio.operations import ManagedClusterSnapshotsOperations as OperationClass - elif api_version == '2024-04-02-preview': + elif api_version == "2024-04-02-preview": from ..v2024_04_02_preview.aio.operations import ManagedClusterSnapshotsOperations as OperationClass - elif api_version == '2024-05-02-preview': + elif api_version == "2024-05-02-preview": from ..v2024_05_02_preview.aio.operations import ManagedClusterSnapshotsOperations as OperationClass - elif api_version == '2024-06-02-preview': + elif api_version == "2024-06-02-preview": from ..v2024_06_02_preview.aio.operations import ManagedClusterSnapshotsOperations as OperationClass - elif api_version == '2024-07-02-preview': + elif api_version == "2024-07-02-preview": from ..v2024_07_02_preview.aio.operations import ManagedClusterSnapshotsOperations as OperationClass else: - raise ValueError("API version {} does not have operation group 'managed_cluster_snapshots'".format(api_version)) + raise ValueError( + "API version {} does not have operation group 'managed_cluster_snapshots'".format(api_version) + ) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) + return OperationClass( + self._client, + self._config, + Serializer(self._models_dict(api_version)), + Deserializer(self._models_dict(api_version)), + api_version, + ) @property def managed_clusters(self): """Instance depends on the API version: - * 2018-03-31: :class:`ManagedClustersOperations` - * 2018-08-01-preview: :class:`ManagedClustersOperations` - * 2019-02-01: :class:`ManagedClustersOperations` - * 2019-04-01: :class:`ManagedClustersOperations` - * 2019-06-01: :class:`ManagedClustersOperations` - * 2019-08-01: :class:`ManagedClustersOperations` - * 2019-10-01: :class:`ManagedClustersOperations` - * 2019-11-01: :class:`ManagedClustersOperations` - * 2020-01-01: :class:`ManagedClustersOperations` - * 2020-02-01: :class:`ManagedClustersOperations` - * 2020-03-01: :class:`ManagedClustersOperations` - * 2020-04-01: :class:`ManagedClustersOperations` - * 2020-06-01: :class:`ManagedClustersOperations` - * 2020-07-01: :class:`ManagedClustersOperations` - * 2020-09-01: :class:`ManagedClustersOperations` - * 2020-11-01: :class:`ManagedClustersOperations` - * 2020-12-01: :class:`ManagedClustersOperations` - * 2021-02-01: :class:`ManagedClustersOperations` - * 2021-03-01: :class:`ManagedClustersOperations` - * 2021-05-01: :class:`ManagedClustersOperations` - * 2021-07-01: :class:`ManagedClustersOperations` - * 2021-08-01: :class:`ManagedClustersOperations` - * 2021-09-01: :class:`ManagedClustersOperations` - * 2021-10-01: :class:`ManagedClustersOperations` - * 2021-11-01-preview: :class:`ManagedClustersOperations` - * 2022-01-01: :class:`ManagedClustersOperations` - * 2022-01-02-preview: :class:`ManagedClustersOperations` - * 2022-02-01: :class:`ManagedClustersOperations` - * 2022-02-02-preview: :class:`ManagedClustersOperations` - * 2022-03-01: :class:`ManagedClustersOperations` - * 2022-03-02-preview: :class:`ManagedClustersOperations` - * 2022-04-01: :class:`ManagedClustersOperations` - * 2022-04-02-preview: :class:`ManagedClustersOperations` - * 2022-05-02-preview: :class:`ManagedClustersOperations` - * 2022-06-01: :class:`ManagedClustersOperations` - * 2022-06-02-preview: :class:`ManagedClustersOperations` - * 2022-07-01: :class:`ManagedClustersOperations` - * 2022-07-02-preview: :class:`ManagedClustersOperations` - * 2022-08-02-preview: :class:`ManagedClustersOperations` - * 2022-08-03-preview: :class:`ManagedClustersOperations` - * 2022-09-01: :class:`ManagedClustersOperations` - * 2022-09-02-preview: :class:`ManagedClustersOperations` - * 2022-10-02-preview: :class:`ManagedClustersOperations` - * 2022-11-01: :class:`ManagedClustersOperations` - * 2022-11-02-preview: :class:`ManagedClustersOperations` - * 2023-01-01: :class:`ManagedClustersOperations` - * 2023-01-02-preview: :class:`ManagedClustersOperations` - * 2023-02-01: :class:`ManagedClustersOperations` - * 2023-02-02-preview: :class:`ManagedClustersOperations` - * 2023-03-01: :class:`ManagedClustersOperations` - * 2023-03-02-preview: :class:`ManagedClustersOperations` - * 2023-04-01: :class:`ManagedClustersOperations` - * 2023-04-02-preview: :class:`ManagedClustersOperations` - * 2023-05-01: :class:`ManagedClustersOperations` - * 2023-05-02-preview: :class:`ManagedClustersOperations` - * 2023-06-01: :class:`ManagedClustersOperations` - * 2023-06-02-preview: :class:`ManagedClustersOperations` - * 2023-07-01: :class:`ManagedClustersOperations` - * 2023-07-02-preview: :class:`ManagedClustersOperations` - * 2023-08-01: :class:`ManagedClustersOperations` - * 2023-08-02-preview: :class:`ManagedClustersOperations` - * 2023-09-01: :class:`ManagedClustersOperations` - * 2023-09-02-preview: :class:`ManagedClustersOperations` - * 2023-10-01: :class:`ManagedClustersOperations` - * 2023-10-02-preview: :class:`ManagedClustersOperations` - * 2023-11-01: :class:`ManagedClustersOperations` - * 2023-11-02-preview: :class:`ManagedClustersOperations` - * 2024-01-01: :class:`ManagedClustersOperations` - * 2024-01-02-preview: :class:`ManagedClustersOperations` - * 2024-02-01: :class:`ManagedClustersOperations` - * 2024-02-02-preview: :class:`ManagedClustersOperations` - * 2024-03-02-preview: :class:`ManagedClustersOperations` - * 2024-04-02-preview: :class:`ManagedClustersOperations` - * 2024-05-01: :class:`ManagedClustersOperations` - * 2024-05-02-preview: :class:`ManagedClustersOperations` - * 2024-06-02-preview: :class:`ManagedClustersOperations` - * 2024-07-01: :class:`ManagedClustersOperations` - * 2024-07-02-preview: :class:`ManagedClustersOperations` - * 2024-08-01: :class:`ManagedClustersOperations` + * 2018-03-31: :class:`ManagedClustersOperations` + * 2018-08-01-preview: :class:`ManagedClustersOperations` + * 2019-02-01: :class:`ManagedClustersOperations` + * 2019-04-01: :class:`ManagedClustersOperations` + * 2019-06-01: :class:`ManagedClustersOperations` + * 2019-08-01: :class:`ManagedClustersOperations` + * 2019-10-01: :class:`ManagedClustersOperations` + * 2019-11-01: :class:`ManagedClustersOperations` + * 2020-01-01: :class:`ManagedClustersOperations` + * 2020-02-01: :class:`ManagedClustersOperations` + * 2020-03-01: :class:`ManagedClustersOperations` + * 2020-04-01: :class:`ManagedClustersOperations` + * 2020-06-01: :class:`ManagedClustersOperations` + * 2020-07-01: :class:`ManagedClustersOperations` + * 2020-09-01: :class:`ManagedClustersOperations` + * 2020-11-01: :class:`ManagedClustersOperations` + * 2020-12-01: :class:`ManagedClustersOperations` + * 2021-02-01: :class:`ManagedClustersOperations` + * 2021-03-01: :class:`ManagedClustersOperations` + * 2021-05-01: :class:`ManagedClustersOperations` + * 2021-07-01: :class:`ManagedClustersOperations` + * 2021-08-01: :class:`ManagedClustersOperations` + * 2021-09-01: :class:`ManagedClustersOperations` + * 2021-10-01: :class:`ManagedClustersOperations` + * 2021-11-01-preview: :class:`ManagedClustersOperations` + * 2022-01-01: :class:`ManagedClustersOperations` + * 2022-01-02-preview: :class:`ManagedClustersOperations` + * 2022-02-01: :class:`ManagedClustersOperations` + * 2022-02-02-preview: :class:`ManagedClustersOperations` + * 2022-03-01: :class:`ManagedClustersOperations` + * 2022-03-02-preview: :class:`ManagedClustersOperations` + * 2022-04-01: :class:`ManagedClustersOperations` + * 2022-04-02-preview: :class:`ManagedClustersOperations` + * 2022-05-02-preview: :class:`ManagedClustersOperations` + * 2022-06-01: :class:`ManagedClustersOperations` + * 2022-06-02-preview: :class:`ManagedClustersOperations` + * 2022-07-01: :class:`ManagedClustersOperations` + * 2022-07-02-preview: :class:`ManagedClustersOperations` + * 2022-08-02-preview: :class:`ManagedClustersOperations` + * 2022-08-03-preview: :class:`ManagedClustersOperations` + * 2022-09-01: :class:`ManagedClustersOperations` + * 2022-09-02-preview: :class:`ManagedClustersOperations` + * 2022-10-02-preview: :class:`ManagedClustersOperations` + * 2022-11-01: :class:`ManagedClustersOperations` + * 2022-11-02-preview: :class:`ManagedClustersOperations` + * 2023-01-01: :class:`ManagedClustersOperations` + * 2023-01-02-preview: :class:`ManagedClustersOperations` + * 2023-02-01: :class:`ManagedClustersOperations` + * 2023-02-02-preview: :class:`ManagedClustersOperations` + * 2023-03-01: :class:`ManagedClustersOperations` + * 2023-03-02-preview: :class:`ManagedClustersOperations` + * 2023-04-01: :class:`ManagedClustersOperations` + * 2023-04-02-preview: :class:`ManagedClustersOperations` + * 2023-05-01: :class:`ManagedClustersOperations` + * 2023-05-02-preview: :class:`ManagedClustersOperations` + * 2023-06-01: :class:`ManagedClustersOperations` + * 2023-06-02-preview: :class:`ManagedClustersOperations` + * 2023-07-01: :class:`ManagedClustersOperations` + * 2023-07-02-preview: :class:`ManagedClustersOperations` + * 2023-08-01: :class:`ManagedClustersOperations` + * 2023-08-02-preview: :class:`ManagedClustersOperations` + * 2023-09-01: :class:`ManagedClustersOperations` + * 2023-09-02-preview: :class:`ManagedClustersOperations` + * 2023-10-01: :class:`ManagedClustersOperations` + * 2023-10-02-preview: :class:`ManagedClustersOperations` + * 2023-11-01: :class:`ManagedClustersOperations` + * 2023-11-02-preview: :class:`ManagedClustersOperations` + * 2024-01-01: :class:`ManagedClustersOperations` + * 2024-01-02-preview: :class:`ManagedClustersOperations` + * 2024-02-01: :class:`ManagedClustersOperations` + * 2024-02-02-preview: :class:`ManagedClustersOperations` + * 2024-03-02-preview: :class:`ManagedClustersOperations` + * 2024-04-02-preview: :class:`ManagedClustersOperations` + * 2024-05-01: :class:`ManagedClustersOperations` + * 2024-05-02-preview: :class:`ManagedClustersOperations` + * 2024-06-02-preview: :class:`ManagedClustersOperations` + * 2024-07-01: :class:`ManagedClustersOperations` + * 2024-07-02-preview: :class:`ManagedClustersOperations` + * 2024-08-01: :class:`ManagedClustersOperations` """ - api_version = self._get_api_version('managed_clusters') - if api_version == '2018-03-31': + api_version = self._get_api_version("managed_clusters") + if api_version == "2018-03-31": from ..v2018_03_31.aio.operations import ManagedClustersOperations as OperationClass - elif api_version == '2018-08-01-preview': + elif api_version == "2018-08-01-preview": from ..v2018_08_01_preview.aio.operations import ManagedClustersOperations as OperationClass - elif api_version == '2019-02-01': + elif api_version == "2019-02-01": from ..v2019_02_01.aio.operations import ManagedClustersOperations as OperationClass - elif api_version == '2019-04-01': + elif api_version == "2019-04-01": from ..v2019_04_01.aio.operations import ManagedClustersOperations as OperationClass - elif api_version == '2019-06-01': + elif api_version == "2019-06-01": from ..v2019_06_01.aio.operations import ManagedClustersOperations as OperationClass - elif api_version == '2019-08-01': + elif api_version == "2019-08-01": from ..v2019_08_01.aio.operations import ManagedClustersOperations as OperationClass - elif api_version == '2019-10-01': + elif api_version == "2019-10-01": from ..v2019_10_01.aio.operations import ManagedClustersOperations as OperationClass - elif api_version == '2019-11-01': + elif api_version == "2019-11-01": from ..v2019_11_01.aio.operations import ManagedClustersOperations as OperationClass - elif api_version == '2020-01-01': + elif api_version == "2020-01-01": from ..v2020_01_01.aio.operations import ManagedClustersOperations as OperationClass - elif api_version == '2020-02-01': + elif api_version == "2020-02-01": from ..v2020_02_01.aio.operations import ManagedClustersOperations as OperationClass - elif api_version == '2020-03-01': + elif api_version == "2020-03-01": from ..v2020_03_01.aio.operations import ManagedClustersOperations as OperationClass - elif api_version == '2020-04-01': + elif api_version == "2020-04-01": from ..v2020_04_01.aio.operations import ManagedClustersOperations as OperationClass - elif api_version == '2020-06-01': + elif api_version == "2020-06-01": from ..v2020_06_01.aio.operations import ManagedClustersOperations as OperationClass - elif api_version == '2020-07-01': + elif api_version == "2020-07-01": from ..v2020_07_01.aio.operations import ManagedClustersOperations as OperationClass - elif api_version == '2020-09-01': + elif api_version == "2020-09-01": from ..v2020_09_01.aio.operations import ManagedClustersOperations as OperationClass - elif api_version == '2020-11-01': + elif api_version == "2020-11-01": from ..v2020_11_01.aio.operations import ManagedClustersOperations as OperationClass - elif api_version == '2020-12-01': + elif api_version == "2020-12-01": from ..v2020_12_01.aio.operations import ManagedClustersOperations as OperationClass - elif api_version == '2021-02-01': + elif api_version == "2021-02-01": from ..v2021_02_01.aio.operations import ManagedClustersOperations as OperationClass - elif api_version == '2021-03-01': + elif api_version == "2021-03-01": from ..v2021_03_01.aio.operations import ManagedClustersOperations as OperationClass - elif api_version == '2021-05-01': + elif api_version == "2021-05-01": from ..v2021_05_01.aio.operations import ManagedClustersOperations as OperationClass - elif api_version == '2021-07-01': + elif api_version == "2021-07-01": from ..v2021_07_01.aio.operations import ManagedClustersOperations as OperationClass - elif api_version == '2021-08-01': + elif api_version == "2021-08-01": from ..v2021_08_01.aio.operations import ManagedClustersOperations as OperationClass - elif api_version == '2021-09-01': + elif api_version == "2021-09-01": from ..v2021_09_01.aio.operations import ManagedClustersOperations as OperationClass - elif api_version == '2021-10-01': + elif api_version == "2021-10-01": from ..v2021_10_01.aio.operations import ManagedClustersOperations as OperationClass - elif api_version == '2021-11-01-preview': + elif api_version == "2021-11-01-preview": from ..v2021_11_01_preview.aio.operations import ManagedClustersOperations as OperationClass - elif api_version == '2022-01-01': + elif api_version == "2022-01-01": from ..v2022_01_01.aio.operations import ManagedClustersOperations as OperationClass - elif api_version == '2022-01-02-preview': + elif api_version == "2022-01-02-preview": from ..v2022_01_02_preview.aio.operations import ManagedClustersOperations as OperationClass - elif api_version == '2022-02-01': + elif api_version == "2022-02-01": from ..v2022_02_01.aio.operations import ManagedClustersOperations as OperationClass - elif api_version == '2022-02-02-preview': + elif api_version == "2022-02-02-preview": from ..v2022_02_02_preview.aio.operations import ManagedClustersOperations as OperationClass - elif api_version == '2022-03-01': + elif api_version == "2022-03-01": from ..v2022_03_01.aio.operations import ManagedClustersOperations as OperationClass - elif api_version == '2022-03-02-preview': + elif api_version == "2022-03-02-preview": from ..v2022_03_02_preview.aio.operations import ManagedClustersOperations as OperationClass - elif api_version == '2022-04-01': + elif api_version == "2022-04-01": from ..v2022_04_01.aio.operations import ManagedClustersOperations as OperationClass - elif api_version == '2022-04-02-preview': + elif api_version == "2022-04-02-preview": from ..v2022_04_02_preview.aio.operations import ManagedClustersOperations as OperationClass - elif api_version == '2022-05-02-preview': + elif api_version == "2022-05-02-preview": from ..v2022_05_02_preview.aio.operations import ManagedClustersOperations as OperationClass - elif api_version == '2022-06-01': + elif api_version == "2022-06-01": from ..v2022_06_01.aio.operations import ManagedClustersOperations as OperationClass - elif api_version == '2022-06-02-preview': + elif api_version == "2022-06-02-preview": from ..v2022_06_02_preview.aio.operations import ManagedClustersOperations as OperationClass - elif api_version == '2022-07-01': + elif api_version == "2022-07-01": from ..v2022_07_01.aio.operations import ManagedClustersOperations as OperationClass - elif api_version == '2022-07-02-preview': + elif api_version == "2022-07-02-preview": from ..v2022_07_02_preview.aio.operations import ManagedClustersOperations as OperationClass - elif api_version == '2022-08-02-preview': + elif api_version == "2022-08-02-preview": from ..v2022_08_02_preview.aio.operations import ManagedClustersOperations as OperationClass - elif api_version == '2022-08-03-preview': + elif api_version == "2022-08-03-preview": from ..v2022_08_03_preview.aio.operations import ManagedClustersOperations as OperationClass - elif api_version == '2022-09-01': + elif api_version == "2022-09-01": from ..v2022_09_01.aio.operations import ManagedClustersOperations as OperationClass - elif api_version == '2022-09-02-preview': + elif api_version == "2022-09-02-preview": from ..v2022_09_02_preview.aio.operations import ManagedClustersOperations as OperationClass - elif api_version == '2022-10-02-preview': + elif api_version == "2022-10-02-preview": from ..v2022_10_02_preview.aio.operations import ManagedClustersOperations as OperationClass - elif api_version == '2022-11-01': + elif api_version == "2022-11-01": from ..v2022_11_01.aio.operations import ManagedClustersOperations as OperationClass - elif api_version == '2022-11-02-preview': + elif api_version == "2022-11-02-preview": from ..v2022_11_02_preview.aio.operations import ManagedClustersOperations as OperationClass - elif api_version == '2023-01-01': + elif api_version == "2023-01-01": from ..v2023_01_01.aio.operations import ManagedClustersOperations as OperationClass - elif api_version == '2023-01-02-preview': + elif api_version == "2023-01-02-preview": from ..v2023_01_02_preview.aio.operations import ManagedClustersOperations as OperationClass - elif api_version == '2023-02-01': + elif api_version == "2023-02-01": from ..v2023_02_01.aio.operations import ManagedClustersOperations as OperationClass - elif api_version == '2023-02-02-preview': + elif api_version == "2023-02-02-preview": from ..v2023_02_02_preview.aio.operations import ManagedClustersOperations as OperationClass - elif api_version == '2023-03-01': + elif api_version == "2023-03-01": from ..v2023_03_01.aio.operations import ManagedClustersOperations as OperationClass - elif api_version == '2023-03-02-preview': + elif api_version == "2023-03-02-preview": from ..v2023_03_02_preview.aio.operations import ManagedClustersOperations as OperationClass - elif api_version == '2023-04-01': + elif api_version == "2023-04-01": from ..v2023_04_01.aio.operations import ManagedClustersOperations as OperationClass - elif api_version == '2023-04-02-preview': + elif api_version == "2023-04-02-preview": from ..v2023_04_02_preview.aio.operations import ManagedClustersOperations as OperationClass - elif api_version == '2023-05-01': + elif api_version == "2023-05-01": from ..v2023_05_01.aio.operations import ManagedClustersOperations as OperationClass - elif api_version == '2023-05-02-preview': + elif api_version == "2023-05-02-preview": from ..v2023_05_02_preview.aio.operations import ManagedClustersOperations as OperationClass - elif api_version == '2023-06-01': + elif api_version == "2023-06-01": from ..v2023_06_01.aio.operations import ManagedClustersOperations as OperationClass - elif api_version == '2023-06-02-preview': + elif api_version == "2023-06-02-preview": from ..v2023_06_02_preview.aio.operations import ManagedClustersOperations as OperationClass - elif api_version == '2023-07-01': + elif api_version == "2023-07-01": from ..v2023_07_01.aio.operations import ManagedClustersOperations as OperationClass - elif api_version == '2023-07-02-preview': + elif api_version == "2023-07-02-preview": from ..v2023_07_02_preview.aio.operations import ManagedClustersOperations as OperationClass - elif api_version == '2023-08-01': + elif api_version == "2023-08-01": from ..v2023_08_01.aio.operations import ManagedClustersOperations as OperationClass - elif api_version == '2023-08-02-preview': + elif api_version == "2023-08-02-preview": from ..v2023_08_02_preview.aio.operations import ManagedClustersOperations as OperationClass - elif api_version == '2023-09-01': + elif api_version == "2023-09-01": from ..v2023_09_01.aio.operations import ManagedClustersOperations as OperationClass - elif api_version == '2023-09-02-preview': + elif api_version == "2023-09-02-preview": from ..v2023_09_02_preview.aio.operations import ManagedClustersOperations as OperationClass - elif api_version == '2023-10-01': + elif api_version == "2023-10-01": from ..v2023_10_01.aio.operations import ManagedClustersOperations as OperationClass - elif api_version == '2023-10-02-preview': + elif api_version == "2023-10-02-preview": from ..v2023_10_02_preview.aio.operations import ManagedClustersOperations as OperationClass - elif api_version == '2023-11-01': + elif api_version == "2023-11-01": from ..v2023_11_01.aio.operations import ManagedClustersOperations as OperationClass - elif api_version == '2023-11-02-preview': + elif api_version == "2023-11-02-preview": from ..v2023_11_02_preview.aio.operations import ManagedClustersOperations as OperationClass - elif api_version == '2024-01-01': + elif api_version == "2024-01-01": from ..v2024_01_01.aio.operations import ManagedClustersOperations as OperationClass - elif api_version == '2024-01-02-preview': + elif api_version == "2024-01-02-preview": from ..v2024_01_02_preview.aio.operations import ManagedClustersOperations as OperationClass - elif api_version == '2024-02-01': + elif api_version == "2024-02-01": from ..v2024_02_01.aio.operations import ManagedClustersOperations as OperationClass - elif api_version == '2024-02-02-preview': + elif api_version == "2024-02-02-preview": from ..v2024_02_02_preview.aio.operations import ManagedClustersOperations as OperationClass - elif api_version == '2024-03-02-preview': + elif api_version == "2024-03-02-preview": from ..v2024_03_02_preview.aio.operations import ManagedClustersOperations as OperationClass - elif api_version == '2024-04-02-preview': + elif api_version == "2024-04-02-preview": from ..v2024_04_02_preview.aio.operations import ManagedClustersOperations as OperationClass - elif api_version == '2024-05-01': + elif api_version == "2024-05-01": from ..v2024_05_01.aio.operations import ManagedClustersOperations as OperationClass - elif api_version == '2024-05-02-preview': + elif api_version == "2024-05-02-preview": from ..v2024_05_02_preview.aio.operations import ManagedClustersOperations as OperationClass - elif api_version == '2024-06-02-preview': + elif api_version == "2024-06-02-preview": from ..v2024_06_02_preview.aio.operations import ManagedClustersOperations as OperationClass - elif api_version == '2024-07-01': + elif api_version == "2024-07-01": from ..v2024_07_01.aio.operations import ManagedClustersOperations as OperationClass - elif api_version == '2024-07-02-preview': + elif api_version == "2024-07-02-preview": from ..v2024_07_02_preview.aio.operations import ManagedClustersOperations as OperationClass - elif api_version == '2024-08-01': + elif api_version == "2024-08-01": from ..v2024_08_01.aio.operations import ManagedClustersOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'managed_clusters'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) + return OperationClass( + self._client, + self._config, + Serializer(self._models_dict(api_version)), + Deserializer(self._models_dict(api_version)), + api_version, + ) @property def open_shift_managed_clusters(self): """Instance depends on the API version: - * 2018-09-30-preview: :class:`OpenShiftManagedClustersOperations` - * 2019-04-30: :class:`OpenShiftManagedClustersOperations` - * 2019-09-30-preview: :class:`OpenShiftManagedClustersOperations` - * 2019-10-27-preview: :class:`OpenShiftManagedClustersOperations` + * 2018-09-30-preview: :class:`OpenShiftManagedClustersOperations` + * 2019-04-30: :class:`OpenShiftManagedClustersOperations` + * 2019-09-30-preview: :class:`OpenShiftManagedClustersOperations` + * 2019-10-27-preview: :class:`OpenShiftManagedClustersOperations` """ - api_version = self._get_api_version('open_shift_managed_clusters') - if api_version == '2018-09-30-preview': + api_version = self._get_api_version("open_shift_managed_clusters") + if api_version == "2018-09-30-preview": from ..v2018_09_30_preview.aio.operations import OpenShiftManagedClustersOperations as OperationClass - elif api_version == '2019-04-30': + elif api_version == "2019-04-30": from ..v2019_04_30.aio.operations import OpenShiftManagedClustersOperations as OperationClass - elif api_version == '2019-09-30-preview': + elif api_version == "2019-09-30-preview": from ..v2019_09_30_preview.aio.operations import OpenShiftManagedClustersOperations as OperationClass - elif api_version == '2019-10-27-preview': + elif api_version == "2019-10-27-preview": from ..v2019_10_27_preview.aio.operations import OpenShiftManagedClustersOperations as OperationClass else: - raise ValueError("API version {} does not have operation group 'open_shift_managed_clusters'".format(api_version)) + raise ValueError( + "API version {} does not have operation group 'open_shift_managed_clusters'".format(api_version) + ) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) + return OperationClass( + self._client, + self._config, + Serializer(self._models_dict(api_version)), + Deserializer(self._models_dict(api_version)), + api_version, + ) @property def operation_status_result(self): """Instance depends on the API version: - * 2023-10-02-preview: :class:`OperationStatusResultOperations` - * 2023-11-02-preview: :class:`OperationStatusResultOperations` - * 2024-01-02-preview: :class:`OperationStatusResultOperations` - * 2024-02-02-preview: :class:`OperationStatusResultOperations` - * 2024-03-02-preview: :class:`OperationStatusResultOperations` - * 2024-04-02-preview: :class:`OperationStatusResultOperations` - * 2024-05-02-preview: :class:`OperationStatusResultOperations` - * 2024-06-02-preview: :class:`OperationStatusResultOperations` - * 2024-07-02-preview: :class:`OperationStatusResultOperations` + * 2023-10-02-preview: :class:`OperationStatusResultOperations` + * 2023-11-02-preview: :class:`OperationStatusResultOperations` + * 2024-01-02-preview: :class:`OperationStatusResultOperations` + * 2024-02-02-preview: :class:`OperationStatusResultOperations` + * 2024-03-02-preview: :class:`OperationStatusResultOperations` + * 2024-04-02-preview: :class:`OperationStatusResultOperations` + * 2024-05-02-preview: :class:`OperationStatusResultOperations` + * 2024-06-02-preview: :class:`OperationStatusResultOperations` + * 2024-07-02-preview: :class:`OperationStatusResultOperations` """ - api_version = self._get_api_version('operation_status_result') - if api_version == '2023-10-02-preview': + api_version = self._get_api_version("operation_status_result") + if api_version == "2023-10-02-preview": from ..v2023_10_02_preview.aio.operations import OperationStatusResultOperations as OperationClass - elif api_version == '2023-11-02-preview': + elif api_version == "2023-11-02-preview": from ..v2023_11_02_preview.aio.operations import OperationStatusResultOperations as OperationClass - elif api_version == '2024-01-02-preview': + elif api_version == "2024-01-02-preview": from ..v2024_01_02_preview.aio.operations import OperationStatusResultOperations as OperationClass - elif api_version == '2024-02-02-preview': + elif api_version == "2024-02-02-preview": from ..v2024_02_02_preview.aio.operations import OperationStatusResultOperations as OperationClass - elif api_version == '2024-03-02-preview': + elif api_version == "2024-03-02-preview": from ..v2024_03_02_preview.aio.operations import OperationStatusResultOperations as OperationClass - elif api_version == '2024-04-02-preview': + elif api_version == "2024-04-02-preview": from ..v2024_04_02_preview.aio.operations import OperationStatusResultOperations as OperationClass - elif api_version == '2024-05-02-preview': + elif api_version == "2024-05-02-preview": from ..v2024_05_02_preview.aio.operations import OperationStatusResultOperations as OperationClass - elif api_version == '2024-06-02-preview': + elif api_version == "2024-06-02-preview": from ..v2024_06_02_preview.aio.operations import OperationStatusResultOperations as OperationClass - elif api_version == '2024-07-02-preview': + elif api_version == "2024-07-02-preview": from ..v2024_07_02_preview.aio.operations import OperationStatusResultOperations as OperationClass else: - raise ValueError("API version {} does not have operation group 'operation_status_result'".format(api_version)) + raise ValueError( + "API version {} does not have operation group 'operation_status_result'".format(api_version) + ) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) + return OperationClass( + self._client, + self._config, + Serializer(self._models_dict(api_version)), + Deserializer(self._models_dict(api_version)), + api_version, + ) @property def operations(self): """Instance depends on the API version: - * 2018-03-31: :class:`Operations` - * 2018-08-01-preview: :class:`Operations` - * 2019-02-01: :class:`Operations` - * 2019-04-01: :class:`Operations` - * 2019-06-01: :class:`Operations` - * 2019-08-01: :class:`Operations` - * 2019-10-01: :class:`Operations` - * 2019-11-01: :class:`Operations` - * 2020-01-01: :class:`Operations` - * 2020-02-01: :class:`Operations` - * 2020-03-01: :class:`Operations` - * 2020-04-01: :class:`Operations` - * 2020-06-01: :class:`Operations` - * 2020-07-01: :class:`Operations` - * 2020-09-01: :class:`Operations` - * 2020-11-01: :class:`Operations` - * 2020-12-01: :class:`Operations` - * 2021-02-01: :class:`Operations` - * 2021-03-01: :class:`Operations` - * 2021-05-01: :class:`Operations` - * 2021-07-01: :class:`Operations` - * 2021-08-01: :class:`Operations` - * 2021-09-01: :class:`Operations` - * 2021-10-01: :class:`Operations` - * 2021-11-01-preview: :class:`Operations` - * 2022-01-01: :class:`Operations` - * 2022-01-02-preview: :class:`Operations` - * 2022-02-01: :class:`Operations` - * 2022-02-02-preview: :class:`Operations` - * 2022-03-01: :class:`Operations` - * 2022-03-02-preview: :class:`Operations` - * 2022-04-01: :class:`Operations` - * 2022-04-02-preview: :class:`Operations` - * 2022-05-02-preview: :class:`Operations` - * 2022-06-01: :class:`Operations` - * 2022-06-02-preview: :class:`Operations` - * 2022-07-01: :class:`Operations` - * 2022-07-02-preview: :class:`Operations` - * 2022-08-02-preview: :class:`Operations` - * 2022-08-03-preview: :class:`Operations` - * 2022-09-01: :class:`Operations` - * 2022-09-02-preview: :class:`Operations` - * 2022-10-02-preview: :class:`Operations` - * 2022-11-01: :class:`Operations` - * 2022-11-02-preview: :class:`Operations` - * 2023-01-01: :class:`Operations` - * 2023-01-02-preview: :class:`Operations` - * 2023-02-01: :class:`Operations` - * 2023-02-02-preview: :class:`Operations` - * 2023-03-01: :class:`Operations` - * 2023-03-02-preview: :class:`Operations` - * 2023-04-01: :class:`Operations` - * 2023-04-02-preview: :class:`Operations` - * 2023-05-01: :class:`Operations` - * 2023-05-02-preview: :class:`Operations` - * 2023-06-01: :class:`Operations` - * 2023-06-02-preview: :class:`Operations` - * 2023-07-01: :class:`Operations` - * 2023-07-02-preview: :class:`Operations` - * 2023-08-01: :class:`Operations` - * 2023-08-02-preview: :class:`Operations` - * 2023-09-01: :class:`Operations` - * 2023-09-02-preview: :class:`Operations` - * 2023-10-01: :class:`Operations` - * 2023-10-02-preview: :class:`Operations` - * 2023-11-01: :class:`Operations` - * 2023-11-02-preview: :class:`Operations` - * 2024-01-01: :class:`Operations` - * 2024-01-02-preview: :class:`Operations` - * 2024-02-01: :class:`Operations` - * 2024-02-02-preview: :class:`Operations` - * 2024-03-02-preview: :class:`Operations` - * 2024-04-02-preview: :class:`Operations` - * 2024-05-01: :class:`Operations` - * 2024-05-02-preview: :class:`Operations` - * 2024-06-02-preview: :class:`Operations` - * 2024-07-01: :class:`Operations` - * 2024-07-02-preview: :class:`Operations` - * 2024-08-01: :class:`Operations` + * 2018-03-31: :class:`Operations` + * 2018-08-01-preview: :class:`Operations` + * 2019-02-01: :class:`Operations` + * 2019-04-01: :class:`Operations` + * 2019-06-01: :class:`Operations` + * 2019-08-01: :class:`Operations` + * 2019-10-01: :class:`Operations` + * 2019-11-01: :class:`Operations` + * 2020-01-01: :class:`Operations` + * 2020-02-01: :class:`Operations` + * 2020-03-01: :class:`Operations` + * 2020-04-01: :class:`Operations` + * 2020-06-01: :class:`Operations` + * 2020-07-01: :class:`Operations` + * 2020-09-01: :class:`Operations` + * 2020-11-01: :class:`Operations` + * 2020-12-01: :class:`Operations` + * 2021-02-01: :class:`Operations` + * 2021-03-01: :class:`Operations` + * 2021-05-01: :class:`Operations` + * 2021-07-01: :class:`Operations` + * 2021-08-01: :class:`Operations` + * 2021-09-01: :class:`Operations` + * 2021-10-01: :class:`Operations` + * 2021-11-01-preview: :class:`Operations` + * 2022-01-01: :class:`Operations` + * 2022-01-02-preview: :class:`Operations` + * 2022-02-01: :class:`Operations` + * 2022-02-02-preview: :class:`Operations` + * 2022-03-01: :class:`Operations` + * 2022-03-02-preview: :class:`Operations` + * 2022-04-01: :class:`Operations` + * 2022-04-02-preview: :class:`Operations` + * 2022-05-02-preview: :class:`Operations` + * 2022-06-01: :class:`Operations` + * 2022-06-02-preview: :class:`Operations` + * 2022-07-01: :class:`Operations` + * 2022-07-02-preview: :class:`Operations` + * 2022-08-02-preview: :class:`Operations` + * 2022-08-03-preview: :class:`Operations` + * 2022-09-01: :class:`Operations` + * 2022-09-02-preview: :class:`Operations` + * 2022-10-02-preview: :class:`Operations` + * 2022-11-01: :class:`Operations` + * 2022-11-02-preview: :class:`Operations` + * 2023-01-01: :class:`Operations` + * 2023-01-02-preview: :class:`Operations` + * 2023-02-01: :class:`Operations` + * 2023-02-02-preview: :class:`Operations` + * 2023-03-01: :class:`Operations` + * 2023-03-02-preview: :class:`Operations` + * 2023-04-01: :class:`Operations` + * 2023-04-02-preview: :class:`Operations` + * 2023-05-01: :class:`Operations` + * 2023-05-02-preview: :class:`Operations` + * 2023-06-01: :class:`Operations` + * 2023-06-02-preview: :class:`Operations` + * 2023-07-01: :class:`Operations` + * 2023-07-02-preview: :class:`Operations` + * 2023-08-01: :class:`Operations` + * 2023-08-02-preview: :class:`Operations` + * 2023-09-01: :class:`Operations` + * 2023-09-02-preview: :class:`Operations` + * 2023-10-01: :class:`Operations` + * 2023-10-02-preview: :class:`Operations` + * 2023-11-01: :class:`Operations` + * 2023-11-02-preview: :class:`Operations` + * 2024-01-01: :class:`Operations` + * 2024-01-02-preview: :class:`Operations` + * 2024-02-01: :class:`Operations` + * 2024-02-02-preview: :class:`Operations` + * 2024-03-02-preview: :class:`Operations` + * 2024-04-02-preview: :class:`Operations` + * 2024-05-01: :class:`Operations` + * 2024-05-02-preview: :class:`Operations` + * 2024-06-02-preview: :class:`Operations` + * 2024-07-01: :class:`Operations` + * 2024-07-02-preview: :class:`Operations` + * 2024-08-01: :class:`Operations` """ - api_version = self._get_api_version('operations') - if api_version == '2018-03-31': + api_version = self._get_api_version("operations") + if api_version == "2018-03-31": from ..v2018_03_31.aio.operations import Operations as OperationClass - elif api_version == '2018-08-01-preview': + elif api_version == "2018-08-01-preview": from ..v2018_08_01_preview.aio.operations import Operations as OperationClass - elif api_version == '2019-02-01': + elif api_version == "2019-02-01": from ..v2019_02_01.aio.operations import Operations as OperationClass - elif api_version == '2019-04-01': + elif api_version == "2019-04-01": from ..v2019_04_01.aio.operations import Operations as OperationClass - elif api_version == '2019-06-01': + elif api_version == "2019-06-01": from ..v2019_06_01.aio.operations import Operations as OperationClass - elif api_version == '2019-08-01': + elif api_version == "2019-08-01": from ..v2019_08_01.aio.operations import Operations as OperationClass - elif api_version == '2019-10-01': + elif api_version == "2019-10-01": from ..v2019_10_01.aio.operations import Operations as OperationClass - elif api_version == '2019-11-01': + elif api_version == "2019-11-01": from ..v2019_11_01.aio.operations import Operations as OperationClass - elif api_version == '2020-01-01': + elif api_version == "2020-01-01": from ..v2020_01_01.aio.operations import Operations as OperationClass - elif api_version == '2020-02-01': + elif api_version == "2020-02-01": from ..v2020_02_01.aio.operations import Operations as OperationClass - elif api_version == '2020-03-01': + elif api_version == "2020-03-01": from ..v2020_03_01.aio.operations import Operations as OperationClass - elif api_version == '2020-04-01': + elif api_version == "2020-04-01": from ..v2020_04_01.aio.operations import Operations as OperationClass - elif api_version == '2020-06-01': + elif api_version == "2020-06-01": from ..v2020_06_01.aio.operations import Operations as OperationClass - elif api_version == '2020-07-01': + elif api_version == "2020-07-01": from ..v2020_07_01.aio.operations import Operations as OperationClass - elif api_version == '2020-09-01': + elif api_version == "2020-09-01": from ..v2020_09_01.aio.operations import Operations as OperationClass - elif api_version == '2020-11-01': + elif api_version == "2020-11-01": from ..v2020_11_01.aio.operations import Operations as OperationClass - elif api_version == '2020-12-01': + elif api_version == "2020-12-01": from ..v2020_12_01.aio.operations import Operations as OperationClass - elif api_version == '2021-02-01': + elif api_version == "2021-02-01": from ..v2021_02_01.aio.operations import Operations as OperationClass - elif api_version == '2021-03-01': + elif api_version == "2021-03-01": from ..v2021_03_01.aio.operations import Operations as OperationClass - elif api_version == '2021-05-01': + elif api_version == "2021-05-01": from ..v2021_05_01.aio.operations import Operations as OperationClass - elif api_version == '2021-07-01': + elif api_version == "2021-07-01": from ..v2021_07_01.aio.operations import Operations as OperationClass - elif api_version == '2021-08-01': + elif api_version == "2021-08-01": from ..v2021_08_01.aio.operations import Operations as OperationClass - elif api_version == '2021-09-01': + elif api_version == "2021-09-01": from ..v2021_09_01.aio.operations import Operations as OperationClass - elif api_version == '2021-10-01': + elif api_version == "2021-10-01": from ..v2021_10_01.aio.operations import Operations as OperationClass - elif api_version == '2021-11-01-preview': + elif api_version == "2021-11-01-preview": from ..v2021_11_01_preview.aio.operations import Operations as OperationClass - elif api_version == '2022-01-01': + elif api_version == "2022-01-01": from ..v2022_01_01.aio.operations import Operations as OperationClass - elif api_version == '2022-01-02-preview': + elif api_version == "2022-01-02-preview": from ..v2022_01_02_preview.aio.operations import Operations as OperationClass - elif api_version == '2022-02-01': + elif api_version == "2022-02-01": from ..v2022_02_01.aio.operations import Operations as OperationClass - elif api_version == '2022-02-02-preview': + elif api_version == "2022-02-02-preview": from ..v2022_02_02_preview.aio.operations import Operations as OperationClass - elif api_version == '2022-03-01': + elif api_version == "2022-03-01": from ..v2022_03_01.aio.operations import Operations as OperationClass - elif api_version == '2022-03-02-preview': + elif api_version == "2022-03-02-preview": from ..v2022_03_02_preview.aio.operations import Operations as OperationClass - elif api_version == '2022-04-01': + elif api_version == "2022-04-01": from ..v2022_04_01.aio.operations import Operations as OperationClass - elif api_version == '2022-04-02-preview': + elif api_version == "2022-04-02-preview": from ..v2022_04_02_preview.aio.operations import Operations as OperationClass - elif api_version == '2022-05-02-preview': + elif api_version == "2022-05-02-preview": from ..v2022_05_02_preview.aio.operations import Operations as OperationClass - elif api_version == '2022-06-01': + elif api_version == "2022-06-01": from ..v2022_06_01.aio.operations import Operations as OperationClass - elif api_version == '2022-06-02-preview': + elif api_version == "2022-06-02-preview": from ..v2022_06_02_preview.aio.operations import Operations as OperationClass - elif api_version == '2022-07-01': + elif api_version == "2022-07-01": from ..v2022_07_01.aio.operations import Operations as OperationClass - elif api_version == '2022-07-02-preview': + elif api_version == "2022-07-02-preview": from ..v2022_07_02_preview.aio.operations import Operations as OperationClass - elif api_version == '2022-08-02-preview': + elif api_version == "2022-08-02-preview": from ..v2022_08_02_preview.aio.operations import Operations as OperationClass - elif api_version == '2022-08-03-preview': + elif api_version == "2022-08-03-preview": from ..v2022_08_03_preview.aio.operations import Operations as OperationClass - elif api_version == '2022-09-01': + elif api_version == "2022-09-01": from ..v2022_09_01.aio.operations import Operations as OperationClass - elif api_version == '2022-09-02-preview': + elif api_version == "2022-09-02-preview": from ..v2022_09_02_preview.aio.operations import Operations as OperationClass - elif api_version == '2022-10-02-preview': + elif api_version == "2022-10-02-preview": from ..v2022_10_02_preview.aio.operations import Operations as OperationClass - elif api_version == '2022-11-01': + elif api_version == "2022-11-01": from ..v2022_11_01.aio.operations import Operations as OperationClass - elif api_version == '2022-11-02-preview': + elif api_version == "2022-11-02-preview": from ..v2022_11_02_preview.aio.operations import Operations as OperationClass - elif api_version == '2023-01-01': + elif api_version == "2023-01-01": from ..v2023_01_01.aio.operations import Operations as OperationClass - elif api_version == '2023-01-02-preview': + elif api_version == "2023-01-02-preview": from ..v2023_01_02_preview.aio.operations import Operations as OperationClass - elif api_version == '2023-02-01': + elif api_version == "2023-02-01": from ..v2023_02_01.aio.operations import Operations as OperationClass - elif api_version == '2023-02-02-preview': + elif api_version == "2023-02-02-preview": from ..v2023_02_02_preview.aio.operations import Operations as OperationClass - elif api_version == '2023-03-01': + elif api_version == "2023-03-01": from ..v2023_03_01.aio.operations import Operations as OperationClass - elif api_version == '2023-03-02-preview': + elif api_version == "2023-03-02-preview": from ..v2023_03_02_preview.aio.operations import Operations as OperationClass - elif api_version == '2023-04-01': + elif api_version == "2023-04-01": from ..v2023_04_01.aio.operations import Operations as OperationClass - elif api_version == '2023-04-02-preview': + elif api_version == "2023-04-02-preview": from ..v2023_04_02_preview.aio.operations import Operations as OperationClass - elif api_version == '2023-05-01': + elif api_version == "2023-05-01": from ..v2023_05_01.aio.operations import Operations as OperationClass - elif api_version == '2023-05-02-preview': + elif api_version == "2023-05-02-preview": from ..v2023_05_02_preview.aio.operations import Operations as OperationClass - elif api_version == '2023-06-01': + elif api_version == "2023-06-01": from ..v2023_06_01.aio.operations import Operations as OperationClass - elif api_version == '2023-06-02-preview': + elif api_version == "2023-06-02-preview": from ..v2023_06_02_preview.aio.operations import Operations as OperationClass - elif api_version == '2023-07-01': + elif api_version == "2023-07-01": from ..v2023_07_01.aio.operations import Operations as OperationClass - elif api_version == '2023-07-02-preview': + elif api_version == "2023-07-02-preview": from ..v2023_07_02_preview.aio.operations import Operations as OperationClass - elif api_version == '2023-08-01': + elif api_version == "2023-08-01": from ..v2023_08_01.aio.operations import Operations as OperationClass - elif api_version == '2023-08-02-preview': + elif api_version == "2023-08-02-preview": from ..v2023_08_02_preview.aio.operations import Operations as OperationClass - elif api_version == '2023-09-01': + elif api_version == "2023-09-01": from ..v2023_09_01.aio.operations import Operations as OperationClass - elif api_version == '2023-09-02-preview': + elif api_version == "2023-09-02-preview": from ..v2023_09_02_preview.aio.operations import Operations as OperationClass - elif api_version == '2023-10-01': + elif api_version == "2023-10-01": from ..v2023_10_01.aio.operations import Operations as OperationClass - elif api_version == '2023-10-02-preview': + elif api_version == "2023-10-02-preview": from ..v2023_10_02_preview.aio.operations import Operations as OperationClass - elif api_version == '2023-11-01': + elif api_version == "2023-11-01": from ..v2023_11_01.aio.operations import Operations as OperationClass - elif api_version == '2023-11-02-preview': + elif api_version == "2023-11-02-preview": from ..v2023_11_02_preview.aio.operations import Operations as OperationClass - elif api_version == '2024-01-01': + elif api_version == "2024-01-01": from ..v2024_01_01.aio.operations import Operations as OperationClass - elif api_version == '2024-01-02-preview': + elif api_version == "2024-01-02-preview": from ..v2024_01_02_preview.aio.operations import Operations as OperationClass - elif api_version == '2024-02-01': + elif api_version == "2024-02-01": from ..v2024_02_01.aio.operations import Operations as OperationClass - elif api_version == '2024-02-02-preview': + elif api_version == "2024-02-02-preview": from ..v2024_02_02_preview.aio.operations import Operations as OperationClass - elif api_version == '2024-03-02-preview': + elif api_version == "2024-03-02-preview": from ..v2024_03_02_preview.aio.operations import Operations as OperationClass - elif api_version == '2024-04-02-preview': + elif api_version == "2024-04-02-preview": from ..v2024_04_02_preview.aio.operations import Operations as OperationClass - elif api_version == '2024-05-01': + elif api_version == "2024-05-01": from ..v2024_05_01.aio.operations import Operations as OperationClass - elif api_version == '2024-05-02-preview': + elif api_version == "2024-05-02-preview": from ..v2024_05_02_preview.aio.operations import Operations as OperationClass - elif api_version == '2024-06-02-preview': + elif api_version == "2024-06-02-preview": from ..v2024_06_02_preview.aio.operations import Operations as OperationClass - elif api_version == '2024-07-01': + elif api_version == "2024-07-01": from ..v2024_07_01.aio.operations import Operations as OperationClass - elif api_version == '2024-07-02-preview': + elif api_version == "2024-07-02-preview": from ..v2024_07_02_preview.aio.operations import Operations as OperationClass - elif api_version == '2024-08-01': + elif api_version == "2024-08-01": from ..v2024_08_01.aio.operations import Operations as OperationClass else: raise ValueError("API version {} does not have operation group 'operations'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) + return OperationClass( + self._client, + self._config, + Serializer(self._models_dict(api_version)), + Deserializer(self._models_dict(api_version)), + api_version, + ) @property def private_endpoint_connections(self): """Instance depends on the API version: - * 2020-06-01: :class:`PrivateEndpointConnectionsOperations` - * 2020-07-01: :class:`PrivateEndpointConnectionsOperations` - * 2020-09-01: :class:`PrivateEndpointConnectionsOperations` - * 2020-11-01: :class:`PrivateEndpointConnectionsOperations` - * 2020-12-01: :class:`PrivateEndpointConnectionsOperations` - * 2021-02-01: :class:`PrivateEndpointConnectionsOperations` - * 2021-03-01: :class:`PrivateEndpointConnectionsOperations` - * 2021-05-01: :class:`PrivateEndpointConnectionsOperations` - * 2021-07-01: :class:`PrivateEndpointConnectionsOperations` - * 2021-08-01: :class:`PrivateEndpointConnectionsOperations` - * 2021-09-01: :class:`PrivateEndpointConnectionsOperations` - * 2021-10-01: :class:`PrivateEndpointConnectionsOperations` - * 2021-11-01-preview: :class:`PrivateEndpointConnectionsOperations` - * 2022-01-01: :class:`PrivateEndpointConnectionsOperations` - * 2022-01-02-preview: :class:`PrivateEndpointConnectionsOperations` - * 2022-02-01: :class:`PrivateEndpointConnectionsOperations` - * 2022-02-02-preview: :class:`PrivateEndpointConnectionsOperations` - * 2022-03-01: :class:`PrivateEndpointConnectionsOperations` - * 2022-03-02-preview: :class:`PrivateEndpointConnectionsOperations` - * 2022-04-01: :class:`PrivateEndpointConnectionsOperations` - * 2022-04-02-preview: :class:`PrivateEndpointConnectionsOperations` - * 2022-05-02-preview: :class:`PrivateEndpointConnectionsOperations` - * 2022-06-01: :class:`PrivateEndpointConnectionsOperations` - * 2022-06-02-preview: :class:`PrivateEndpointConnectionsOperations` - * 2022-07-01: :class:`PrivateEndpointConnectionsOperations` - * 2022-07-02-preview: :class:`PrivateEndpointConnectionsOperations` - * 2022-08-02-preview: :class:`PrivateEndpointConnectionsOperations` - * 2022-08-03-preview: :class:`PrivateEndpointConnectionsOperations` - * 2022-09-01: :class:`PrivateEndpointConnectionsOperations` - * 2022-09-02-preview: :class:`PrivateEndpointConnectionsOperations` - * 2022-10-02-preview: :class:`PrivateEndpointConnectionsOperations` - * 2022-11-01: :class:`PrivateEndpointConnectionsOperations` - * 2022-11-02-preview: :class:`PrivateEndpointConnectionsOperations` - * 2023-01-01: :class:`PrivateEndpointConnectionsOperations` - * 2023-01-02-preview: :class:`PrivateEndpointConnectionsOperations` - * 2023-02-01: :class:`PrivateEndpointConnectionsOperations` - * 2023-02-02-preview: :class:`PrivateEndpointConnectionsOperations` - * 2023-03-01: :class:`PrivateEndpointConnectionsOperations` - * 2023-03-02-preview: :class:`PrivateEndpointConnectionsOperations` - * 2023-04-01: :class:`PrivateEndpointConnectionsOperations` - * 2023-04-02-preview: :class:`PrivateEndpointConnectionsOperations` - * 2023-05-01: :class:`PrivateEndpointConnectionsOperations` - * 2023-05-02-preview: :class:`PrivateEndpointConnectionsOperations` - * 2023-06-01: :class:`PrivateEndpointConnectionsOperations` - * 2023-06-02-preview: :class:`PrivateEndpointConnectionsOperations` - * 2023-07-01: :class:`PrivateEndpointConnectionsOperations` - * 2023-07-02-preview: :class:`PrivateEndpointConnectionsOperations` - * 2023-08-01: :class:`PrivateEndpointConnectionsOperations` - * 2023-08-02-preview: :class:`PrivateEndpointConnectionsOperations` - * 2023-09-01: :class:`PrivateEndpointConnectionsOperations` - * 2023-09-02-preview: :class:`PrivateEndpointConnectionsOperations` - * 2023-10-01: :class:`PrivateEndpointConnectionsOperations` - * 2023-10-02-preview: :class:`PrivateEndpointConnectionsOperations` - * 2023-11-01: :class:`PrivateEndpointConnectionsOperations` - * 2023-11-02-preview: :class:`PrivateEndpointConnectionsOperations` - * 2024-01-01: :class:`PrivateEndpointConnectionsOperations` - * 2024-01-02-preview: :class:`PrivateEndpointConnectionsOperations` - * 2024-02-01: :class:`PrivateEndpointConnectionsOperations` - * 2024-02-02-preview: :class:`PrivateEndpointConnectionsOperations` - * 2024-03-02-preview: :class:`PrivateEndpointConnectionsOperations` - * 2024-04-02-preview: :class:`PrivateEndpointConnectionsOperations` - * 2024-05-01: :class:`PrivateEndpointConnectionsOperations` - * 2024-05-02-preview: :class:`PrivateEndpointConnectionsOperations` - * 2024-06-02-preview: :class:`PrivateEndpointConnectionsOperations` - * 2024-07-01: :class:`PrivateEndpointConnectionsOperations` - * 2024-07-02-preview: :class:`PrivateEndpointConnectionsOperations` - * 2024-08-01: :class:`PrivateEndpointConnectionsOperations` + * 2020-06-01: :class:`PrivateEndpointConnectionsOperations` + * 2020-07-01: :class:`PrivateEndpointConnectionsOperations` + * 2020-09-01: :class:`PrivateEndpointConnectionsOperations` + * 2020-11-01: :class:`PrivateEndpointConnectionsOperations` + * 2020-12-01: :class:`PrivateEndpointConnectionsOperations` + * 2021-02-01: :class:`PrivateEndpointConnectionsOperations` + * 2021-03-01: :class:`PrivateEndpointConnectionsOperations` + * 2021-05-01: :class:`PrivateEndpointConnectionsOperations` + * 2021-07-01: :class:`PrivateEndpointConnectionsOperations` + * 2021-08-01: :class:`PrivateEndpointConnectionsOperations` + * 2021-09-01: :class:`PrivateEndpointConnectionsOperations` + * 2021-10-01: :class:`PrivateEndpointConnectionsOperations` + * 2021-11-01-preview: :class:`PrivateEndpointConnectionsOperations` + * 2022-01-01: :class:`PrivateEndpointConnectionsOperations` + * 2022-01-02-preview: :class:`PrivateEndpointConnectionsOperations` + * 2022-02-01: :class:`PrivateEndpointConnectionsOperations` + * 2022-02-02-preview: :class:`PrivateEndpointConnectionsOperations` + * 2022-03-01: :class:`PrivateEndpointConnectionsOperations` + * 2022-03-02-preview: :class:`PrivateEndpointConnectionsOperations` + * 2022-04-01: :class:`PrivateEndpointConnectionsOperations` + * 2022-04-02-preview: :class:`PrivateEndpointConnectionsOperations` + * 2022-05-02-preview: :class:`PrivateEndpointConnectionsOperations` + * 2022-06-01: :class:`PrivateEndpointConnectionsOperations` + * 2022-06-02-preview: :class:`PrivateEndpointConnectionsOperations` + * 2022-07-01: :class:`PrivateEndpointConnectionsOperations` + * 2022-07-02-preview: :class:`PrivateEndpointConnectionsOperations` + * 2022-08-02-preview: :class:`PrivateEndpointConnectionsOperations` + * 2022-08-03-preview: :class:`PrivateEndpointConnectionsOperations` + * 2022-09-01: :class:`PrivateEndpointConnectionsOperations` + * 2022-09-02-preview: :class:`PrivateEndpointConnectionsOperations` + * 2022-10-02-preview: :class:`PrivateEndpointConnectionsOperations` + * 2022-11-01: :class:`PrivateEndpointConnectionsOperations` + * 2022-11-02-preview: :class:`PrivateEndpointConnectionsOperations` + * 2023-01-01: :class:`PrivateEndpointConnectionsOperations` + * 2023-01-02-preview: :class:`PrivateEndpointConnectionsOperations` + * 2023-02-01: :class:`PrivateEndpointConnectionsOperations` + * 2023-02-02-preview: :class:`PrivateEndpointConnectionsOperations` + * 2023-03-01: :class:`PrivateEndpointConnectionsOperations` + * 2023-03-02-preview: :class:`PrivateEndpointConnectionsOperations` + * 2023-04-01: :class:`PrivateEndpointConnectionsOperations` + * 2023-04-02-preview: :class:`PrivateEndpointConnectionsOperations` + * 2023-05-01: :class:`PrivateEndpointConnectionsOperations` + * 2023-05-02-preview: :class:`PrivateEndpointConnectionsOperations` + * 2023-06-01: :class:`PrivateEndpointConnectionsOperations` + * 2023-06-02-preview: :class:`PrivateEndpointConnectionsOperations` + * 2023-07-01: :class:`PrivateEndpointConnectionsOperations` + * 2023-07-02-preview: :class:`PrivateEndpointConnectionsOperations` + * 2023-08-01: :class:`PrivateEndpointConnectionsOperations` + * 2023-08-02-preview: :class:`PrivateEndpointConnectionsOperations` + * 2023-09-01: :class:`PrivateEndpointConnectionsOperations` + * 2023-09-02-preview: :class:`PrivateEndpointConnectionsOperations` + * 2023-10-01: :class:`PrivateEndpointConnectionsOperations` + * 2023-10-02-preview: :class:`PrivateEndpointConnectionsOperations` + * 2023-11-01: :class:`PrivateEndpointConnectionsOperations` + * 2023-11-02-preview: :class:`PrivateEndpointConnectionsOperations` + * 2024-01-01: :class:`PrivateEndpointConnectionsOperations` + * 2024-01-02-preview: :class:`PrivateEndpointConnectionsOperations` + * 2024-02-01: :class:`PrivateEndpointConnectionsOperations` + * 2024-02-02-preview: :class:`PrivateEndpointConnectionsOperations` + * 2024-03-02-preview: :class:`PrivateEndpointConnectionsOperations` + * 2024-04-02-preview: :class:`PrivateEndpointConnectionsOperations` + * 2024-05-01: :class:`PrivateEndpointConnectionsOperations` + * 2024-05-02-preview: :class:`PrivateEndpointConnectionsOperations` + * 2024-06-02-preview: :class:`PrivateEndpointConnectionsOperations` + * 2024-07-01: :class:`PrivateEndpointConnectionsOperations` + * 2024-07-02-preview: :class:`PrivateEndpointConnectionsOperations` + * 2024-08-01: :class:`PrivateEndpointConnectionsOperations` """ - api_version = self._get_api_version('private_endpoint_connections') - if api_version == '2020-06-01': + api_version = self._get_api_version("private_endpoint_connections") + if api_version == "2020-06-01": from ..v2020_06_01.aio.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2020-07-01': + elif api_version == "2020-07-01": from ..v2020_07_01.aio.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2020-09-01': + elif api_version == "2020-09-01": from ..v2020_09_01.aio.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2020-11-01': + elif api_version == "2020-11-01": from ..v2020_11_01.aio.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2020-12-01': + elif api_version == "2020-12-01": from ..v2020_12_01.aio.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2021-02-01': + elif api_version == "2021-02-01": from ..v2021_02_01.aio.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2021-03-01': + elif api_version == "2021-03-01": from ..v2021_03_01.aio.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2021-05-01': + elif api_version == "2021-05-01": from ..v2021_05_01.aio.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2021-07-01': + elif api_version == "2021-07-01": from ..v2021_07_01.aio.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2021-08-01': + elif api_version == "2021-08-01": from ..v2021_08_01.aio.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2021-09-01': + elif api_version == "2021-09-01": from ..v2021_09_01.aio.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2021-10-01': + elif api_version == "2021-10-01": from ..v2021_10_01.aio.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2021-11-01-preview': + elif api_version == "2021-11-01-preview": from ..v2021_11_01_preview.aio.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2022-01-01': + elif api_version == "2022-01-01": from ..v2022_01_01.aio.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2022-01-02-preview': + elif api_version == "2022-01-02-preview": from ..v2022_01_02_preview.aio.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2022-02-01': + elif api_version == "2022-02-01": from ..v2022_02_01.aio.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2022-02-02-preview': + elif api_version == "2022-02-02-preview": from ..v2022_02_02_preview.aio.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2022-03-01': + elif api_version == "2022-03-01": from ..v2022_03_01.aio.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2022-03-02-preview': + elif api_version == "2022-03-02-preview": from ..v2022_03_02_preview.aio.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2022-04-01': + elif api_version == "2022-04-01": from ..v2022_04_01.aio.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2022-04-02-preview': + elif api_version == "2022-04-02-preview": from ..v2022_04_02_preview.aio.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2022-05-02-preview': + elif api_version == "2022-05-02-preview": from ..v2022_05_02_preview.aio.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2022-06-01': + elif api_version == "2022-06-01": from ..v2022_06_01.aio.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2022-06-02-preview': + elif api_version == "2022-06-02-preview": from ..v2022_06_02_preview.aio.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2022-07-01': + elif api_version == "2022-07-01": from ..v2022_07_01.aio.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2022-07-02-preview': + elif api_version == "2022-07-02-preview": from ..v2022_07_02_preview.aio.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2022-08-02-preview': + elif api_version == "2022-08-02-preview": from ..v2022_08_02_preview.aio.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2022-08-03-preview': + elif api_version == "2022-08-03-preview": from ..v2022_08_03_preview.aio.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2022-09-01': + elif api_version == "2022-09-01": from ..v2022_09_01.aio.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2022-09-02-preview': + elif api_version == "2022-09-02-preview": from ..v2022_09_02_preview.aio.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2022-10-02-preview': + elif api_version == "2022-10-02-preview": from ..v2022_10_02_preview.aio.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2022-11-01': + elif api_version == "2022-11-01": from ..v2022_11_01.aio.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2022-11-02-preview': + elif api_version == "2022-11-02-preview": from ..v2022_11_02_preview.aio.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2023-01-01': + elif api_version == "2023-01-01": from ..v2023_01_01.aio.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2023-01-02-preview': + elif api_version == "2023-01-02-preview": from ..v2023_01_02_preview.aio.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2023-02-01': + elif api_version == "2023-02-01": from ..v2023_02_01.aio.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2023-02-02-preview': + elif api_version == "2023-02-02-preview": from ..v2023_02_02_preview.aio.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2023-03-01': + elif api_version == "2023-03-01": from ..v2023_03_01.aio.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2023-03-02-preview': + elif api_version == "2023-03-02-preview": from ..v2023_03_02_preview.aio.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2023-04-01': + elif api_version == "2023-04-01": from ..v2023_04_01.aio.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2023-04-02-preview': + elif api_version == "2023-04-02-preview": from ..v2023_04_02_preview.aio.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2023-05-01': + elif api_version == "2023-05-01": from ..v2023_05_01.aio.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2023-05-02-preview': + elif api_version == "2023-05-02-preview": from ..v2023_05_02_preview.aio.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2023-06-01': + elif api_version == "2023-06-01": from ..v2023_06_01.aio.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2023-06-02-preview': + elif api_version == "2023-06-02-preview": from ..v2023_06_02_preview.aio.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2023-07-01': + elif api_version == "2023-07-01": from ..v2023_07_01.aio.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2023-07-02-preview': + elif api_version == "2023-07-02-preview": from ..v2023_07_02_preview.aio.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2023-08-01': + elif api_version == "2023-08-01": from ..v2023_08_01.aio.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2023-08-02-preview': + elif api_version == "2023-08-02-preview": from ..v2023_08_02_preview.aio.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2023-09-01': + elif api_version == "2023-09-01": from ..v2023_09_01.aio.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2023-09-02-preview': + elif api_version == "2023-09-02-preview": from ..v2023_09_02_preview.aio.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2023-10-01': + elif api_version == "2023-10-01": from ..v2023_10_01.aio.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2023-10-02-preview': + elif api_version == "2023-10-02-preview": from ..v2023_10_02_preview.aio.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2023-11-01': + elif api_version == "2023-11-01": from ..v2023_11_01.aio.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2023-11-02-preview': + elif api_version == "2023-11-02-preview": from ..v2023_11_02_preview.aio.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2024-01-01': + elif api_version == "2024-01-01": from ..v2024_01_01.aio.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2024-01-02-preview': + elif api_version == "2024-01-02-preview": from ..v2024_01_02_preview.aio.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2024-02-01': + elif api_version == "2024-02-01": from ..v2024_02_01.aio.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2024-02-02-preview': + elif api_version == "2024-02-02-preview": from ..v2024_02_02_preview.aio.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2024-03-02-preview': + elif api_version == "2024-03-02-preview": from ..v2024_03_02_preview.aio.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2024-04-02-preview': + elif api_version == "2024-04-02-preview": from ..v2024_04_02_preview.aio.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2024-05-01': + elif api_version == "2024-05-01": from ..v2024_05_01.aio.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2024-05-02-preview': + elif api_version == "2024-05-02-preview": from ..v2024_05_02_preview.aio.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2024-06-02-preview': + elif api_version == "2024-06-02-preview": from ..v2024_06_02_preview.aio.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2024-07-01': + elif api_version == "2024-07-01": from ..v2024_07_01.aio.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2024-07-02-preview': + elif api_version == "2024-07-02-preview": from ..v2024_07_02_preview.aio.operations import PrivateEndpointConnectionsOperations as OperationClass - elif api_version == '2024-08-01': + elif api_version == "2024-08-01": from ..v2024_08_01.aio.operations import PrivateEndpointConnectionsOperations as OperationClass else: - raise ValueError("API version {} does not have operation group 'private_endpoint_connections'".format(api_version)) + raise ValueError( + "API version {} does not have operation group 'private_endpoint_connections'".format(api_version) + ) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) + return OperationClass( + self._client, + self._config, + Serializer(self._models_dict(api_version)), + Deserializer(self._models_dict(api_version)), + api_version, + ) @property def private_link_resources(self): """Instance depends on the API version: - * 2020-09-01: :class:`PrivateLinkResourcesOperations` - * 2020-11-01: :class:`PrivateLinkResourcesOperations` - * 2020-12-01: :class:`PrivateLinkResourcesOperations` - * 2021-02-01: :class:`PrivateLinkResourcesOperations` - * 2021-03-01: :class:`PrivateLinkResourcesOperations` - * 2021-05-01: :class:`PrivateLinkResourcesOperations` - * 2021-07-01: :class:`PrivateLinkResourcesOperations` - * 2021-08-01: :class:`PrivateLinkResourcesOperations` - * 2021-09-01: :class:`PrivateLinkResourcesOperations` - * 2021-10-01: :class:`PrivateLinkResourcesOperations` - * 2021-11-01-preview: :class:`PrivateLinkResourcesOperations` - * 2022-01-01: :class:`PrivateLinkResourcesOperations` - * 2022-01-02-preview: :class:`PrivateLinkResourcesOperations` - * 2022-02-01: :class:`PrivateLinkResourcesOperations` - * 2022-02-02-preview: :class:`PrivateLinkResourcesOperations` - * 2022-03-01: :class:`PrivateLinkResourcesOperations` - * 2022-03-02-preview: :class:`PrivateLinkResourcesOperations` - * 2022-04-01: :class:`PrivateLinkResourcesOperations` - * 2022-04-02-preview: :class:`PrivateLinkResourcesOperations` - * 2022-05-02-preview: :class:`PrivateLinkResourcesOperations` - * 2022-06-01: :class:`PrivateLinkResourcesOperations` - * 2022-06-02-preview: :class:`PrivateLinkResourcesOperations` - * 2022-07-01: :class:`PrivateLinkResourcesOperations` - * 2022-07-02-preview: :class:`PrivateLinkResourcesOperations` - * 2022-08-02-preview: :class:`PrivateLinkResourcesOperations` - * 2022-08-03-preview: :class:`PrivateLinkResourcesOperations` - * 2022-09-01: :class:`PrivateLinkResourcesOperations` - * 2022-09-02-preview: :class:`PrivateLinkResourcesOperations` - * 2022-10-02-preview: :class:`PrivateLinkResourcesOperations` - * 2022-11-01: :class:`PrivateLinkResourcesOperations` - * 2022-11-02-preview: :class:`PrivateLinkResourcesOperations` - * 2023-01-01: :class:`PrivateLinkResourcesOperations` - * 2023-01-02-preview: :class:`PrivateLinkResourcesOperations` - * 2023-02-01: :class:`PrivateLinkResourcesOperations` - * 2023-02-02-preview: :class:`PrivateLinkResourcesOperations` - * 2023-03-01: :class:`PrivateLinkResourcesOperations` - * 2023-03-02-preview: :class:`PrivateLinkResourcesOperations` - * 2023-04-01: :class:`PrivateLinkResourcesOperations` - * 2023-04-02-preview: :class:`PrivateLinkResourcesOperations` - * 2023-05-01: :class:`PrivateLinkResourcesOperations` - * 2023-05-02-preview: :class:`PrivateLinkResourcesOperations` - * 2023-06-01: :class:`PrivateLinkResourcesOperations` - * 2023-06-02-preview: :class:`PrivateLinkResourcesOperations` - * 2023-07-01: :class:`PrivateLinkResourcesOperations` - * 2023-07-02-preview: :class:`PrivateLinkResourcesOperations` - * 2023-08-01: :class:`PrivateLinkResourcesOperations` - * 2023-08-02-preview: :class:`PrivateLinkResourcesOperations` - * 2023-09-01: :class:`PrivateLinkResourcesOperations` - * 2023-09-02-preview: :class:`PrivateLinkResourcesOperations` - * 2023-10-01: :class:`PrivateLinkResourcesOperations` - * 2023-10-02-preview: :class:`PrivateLinkResourcesOperations` - * 2023-11-01: :class:`PrivateLinkResourcesOperations` - * 2023-11-02-preview: :class:`PrivateLinkResourcesOperations` - * 2024-01-01: :class:`PrivateLinkResourcesOperations` - * 2024-01-02-preview: :class:`PrivateLinkResourcesOperations` - * 2024-02-01: :class:`PrivateLinkResourcesOperations` - * 2024-02-02-preview: :class:`PrivateLinkResourcesOperations` - * 2024-03-02-preview: :class:`PrivateLinkResourcesOperations` - * 2024-04-02-preview: :class:`PrivateLinkResourcesOperations` - * 2024-05-01: :class:`PrivateLinkResourcesOperations` - * 2024-05-02-preview: :class:`PrivateLinkResourcesOperations` - * 2024-06-02-preview: :class:`PrivateLinkResourcesOperations` - * 2024-07-01: :class:`PrivateLinkResourcesOperations` - * 2024-07-02-preview: :class:`PrivateLinkResourcesOperations` - * 2024-08-01: :class:`PrivateLinkResourcesOperations` + * 2020-09-01: :class:`PrivateLinkResourcesOperations` + * 2020-11-01: :class:`PrivateLinkResourcesOperations` + * 2020-12-01: :class:`PrivateLinkResourcesOperations` + * 2021-02-01: :class:`PrivateLinkResourcesOperations` + * 2021-03-01: :class:`PrivateLinkResourcesOperations` + * 2021-05-01: :class:`PrivateLinkResourcesOperations` + * 2021-07-01: :class:`PrivateLinkResourcesOperations` + * 2021-08-01: :class:`PrivateLinkResourcesOperations` + * 2021-09-01: :class:`PrivateLinkResourcesOperations` + * 2021-10-01: :class:`PrivateLinkResourcesOperations` + * 2021-11-01-preview: :class:`PrivateLinkResourcesOperations` + * 2022-01-01: :class:`PrivateLinkResourcesOperations` + * 2022-01-02-preview: :class:`PrivateLinkResourcesOperations` + * 2022-02-01: :class:`PrivateLinkResourcesOperations` + * 2022-02-02-preview: :class:`PrivateLinkResourcesOperations` + * 2022-03-01: :class:`PrivateLinkResourcesOperations` + * 2022-03-02-preview: :class:`PrivateLinkResourcesOperations` + * 2022-04-01: :class:`PrivateLinkResourcesOperations` + * 2022-04-02-preview: :class:`PrivateLinkResourcesOperations` + * 2022-05-02-preview: :class:`PrivateLinkResourcesOperations` + * 2022-06-01: :class:`PrivateLinkResourcesOperations` + * 2022-06-02-preview: :class:`PrivateLinkResourcesOperations` + * 2022-07-01: :class:`PrivateLinkResourcesOperations` + * 2022-07-02-preview: :class:`PrivateLinkResourcesOperations` + * 2022-08-02-preview: :class:`PrivateLinkResourcesOperations` + * 2022-08-03-preview: :class:`PrivateLinkResourcesOperations` + * 2022-09-01: :class:`PrivateLinkResourcesOperations` + * 2022-09-02-preview: :class:`PrivateLinkResourcesOperations` + * 2022-10-02-preview: :class:`PrivateLinkResourcesOperations` + * 2022-11-01: :class:`PrivateLinkResourcesOperations` + * 2022-11-02-preview: :class:`PrivateLinkResourcesOperations` + * 2023-01-01: :class:`PrivateLinkResourcesOperations` + * 2023-01-02-preview: :class:`PrivateLinkResourcesOperations` + * 2023-02-01: :class:`PrivateLinkResourcesOperations` + * 2023-02-02-preview: :class:`PrivateLinkResourcesOperations` + * 2023-03-01: :class:`PrivateLinkResourcesOperations` + * 2023-03-02-preview: :class:`PrivateLinkResourcesOperations` + * 2023-04-01: :class:`PrivateLinkResourcesOperations` + * 2023-04-02-preview: :class:`PrivateLinkResourcesOperations` + * 2023-05-01: :class:`PrivateLinkResourcesOperations` + * 2023-05-02-preview: :class:`PrivateLinkResourcesOperations` + * 2023-06-01: :class:`PrivateLinkResourcesOperations` + * 2023-06-02-preview: :class:`PrivateLinkResourcesOperations` + * 2023-07-01: :class:`PrivateLinkResourcesOperations` + * 2023-07-02-preview: :class:`PrivateLinkResourcesOperations` + * 2023-08-01: :class:`PrivateLinkResourcesOperations` + * 2023-08-02-preview: :class:`PrivateLinkResourcesOperations` + * 2023-09-01: :class:`PrivateLinkResourcesOperations` + * 2023-09-02-preview: :class:`PrivateLinkResourcesOperations` + * 2023-10-01: :class:`PrivateLinkResourcesOperations` + * 2023-10-02-preview: :class:`PrivateLinkResourcesOperations` + * 2023-11-01: :class:`PrivateLinkResourcesOperations` + * 2023-11-02-preview: :class:`PrivateLinkResourcesOperations` + * 2024-01-01: :class:`PrivateLinkResourcesOperations` + * 2024-01-02-preview: :class:`PrivateLinkResourcesOperations` + * 2024-02-01: :class:`PrivateLinkResourcesOperations` + * 2024-02-02-preview: :class:`PrivateLinkResourcesOperations` + * 2024-03-02-preview: :class:`PrivateLinkResourcesOperations` + * 2024-04-02-preview: :class:`PrivateLinkResourcesOperations` + * 2024-05-01: :class:`PrivateLinkResourcesOperations` + * 2024-05-02-preview: :class:`PrivateLinkResourcesOperations` + * 2024-06-02-preview: :class:`PrivateLinkResourcesOperations` + * 2024-07-01: :class:`PrivateLinkResourcesOperations` + * 2024-07-02-preview: :class:`PrivateLinkResourcesOperations` + * 2024-08-01: :class:`PrivateLinkResourcesOperations` """ - api_version = self._get_api_version('private_link_resources') - if api_version == '2020-09-01': + api_version = self._get_api_version("private_link_resources") + if api_version == "2020-09-01": from ..v2020_09_01.aio.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2020-11-01': + elif api_version == "2020-11-01": from ..v2020_11_01.aio.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2020-12-01': + elif api_version == "2020-12-01": from ..v2020_12_01.aio.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2021-02-01': + elif api_version == "2021-02-01": from ..v2021_02_01.aio.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2021-03-01': + elif api_version == "2021-03-01": from ..v2021_03_01.aio.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2021-05-01': + elif api_version == "2021-05-01": from ..v2021_05_01.aio.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2021-07-01': + elif api_version == "2021-07-01": from ..v2021_07_01.aio.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2021-08-01': + elif api_version == "2021-08-01": from ..v2021_08_01.aio.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2021-09-01': + elif api_version == "2021-09-01": from ..v2021_09_01.aio.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2021-10-01': + elif api_version == "2021-10-01": from ..v2021_10_01.aio.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2021-11-01-preview': + elif api_version == "2021-11-01-preview": from ..v2021_11_01_preview.aio.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2022-01-01': + elif api_version == "2022-01-01": from ..v2022_01_01.aio.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2022-01-02-preview': + elif api_version == "2022-01-02-preview": from ..v2022_01_02_preview.aio.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2022-02-01': + elif api_version == "2022-02-01": from ..v2022_02_01.aio.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2022-02-02-preview': + elif api_version == "2022-02-02-preview": from ..v2022_02_02_preview.aio.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2022-03-01': + elif api_version == "2022-03-01": from ..v2022_03_01.aio.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2022-03-02-preview': + elif api_version == "2022-03-02-preview": from ..v2022_03_02_preview.aio.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2022-04-01': + elif api_version == "2022-04-01": from ..v2022_04_01.aio.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2022-04-02-preview': + elif api_version == "2022-04-02-preview": from ..v2022_04_02_preview.aio.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2022-05-02-preview': + elif api_version == "2022-05-02-preview": from ..v2022_05_02_preview.aio.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2022-06-01': + elif api_version == "2022-06-01": from ..v2022_06_01.aio.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2022-06-02-preview': + elif api_version == "2022-06-02-preview": from ..v2022_06_02_preview.aio.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2022-07-01': + elif api_version == "2022-07-01": from ..v2022_07_01.aio.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2022-07-02-preview': + elif api_version == "2022-07-02-preview": from ..v2022_07_02_preview.aio.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2022-08-02-preview': + elif api_version == "2022-08-02-preview": from ..v2022_08_02_preview.aio.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2022-08-03-preview': + elif api_version == "2022-08-03-preview": from ..v2022_08_03_preview.aio.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2022-09-01': + elif api_version == "2022-09-01": from ..v2022_09_01.aio.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2022-09-02-preview': + elif api_version == "2022-09-02-preview": from ..v2022_09_02_preview.aio.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2022-10-02-preview': + elif api_version == "2022-10-02-preview": from ..v2022_10_02_preview.aio.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2022-11-01': + elif api_version == "2022-11-01": from ..v2022_11_01.aio.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2022-11-02-preview': + elif api_version == "2022-11-02-preview": from ..v2022_11_02_preview.aio.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2023-01-01': + elif api_version == "2023-01-01": from ..v2023_01_01.aio.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2023-01-02-preview': + elif api_version == "2023-01-02-preview": from ..v2023_01_02_preview.aio.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2023-02-01': + elif api_version == "2023-02-01": from ..v2023_02_01.aio.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2023-02-02-preview': + elif api_version == "2023-02-02-preview": from ..v2023_02_02_preview.aio.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2023-03-01': + elif api_version == "2023-03-01": from ..v2023_03_01.aio.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2023-03-02-preview': + elif api_version == "2023-03-02-preview": from ..v2023_03_02_preview.aio.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2023-04-01': + elif api_version == "2023-04-01": from ..v2023_04_01.aio.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2023-04-02-preview': + elif api_version == "2023-04-02-preview": from ..v2023_04_02_preview.aio.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2023-05-01': + elif api_version == "2023-05-01": from ..v2023_05_01.aio.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2023-05-02-preview': + elif api_version == "2023-05-02-preview": from ..v2023_05_02_preview.aio.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2023-06-01': + elif api_version == "2023-06-01": from ..v2023_06_01.aio.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2023-06-02-preview': + elif api_version == "2023-06-02-preview": from ..v2023_06_02_preview.aio.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2023-07-01': + elif api_version == "2023-07-01": from ..v2023_07_01.aio.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2023-07-02-preview': + elif api_version == "2023-07-02-preview": from ..v2023_07_02_preview.aio.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2023-08-01': + elif api_version == "2023-08-01": from ..v2023_08_01.aio.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2023-08-02-preview': + elif api_version == "2023-08-02-preview": from ..v2023_08_02_preview.aio.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2023-09-01': + elif api_version == "2023-09-01": from ..v2023_09_01.aio.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2023-09-02-preview': + elif api_version == "2023-09-02-preview": from ..v2023_09_02_preview.aio.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2023-10-01': + elif api_version == "2023-10-01": from ..v2023_10_01.aio.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2023-10-02-preview': + elif api_version == "2023-10-02-preview": from ..v2023_10_02_preview.aio.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2023-11-01': + elif api_version == "2023-11-01": from ..v2023_11_01.aio.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2023-11-02-preview': + elif api_version == "2023-11-02-preview": from ..v2023_11_02_preview.aio.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2024-01-01': + elif api_version == "2024-01-01": from ..v2024_01_01.aio.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2024-01-02-preview': + elif api_version == "2024-01-02-preview": from ..v2024_01_02_preview.aio.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2024-02-01': + elif api_version == "2024-02-01": from ..v2024_02_01.aio.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2024-02-02-preview': + elif api_version == "2024-02-02-preview": from ..v2024_02_02_preview.aio.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2024-03-02-preview': + elif api_version == "2024-03-02-preview": from ..v2024_03_02_preview.aio.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2024-04-02-preview': + elif api_version == "2024-04-02-preview": from ..v2024_04_02_preview.aio.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2024-05-01': + elif api_version == "2024-05-01": from ..v2024_05_01.aio.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2024-05-02-preview': + elif api_version == "2024-05-02-preview": from ..v2024_05_02_preview.aio.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2024-06-02-preview': + elif api_version == "2024-06-02-preview": from ..v2024_06_02_preview.aio.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2024-07-01': + elif api_version == "2024-07-01": from ..v2024_07_01.aio.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2024-07-02-preview': + elif api_version == "2024-07-02-preview": from ..v2024_07_02_preview.aio.operations import PrivateLinkResourcesOperations as OperationClass - elif api_version == '2024-08-01': + elif api_version == "2024-08-01": from ..v2024_08_01.aio.operations import PrivateLinkResourcesOperations as OperationClass else: - raise ValueError("API version {} does not have operation group 'private_link_resources'".format(api_version)) + raise ValueError( + "API version {} does not have operation group 'private_link_resources'".format(api_version) + ) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) + return OperationClass( + self._client, + self._config, + Serializer(self._models_dict(api_version)), + Deserializer(self._models_dict(api_version)), + api_version, + ) @property def resolve_private_link_service_id(self): """Instance depends on the API version: - * 2020-09-01: :class:`ResolvePrivateLinkServiceIdOperations` - * 2020-11-01: :class:`ResolvePrivateLinkServiceIdOperations` - * 2020-12-01: :class:`ResolvePrivateLinkServiceIdOperations` - * 2021-02-01: :class:`ResolvePrivateLinkServiceIdOperations` - * 2021-03-01: :class:`ResolvePrivateLinkServiceIdOperations` - * 2021-05-01: :class:`ResolvePrivateLinkServiceIdOperations` - * 2021-07-01: :class:`ResolvePrivateLinkServiceIdOperations` - * 2021-08-01: :class:`ResolvePrivateLinkServiceIdOperations` - * 2021-09-01: :class:`ResolvePrivateLinkServiceIdOperations` - * 2021-10-01: :class:`ResolvePrivateLinkServiceIdOperations` - * 2021-11-01-preview: :class:`ResolvePrivateLinkServiceIdOperations` - * 2022-01-01: :class:`ResolvePrivateLinkServiceIdOperations` - * 2022-01-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` - * 2022-02-01: :class:`ResolvePrivateLinkServiceIdOperations` - * 2022-02-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` - * 2022-03-01: :class:`ResolvePrivateLinkServiceIdOperations` - * 2022-03-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` - * 2022-04-01: :class:`ResolvePrivateLinkServiceIdOperations` - * 2022-04-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` - * 2022-05-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` - * 2022-06-01: :class:`ResolvePrivateLinkServiceIdOperations` - * 2022-06-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` - * 2022-07-01: :class:`ResolvePrivateLinkServiceIdOperations` - * 2022-07-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` - * 2022-08-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` - * 2022-08-03-preview: :class:`ResolvePrivateLinkServiceIdOperations` - * 2022-09-01: :class:`ResolvePrivateLinkServiceIdOperations` - * 2022-09-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` - * 2022-10-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` - * 2022-11-01: :class:`ResolvePrivateLinkServiceIdOperations` - * 2022-11-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` - * 2023-01-01: :class:`ResolvePrivateLinkServiceIdOperations` - * 2023-01-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` - * 2023-02-01: :class:`ResolvePrivateLinkServiceIdOperations` - * 2023-02-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` - * 2023-03-01: :class:`ResolvePrivateLinkServiceIdOperations` - * 2023-03-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` - * 2023-04-01: :class:`ResolvePrivateLinkServiceIdOperations` - * 2023-04-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` - * 2023-05-01: :class:`ResolvePrivateLinkServiceIdOperations` - * 2023-05-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` - * 2023-06-01: :class:`ResolvePrivateLinkServiceIdOperations` - * 2023-06-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` - * 2023-07-01: :class:`ResolvePrivateLinkServiceIdOperations` - * 2023-07-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` - * 2023-08-01: :class:`ResolvePrivateLinkServiceIdOperations` - * 2023-08-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` - * 2023-09-01: :class:`ResolvePrivateLinkServiceIdOperations` - * 2023-09-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` - * 2023-10-01: :class:`ResolvePrivateLinkServiceIdOperations` - * 2023-10-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` - * 2023-11-01: :class:`ResolvePrivateLinkServiceIdOperations` - * 2023-11-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` - * 2024-01-01: :class:`ResolvePrivateLinkServiceIdOperations` - * 2024-01-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` - * 2024-02-01: :class:`ResolvePrivateLinkServiceIdOperations` - * 2024-02-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` - * 2024-03-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` - * 2024-04-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` - * 2024-05-01: :class:`ResolvePrivateLinkServiceIdOperations` - * 2024-05-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` - * 2024-06-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` - * 2024-07-01: :class:`ResolvePrivateLinkServiceIdOperations` - * 2024-07-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` - * 2024-08-01: :class:`ResolvePrivateLinkServiceIdOperations` + * 2020-09-01: :class:`ResolvePrivateLinkServiceIdOperations` + * 2020-11-01: :class:`ResolvePrivateLinkServiceIdOperations` + * 2020-12-01: :class:`ResolvePrivateLinkServiceIdOperations` + * 2021-02-01: :class:`ResolvePrivateLinkServiceIdOperations` + * 2021-03-01: :class:`ResolvePrivateLinkServiceIdOperations` + * 2021-05-01: :class:`ResolvePrivateLinkServiceIdOperations` + * 2021-07-01: :class:`ResolvePrivateLinkServiceIdOperations` + * 2021-08-01: :class:`ResolvePrivateLinkServiceIdOperations` + * 2021-09-01: :class:`ResolvePrivateLinkServiceIdOperations` + * 2021-10-01: :class:`ResolvePrivateLinkServiceIdOperations` + * 2021-11-01-preview: :class:`ResolvePrivateLinkServiceIdOperations` + * 2022-01-01: :class:`ResolvePrivateLinkServiceIdOperations` + * 2022-01-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` + * 2022-02-01: :class:`ResolvePrivateLinkServiceIdOperations` + * 2022-02-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` + * 2022-03-01: :class:`ResolvePrivateLinkServiceIdOperations` + * 2022-03-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` + * 2022-04-01: :class:`ResolvePrivateLinkServiceIdOperations` + * 2022-04-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` + * 2022-05-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` + * 2022-06-01: :class:`ResolvePrivateLinkServiceIdOperations` + * 2022-06-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` + * 2022-07-01: :class:`ResolvePrivateLinkServiceIdOperations` + * 2022-07-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` + * 2022-08-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` + * 2022-08-03-preview: :class:`ResolvePrivateLinkServiceIdOperations` + * 2022-09-01: :class:`ResolvePrivateLinkServiceIdOperations` + * 2022-09-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` + * 2022-10-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` + * 2022-11-01: :class:`ResolvePrivateLinkServiceIdOperations` + * 2022-11-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` + * 2023-01-01: :class:`ResolvePrivateLinkServiceIdOperations` + * 2023-01-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` + * 2023-02-01: :class:`ResolvePrivateLinkServiceIdOperations` + * 2023-02-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` + * 2023-03-01: :class:`ResolvePrivateLinkServiceIdOperations` + * 2023-03-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` + * 2023-04-01: :class:`ResolvePrivateLinkServiceIdOperations` + * 2023-04-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` + * 2023-05-01: :class:`ResolvePrivateLinkServiceIdOperations` + * 2023-05-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` + * 2023-06-01: :class:`ResolvePrivateLinkServiceIdOperations` + * 2023-06-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` + * 2023-07-01: :class:`ResolvePrivateLinkServiceIdOperations` + * 2023-07-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` + * 2023-08-01: :class:`ResolvePrivateLinkServiceIdOperations` + * 2023-08-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` + * 2023-09-01: :class:`ResolvePrivateLinkServiceIdOperations` + * 2023-09-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` + * 2023-10-01: :class:`ResolvePrivateLinkServiceIdOperations` + * 2023-10-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` + * 2023-11-01: :class:`ResolvePrivateLinkServiceIdOperations` + * 2023-11-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` + * 2024-01-01: :class:`ResolvePrivateLinkServiceIdOperations` + * 2024-01-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` + * 2024-02-01: :class:`ResolvePrivateLinkServiceIdOperations` + * 2024-02-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` + * 2024-03-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` + * 2024-04-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` + * 2024-05-01: :class:`ResolvePrivateLinkServiceIdOperations` + * 2024-05-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` + * 2024-06-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` + * 2024-07-01: :class:`ResolvePrivateLinkServiceIdOperations` + * 2024-07-02-preview: :class:`ResolvePrivateLinkServiceIdOperations` + * 2024-08-01: :class:`ResolvePrivateLinkServiceIdOperations` """ - api_version = self._get_api_version('resolve_private_link_service_id') - if api_version == '2020-09-01': + api_version = self._get_api_version("resolve_private_link_service_id") + if api_version == "2020-09-01": from ..v2020_09_01.aio.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2020-11-01': + elif api_version == "2020-11-01": from ..v2020_11_01.aio.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2020-12-01': + elif api_version == "2020-12-01": from ..v2020_12_01.aio.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2021-02-01': + elif api_version == "2021-02-01": from ..v2021_02_01.aio.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2021-03-01': + elif api_version == "2021-03-01": from ..v2021_03_01.aio.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2021-05-01': + elif api_version == "2021-05-01": from ..v2021_05_01.aio.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2021-07-01': + elif api_version == "2021-07-01": from ..v2021_07_01.aio.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2021-08-01': + elif api_version == "2021-08-01": from ..v2021_08_01.aio.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2021-09-01': + elif api_version == "2021-09-01": from ..v2021_09_01.aio.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2021-10-01': + elif api_version == "2021-10-01": from ..v2021_10_01.aio.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2021-11-01-preview': + elif api_version == "2021-11-01-preview": from ..v2021_11_01_preview.aio.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2022-01-01': + elif api_version == "2022-01-01": from ..v2022_01_01.aio.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2022-01-02-preview': + elif api_version == "2022-01-02-preview": from ..v2022_01_02_preview.aio.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2022-02-01': + elif api_version == "2022-02-01": from ..v2022_02_01.aio.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2022-02-02-preview': + elif api_version == "2022-02-02-preview": from ..v2022_02_02_preview.aio.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2022-03-01': + elif api_version == "2022-03-01": from ..v2022_03_01.aio.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2022-03-02-preview': + elif api_version == "2022-03-02-preview": from ..v2022_03_02_preview.aio.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2022-04-01': + elif api_version == "2022-04-01": from ..v2022_04_01.aio.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2022-04-02-preview': + elif api_version == "2022-04-02-preview": from ..v2022_04_02_preview.aio.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2022-05-02-preview': + elif api_version == "2022-05-02-preview": from ..v2022_05_02_preview.aio.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2022-06-01': + elif api_version == "2022-06-01": from ..v2022_06_01.aio.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2022-06-02-preview': + elif api_version == "2022-06-02-preview": from ..v2022_06_02_preview.aio.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2022-07-01': + elif api_version == "2022-07-01": from ..v2022_07_01.aio.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2022-07-02-preview': + elif api_version == "2022-07-02-preview": from ..v2022_07_02_preview.aio.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2022-08-02-preview': + elif api_version == "2022-08-02-preview": from ..v2022_08_02_preview.aio.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2022-08-03-preview': + elif api_version == "2022-08-03-preview": from ..v2022_08_03_preview.aio.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2022-09-01': + elif api_version == "2022-09-01": from ..v2022_09_01.aio.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2022-09-02-preview': + elif api_version == "2022-09-02-preview": from ..v2022_09_02_preview.aio.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2022-10-02-preview': + elif api_version == "2022-10-02-preview": from ..v2022_10_02_preview.aio.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2022-11-01': + elif api_version == "2022-11-01": from ..v2022_11_01.aio.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2022-11-02-preview': + elif api_version == "2022-11-02-preview": from ..v2022_11_02_preview.aio.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2023-01-01': + elif api_version == "2023-01-01": from ..v2023_01_01.aio.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2023-01-02-preview': + elif api_version == "2023-01-02-preview": from ..v2023_01_02_preview.aio.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2023-02-01': + elif api_version == "2023-02-01": from ..v2023_02_01.aio.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2023-02-02-preview': + elif api_version == "2023-02-02-preview": from ..v2023_02_02_preview.aio.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2023-03-01': + elif api_version == "2023-03-01": from ..v2023_03_01.aio.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2023-03-02-preview': + elif api_version == "2023-03-02-preview": from ..v2023_03_02_preview.aio.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2023-04-01': + elif api_version == "2023-04-01": from ..v2023_04_01.aio.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2023-04-02-preview': + elif api_version == "2023-04-02-preview": from ..v2023_04_02_preview.aio.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2023-05-01': + elif api_version == "2023-05-01": from ..v2023_05_01.aio.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2023-05-02-preview': + elif api_version == "2023-05-02-preview": from ..v2023_05_02_preview.aio.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2023-06-01': + elif api_version == "2023-06-01": from ..v2023_06_01.aio.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2023-06-02-preview': + elif api_version == "2023-06-02-preview": from ..v2023_06_02_preview.aio.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2023-07-01': + elif api_version == "2023-07-01": from ..v2023_07_01.aio.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2023-07-02-preview': + elif api_version == "2023-07-02-preview": from ..v2023_07_02_preview.aio.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2023-08-01': + elif api_version == "2023-08-01": from ..v2023_08_01.aio.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2023-08-02-preview': + elif api_version == "2023-08-02-preview": from ..v2023_08_02_preview.aio.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2023-09-01': + elif api_version == "2023-09-01": from ..v2023_09_01.aio.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2023-09-02-preview': + elif api_version == "2023-09-02-preview": from ..v2023_09_02_preview.aio.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2023-10-01': + elif api_version == "2023-10-01": from ..v2023_10_01.aio.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2023-10-02-preview': + elif api_version == "2023-10-02-preview": from ..v2023_10_02_preview.aio.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2023-11-01': + elif api_version == "2023-11-01": from ..v2023_11_01.aio.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2023-11-02-preview': + elif api_version == "2023-11-02-preview": from ..v2023_11_02_preview.aio.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2024-01-01': + elif api_version == "2024-01-01": from ..v2024_01_01.aio.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2024-01-02-preview': + elif api_version == "2024-01-02-preview": from ..v2024_01_02_preview.aio.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2024-02-01': + elif api_version == "2024-02-01": from ..v2024_02_01.aio.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2024-02-02-preview': + elif api_version == "2024-02-02-preview": from ..v2024_02_02_preview.aio.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2024-03-02-preview': + elif api_version == "2024-03-02-preview": from ..v2024_03_02_preview.aio.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2024-04-02-preview': + elif api_version == "2024-04-02-preview": from ..v2024_04_02_preview.aio.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2024-05-01': + elif api_version == "2024-05-01": from ..v2024_05_01.aio.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2024-05-02-preview': + elif api_version == "2024-05-02-preview": from ..v2024_05_02_preview.aio.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2024-06-02-preview': + elif api_version == "2024-06-02-preview": from ..v2024_06_02_preview.aio.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2024-07-01': + elif api_version == "2024-07-01": from ..v2024_07_01.aio.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2024-07-02-preview': + elif api_version == "2024-07-02-preview": from ..v2024_07_02_preview.aio.operations import ResolvePrivateLinkServiceIdOperations as OperationClass - elif api_version == '2024-08-01': + elif api_version == "2024-08-01": from ..v2024_08_01.aio.operations import ResolvePrivateLinkServiceIdOperations as OperationClass else: - raise ValueError("API version {} does not have operation group 'resolve_private_link_service_id'".format(api_version)) + raise ValueError( + "API version {} does not have operation group 'resolve_private_link_service_id'".format(api_version) + ) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) + return OperationClass( + self._client, + self._config, + Serializer(self._models_dict(api_version)), + Deserializer(self._models_dict(api_version)), + api_version, + ) @property def snapshots(self): """Instance depends on the API version: - * 2021-08-01: :class:`SnapshotsOperations` - * 2021-09-01: :class:`SnapshotsOperations` - * 2021-10-01: :class:`SnapshotsOperations` - * 2021-11-01-preview: :class:`SnapshotsOperations` - * 2022-01-01: :class:`SnapshotsOperations` - * 2022-01-02-preview: :class:`SnapshotsOperations` - * 2022-02-01: :class:`SnapshotsOperations` - * 2022-02-02-preview: :class:`SnapshotsOperations` - * 2022-03-01: :class:`SnapshotsOperations` - * 2022-03-02-preview: :class:`SnapshotsOperations` - * 2022-04-01: :class:`SnapshotsOperations` - * 2022-04-02-preview: :class:`SnapshotsOperations` - * 2022-05-02-preview: :class:`SnapshotsOperations` - * 2022-06-01: :class:`SnapshotsOperations` - * 2022-06-02-preview: :class:`SnapshotsOperations` - * 2022-07-01: :class:`SnapshotsOperations` - * 2022-07-02-preview: :class:`SnapshotsOperations` - * 2022-08-02-preview: :class:`SnapshotsOperations` - * 2022-08-03-preview: :class:`SnapshotsOperations` - * 2022-09-01: :class:`SnapshotsOperations` - * 2022-09-02-preview: :class:`SnapshotsOperations` - * 2022-10-02-preview: :class:`SnapshotsOperations` - * 2022-11-01: :class:`SnapshotsOperations` - * 2022-11-02-preview: :class:`SnapshotsOperations` - * 2023-01-01: :class:`SnapshotsOperations` - * 2023-01-02-preview: :class:`SnapshotsOperations` - * 2023-02-01: :class:`SnapshotsOperations` - * 2023-02-02-preview: :class:`SnapshotsOperations` - * 2023-03-01: :class:`SnapshotsOperations` - * 2023-03-02-preview: :class:`SnapshotsOperations` - * 2023-04-01: :class:`SnapshotsOperations` - * 2023-04-02-preview: :class:`SnapshotsOperations` - * 2023-05-01: :class:`SnapshotsOperations` - * 2023-05-02-preview: :class:`SnapshotsOperations` - * 2023-06-01: :class:`SnapshotsOperations` - * 2023-06-02-preview: :class:`SnapshotsOperations` - * 2023-07-01: :class:`SnapshotsOperations` - * 2023-07-02-preview: :class:`SnapshotsOperations` - * 2023-08-01: :class:`SnapshotsOperations` - * 2023-08-02-preview: :class:`SnapshotsOperations` - * 2023-09-01: :class:`SnapshotsOperations` - * 2023-09-02-preview: :class:`SnapshotsOperations` - * 2023-10-01: :class:`SnapshotsOperations` - * 2023-10-02-preview: :class:`SnapshotsOperations` - * 2023-11-01: :class:`SnapshotsOperations` - * 2023-11-02-preview: :class:`SnapshotsOperations` - * 2024-01-01: :class:`SnapshotsOperations` - * 2024-01-02-preview: :class:`SnapshotsOperations` - * 2024-02-01: :class:`SnapshotsOperations` - * 2024-02-02-preview: :class:`SnapshotsOperations` - * 2024-03-02-preview: :class:`SnapshotsOperations` - * 2024-04-02-preview: :class:`SnapshotsOperations` - * 2024-05-01: :class:`SnapshotsOperations` - * 2024-05-02-preview: :class:`SnapshotsOperations` - * 2024-06-02-preview: :class:`SnapshotsOperations` - * 2024-07-01: :class:`SnapshotsOperations` - * 2024-07-02-preview: :class:`SnapshotsOperations` - * 2024-08-01: :class:`SnapshotsOperations` + * 2021-08-01: :class:`SnapshotsOperations` + * 2021-09-01: :class:`SnapshotsOperations` + * 2021-10-01: :class:`SnapshotsOperations` + * 2021-11-01-preview: :class:`SnapshotsOperations` + * 2022-01-01: :class:`SnapshotsOperations` + * 2022-01-02-preview: :class:`SnapshotsOperations` + * 2022-02-01: :class:`SnapshotsOperations` + * 2022-02-02-preview: :class:`SnapshotsOperations` + * 2022-03-01: :class:`SnapshotsOperations` + * 2022-03-02-preview: :class:`SnapshotsOperations` + * 2022-04-01: :class:`SnapshotsOperations` + * 2022-04-02-preview: :class:`SnapshotsOperations` + * 2022-05-02-preview: :class:`SnapshotsOperations` + * 2022-06-01: :class:`SnapshotsOperations` + * 2022-06-02-preview: :class:`SnapshotsOperations` + * 2022-07-01: :class:`SnapshotsOperations` + * 2022-07-02-preview: :class:`SnapshotsOperations` + * 2022-08-02-preview: :class:`SnapshotsOperations` + * 2022-08-03-preview: :class:`SnapshotsOperations` + * 2022-09-01: :class:`SnapshotsOperations` + * 2022-09-02-preview: :class:`SnapshotsOperations` + * 2022-10-02-preview: :class:`SnapshotsOperations` + * 2022-11-01: :class:`SnapshotsOperations` + * 2022-11-02-preview: :class:`SnapshotsOperations` + * 2023-01-01: :class:`SnapshotsOperations` + * 2023-01-02-preview: :class:`SnapshotsOperations` + * 2023-02-01: :class:`SnapshotsOperations` + * 2023-02-02-preview: :class:`SnapshotsOperations` + * 2023-03-01: :class:`SnapshotsOperations` + * 2023-03-02-preview: :class:`SnapshotsOperations` + * 2023-04-01: :class:`SnapshotsOperations` + * 2023-04-02-preview: :class:`SnapshotsOperations` + * 2023-05-01: :class:`SnapshotsOperations` + * 2023-05-02-preview: :class:`SnapshotsOperations` + * 2023-06-01: :class:`SnapshotsOperations` + * 2023-06-02-preview: :class:`SnapshotsOperations` + * 2023-07-01: :class:`SnapshotsOperations` + * 2023-07-02-preview: :class:`SnapshotsOperations` + * 2023-08-01: :class:`SnapshotsOperations` + * 2023-08-02-preview: :class:`SnapshotsOperations` + * 2023-09-01: :class:`SnapshotsOperations` + * 2023-09-02-preview: :class:`SnapshotsOperations` + * 2023-10-01: :class:`SnapshotsOperations` + * 2023-10-02-preview: :class:`SnapshotsOperations` + * 2023-11-01: :class:`SnapshotsOperations` + * 2023-11-02-preview: :class:`SnapshotsOperations` + * 2024-01-01: :class:`SnapshotsOperations` + * 2024-01-02-preview: :class:`SnapshotsOperations` + * 2024-02-01: :class:`SnapshotsOperations` + * 2024-02-02-preview: :class:`SnapshotsOperations` + * 2024-03-02-preview: :class:`SnapshotsOperations` + * 2024-04-02-preview: :class:`SnapshotsOperations` + * 2024-05-01: :class:`SnapshotsOperations` + * 2024-05-02-preview: :class:`SnapshotsOperations` + * 2024-06-02-preview: :class:`SnapshotsOperations` + * 2024-07-01: :class:`SnapshotsOperations` + * 2024-07-02-preview: :class:`SnapshotsOperations` + * 2024-08-01: :class:`SnapshotsOperations` """ - api_version = self._get_api_version('snapshots') - if api_version == '2021-08-01': + api_version = self._get_api_version("snapshots") + if api_version == "2021-08-01": from ..v2021_08_01.aio.operations import SnapshotsOperations as OperationClass - elif api_version == '2021-09-01': + elif api_version == "2021-09-01": from ..v2021_09_01.aio.operations import SnapshotsOperations as OperationClass - elif api_version == '2021-10-01': + elif api_version == "2021-10-01": from ..v2021_10_01.aio.operations import SnapshotsOperations as OperationClass - elif api_version == '2021-11-01-preview': + elif api_version == "2021-11-01-preview": from ..v2021_11_01_preview.aio.operations import SnapshotsOperations as OperationClass - elif api_version == '2022-01-01': + elif api_version == "2022-01-01": from ..v2022_01_01.aio.operations import SnapshotsOperations as OperationClass - elif api_version == '2022-01-02-preview': + elif api_version == "2022-01-02-preview": from ..v2022_01_02_preview.aio.operations import SnapshotsOperations as OperationClass - elif api_version == '2022-02-01': + elif api_version == "2022-02-01": from ..v2022_02_01.aio.operations import SnapshotsOperations as OperationClass - elif api_version == '2022-02-02-preview': + elif api_version == "2022-02-02-preview": from ..v2022_02_02_preview.aio.operations import SnapshotsOperations as OperationClass - elif api_version == '2022-03-01': + elif api_version == "2022-03-01": from ..v2022_03_01.aio.operations import SnapshotsOperations as OperationClass - elif api_version == '2022-03-02-preview': + elif api_version == "2022-03-02-preview": from ..v2022_03_02_preview.aio.operations import SnapshotsOperations as OperationClass - elif api_version == '2022-04-01': + elif api_version == "2022-04-01": from ..v2022_04_01.aio.operations import SnapshotsOperations as OperationClass - elif api_version == '2022-04-02-preview': + elif api_version == "2022-04-02-preview": from ..v2022_04_02_preview.aio.operations import SnapshotsOperations as OperationClass - elif api_version == '2022-05-02-preview': + elif api_version == "2022-05-02-preview": from ..v2022_05_02_preview.aio.operations import SnapshotsOperations as OperationClass - elif api_version == '2022-06-01': + elif api_version == "2022-06-01": from ..v2022_06_01.aio.operations import SnapshotsOperations as OperationClass - elif api_version == '2022-06-02-preview': + elif api_version == "2022-06-02-preview": from ..v2022_06_02_preview.aio.operations import SnapshotsOperations as OperationClass - elif api_version == '2022-07-01': + elif api_version == "2022-07-01": from ..v2022_07_01.aio.operations import SnapshotsOperations as OperationClass - elif api_version == '2022-07-02-preview': + elif api_version == "2022-07-02-preview": from ..v2022_07_02_preview.aio.operations import SnapshotsOperations as OperationClass - elif api_version == '2022-08-02-preview': + elif api_version == "2022-08-02-preview": from ..v2022_08_02_preview.aio.operations import SnapshotsOperations as OperationClass - elif api_version == '2022-08-03-preview': + elif api_version == "2022-08-03-preview": from ..v2022_08_03_preview.aio.operations import SnapshotsOperations as OperationClass - elif api_version == '2022-09-01': + elif api_version == "2022-09-01": from ..v2022_09_01.aio.operations import SnapshotsOperations as OperationClass - elif api_version == '2022-09-02-preview': + elif api_version == "2022-09-02-preview": from ..v2022_09_02_preview.aio.operations import SnapshotsOperations as OperationClass - elif api_version == '2022-10-02-preview': + elif api_version == "2022-10-02-preview": from ..v2022_10_02_preview.aio.operations import SnapshotsOperations as OperationClass - elif api_version == '2022-11-01': + elif api_version == "2022-11-01": from ..v2022_11_01.aio.operations import SnapshotsOperations as OperationClass - elif api_version == '2022-11-02-preview': + elif api_version == "2022-11-02-preview": from ..v2022_11_02_preview.aio.operations import SnapshotsOperations as OperationClass - elif api_version == '2023-01-01': + elif api_version == "2023-01-01": from ..v2023_01_01.aio.operations import SnapshotsOperations as OperationClass - elif api_version == '2023-01-02-preview': + elif api_version == "2023-01-02-preview": from ..v2023_01_02_preview.aio.operations import SnapshotsOperations as OperationClass - elif api_version == '2023-02-01': + elif api_version == "2023-02-01": from ..v2023_02_01.aio.operations import SnapshotsOperations as OperationClass - elif api_version == '2023-02-02-preview': + elif api_version == "2023-02-02-preview": from ..v2023_02_02_preview.aio.operations import SnapshotsOperations as OperationClass - elif api_version == '2023-03-01': + elif api_version == "2023-03-01": from ..v2023_03_01.aio.operations import SnapshotsOperations as OperationClass - elif api_version == '2023-03-02-preview': + elif api_version == "2023-03-02-preview": from ..v2023_03_02_preview.aio.operations import SnapshotsOperations as OperationClass - elif api_version == '2023-04-01': + elif api_version == "2023-04-01": from ..v2023_04_01.aio.operations import SnapshotsOperations as OperationClass - elif api_version == '2023-04-02-preview': + elif api_version == "2023-04-02-preview": from ..v2023_04_02_preview.aio.operations import SnapshotsOperations as OperationClass - elif api_version == '2023-05-01': + elif api_version == "2023-05-01": from ..v2023_05_01.aio.operations import SnapshotsOperations as OperationClass - elif api_version == '2023-05-02-preview': + elif api_version == "2023-05-02-preview": from ..v2023_05_02_preview.aio.operations import SnapshotsOperations as OperationClass - elif api_version == '2023-06-01': + elif api_version == "2023-06-01": from ..v2023_06_01.aio.operations import SnapshotsOperations as OperationClass - elif api_version == '2023-06-02-preview': + elif api_version == "2023-06-02-preview": from ..v2023_06_02_preview.aio.operations import SnapshotsOperations as OperationClass - elif api_version == '2023-07-01': + elif api_version == "2023-07-01": from ..v2023_07_01.aio.operations import SnapshotsOperations as OperationClass - elif api_version == '2023-07-02-preview': + elif api_version == "2023-07-02-preview": from ..v2023_07_02_preview.aio.operations import SnapshotsOperations as OperationClass - elif api_version == '2023-08-01': + elif api_version == "2023-08-01": from ..v2023_08_01.aio.operations import SnapshotsOperations as OperationClass - elif api_version == '2023-08-02-preview': + elif api_version == "2023-08-02-preview": from ..v2023_08_02_preview.aio.operations import SnapshotsOperations as OperationClass - elif api_version == '2023-09-01': + elif api_version == "2023-09-01": from ..v2023_09_01.aio.operations import SnapshotsOperations as OperationClass - elif api_version == '2023-09-02-preview': + elif api_version == "2023-09-02-preview": from ..v2023_09_02_preview.aio.operations import SnapshotsOperations as OperationClass - elif api_version == '2023-10-01': + elif api_version == "2023-10-01": from ..v2023_10_01.aio.operations import SnapshotsOperations as OperationClass - elif api_version == '2023-10-02-preview': + elif api_version == "2023-10-02-preview": from ..v2023_10_02_preview.aio.operations import SnapshotsOperations as OperationClass - elif api_version == '2023-11-01': + elif api_version == "2023-11-01": from ..v2023_11_01.aio.operations import SnapshotsOperations as OperationClass - elif api_version == '2023-11-02-preview': + elif api_version == "2023-11-02-preview": from ..v2023_11_02_preview.aio.operations import SnapshotsOperations as OperationClass - elif api_version == '2024-01-01': + elif api_version == "2024-01-01": from ..v2024_01_01.aio.operations import SnapshotsOperations as OperationClass - elif api_version == '2024-01-02-preview': + elif api_version == "2024-01-02-preview": from ..v2024_01_02_preview.aio.operations import SnapshotsOperations as OperationClass - elif api_version == '2024-02-01': + elif api_version == "2024-02-01": from ..v2024_02_01.aio.operations import SnapshotsOperations as OperationClass - elif api_version == '2024-02-02-preview': + elif api_version == "2024-02-02-preview": from ..v2024_02_02_preview.aio.operations import SnapshotsOperations as OperationClass - elif api_version == '2024-03-02-preview': + elif api_version == "2024-03-02-preview": from ..v2024_03_02_preview.aio.operations import SnapshotsOperations as OperationClass - elif api_version == '2024-04-02-preview': + elif api_version == "2024-04-02-preview": from ..v2024_04_02_preview.aio.operations import SnapshotsOperations as OperationClass - elif api_version == '2024-05-01': + elif api_version == "2024-05-01": from ..v2024_05_01.aio.operations import SnapshotsOperations as OperationClass - elif api_version == '2024-05-02-preview': + elif api_version == "2024-05-02-preview": from ..v2024_05_02_preview.aio.operations import SnapshotsOperations as OperationClass - elif api_version == '2024-06-02-preview': + elif api_version == "2024-06-02-preview": from ..v2024_06_02_preview.aio.operations import SnapshotsOperations as OperationClass - elif api_version == '2024-07-01': + elif api_version == "2024-07-01": from ..v2024_07_01.aio.operations import SnapshotsOperations as OperationClass - elif api_version == '2024-07-02-preview': + elif api_version == "2024-07-02-preview": from ..v2024_07_02_preview.aio.operations import SnapshotsOperations as OperationClass - elif api_version == '2024-08-01': + elif api_version == "2024-08-01": from ..v2024_08_01.aio.operations import SnapshotsOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'snapshots'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) + return OperationClass( + self._client, + self._config, + Serializer(self._models_dict(api_version)), + Deserializer(self._models_dict(api_version)), + api_version, + ) @property def trusted_access_role_bindings(self): """Instance depends on the API version: - * 2022-04-02-preview: :class:`TrustedAccessRoleBindingsOperations` - * 2022-05-02-preview: :class:`TrustedAccessRoleBindingsOperations` - * 2022-06-02-preview: :class:`TrustedAccessRoleBindingsOperations` - * 2022-07-02-preview: :class:`TrustedAccessRoleBindingsOperations` - * 2022-08-02-preview: :class:`TrustedAccessRoleBindingsOperations` - * 2022-08-03-preview: :class:`TrustedAccessRoleBindingsOperations` - * 2022-09-02-preview: :class:`TrustedAccessRoleBindingsOperations` - * 2022-10-02-preview: :class:`TrustedAccessRoleBindingsOperations` - * 2022-11-02-preview: :class:`TrustedAccessRoleBindingsOperations` - * 2023-01-02-preview: :class:`TrustedAccessRoleBindingsOperations` - * 2023-02-02-preview: :class:`TrustedAccessRoleBindingsOperations` - * 2023-03-02-preview: :class:`TrustedAccessRoleBindingsOperations` - * 2023-04-02-preview: :class:`TrustedAccessRoleBindingsOperations` - * 2023-05-02-preview: :class:`TrustedAccessRoleBindingsOperations` - * 2023-06-02-preview: :class:`TrustedAccessRoleBindingsOperations` - * 2023-07-02-preview: :class:`TrustedAccessRoleBindingsOperations` - * 2023-08-02-preview: :class:`TrustedAccessRoleBindingsOperations` - * 2023-09-01: :class:`TrustedAccessRoleBindingsOperations` - * 2023-09-02-preview: :class:`TrustedAccessRoleBindingsOperations` - * 2023-10-01: :class:`TrustedAccessRoleBindingsOperations` - * 2023-10-02-preview: :class:`TrustedAccessRoleBindingsOperations` - * 2023-11-01: :class:`TrustedAccessRoleBindingsOperations` - * 2023-11-02-preview: :class:`TrustedAccessRoleBindingsOperations` - * 2024-01-01: :class:`TrustedAccessRoleBindingsOperations` - * 2024-01-02-preview: :class:`TrustedAccessRoleBindingsOperations` - * 2024-02-01: :class:`TrustedAccessRoleBindingsOperations` - * 2024-02-02-preview: :class:`TrustedAccessRoleBindingsOperations` - * 2024-03-02-preview: :class:`TrustedAccessRoleBindingsOperations` - * 2024-04-02-preview: :class:`TrustedAccessRoleBindingsOperations` - * 2024-05-01: :class:`TrustedAccessRoleBindingsOperations` - * 2024-05-02-preview: :class:`TrustedAccessRoleBindingsOperations` - * 2024-06-02-preview: :class:`TrustedAccessRoleBindingsOperations` - * 2024-07-01: :class:`TrustedAccessRoleBindingsOperations` - * 2024-07-02-preview: :class:`TrustedAccessRoleBindingsOperations` - * 2024-08-01: :class:`TrustedAccessRoleBindingsOperations` + * 2022-04-02-preview: :class:`TrustedAccessRoleBindingsOperations` + * 2022-05-02-preview: :class:`TrustedAccessRoleBindingsOperations` + * 2022-06-02-preview: :class:`TrustedAccessRoleBindingsOperations` + * 2022-07-02-preview: :class:`TrustedAccessRoleBindingsOperations` + * 2022-08-02-preview: :class:`TrustedAccessRoleBindingsOperations` + * 2022-08-03-preview: :class:`TrustedAccessRoleBindingsOperations` + * 2022-09-02-preview: :class:`TrustedAccessRoleBindingsOperations` + * 2022-10-02-preview: :class:`TrustedAccessRoleBindingsOperations` + * 2022-11-02-preview: :class:`TrustedAccessRoleBindingsOperations` + * 2023-01-02-preview: :class:`TrustedAccessRoleBindingsOperations` + * 2023-02-02-preview: :class:`TrustedAccessRoleBindingsOperations` + * 2023-03-02-preview: :class:`TrustedAccessRoleBindingsOperations` + * 2023-04-02-preview: :class:`TrustedAccessRoleBindingsOperations` + * 2023-05-02-preview: :class:`TrustedAccessRoleBindingsOperations` + * 2023-06-02-preview: :class:`TrustedAccessRoleBindingsOperations` + * 2023-07-02-preview: :class:`TrustedAccessRoleBindingsOperations` + * 2023-08-02-preview: :class:`TrustedAccessRoleBindingsOperations` + * 2023-09-01: :class:`TrustedAccessRoleBindingsOperations` + * 2023-09-02-preview: :class:`TrustedAccessRoleBindingsOperations` + * 2023-10-01: :class:`TrustedAccessRoleBindingsOperations` + * 2023-10-02-preview: :class:`TrustedAccessRoleBindingsOperations` + * 2023-11-01: :class:`TrustedAccessRoleBindingsOperations` + * 2023-11-02-preview: :class:`TrustedAccessRoleBindingsOperations` + * 2024-01-01: :class:`TrustedAccessRoleBindingsOperations` + * 2024-01-02-preview: :class:`TrustedAccessRoleBindingsOperations` + * 2024-02-01: :class:`TrustedAccessRoleBindingsOperations` + * 2024-02-02-preview: :class:`TrustedAccessRoleBindingsOperations` + * 2024-03-02-preview: :class:`TrustedAccessRoleBindingsOperations` + * 2024-04-02-preview: :class:`TrustedAccessRoleBindingsOperations` + * 2024-05-01: :class:`TrustedAccessRoleBindingsOperations` + * 2024-05-02-preview: :class:`TrustedAccessRoleBindingsOperations` + * 2024-06-02-preview: :class:`TrustedAccessRoleBindingsOperations` + * 2024-07-01: :class:`TrustedAccessRoleBindingsOperations` + * 2024-07-02-preview: :class:`TrustedAccessRoleBindingsOperations` + * 2024-08-01: :class:`TrustedAccessRoleBindingsOperations` """ - api_version = self._get_api_version('trusted_access_role_bindings') - if api_version == '2022-04-02-preview': + api_version = self._get_api_version("trusted_access_role_bindings") + if api_version == "2022-04-02-preview": from ..v2022_04_02_preview.aio.operations import TrustedAccessRoleBindingsOperations as OperationClass - elif api_version == '2022-05-02-preview': + elif api_version == "2022-05-02-preview": from ..v2022_05_02_preview.aio.operations import TrustedAccessRoleBindingsOperations as OperationClass - elif api_version == '2022-06-02-preview': + elif api_version == "2022-06-02-preview": from ..v2022_06_02_preview.aio.operations import TrustedAccessRoleBindingsOperations as OperationClass - elif api_version == '2022-07-02-preview': + elif api_version == "2022-07-02-preview": from ..v2022_07_02_preview.aio.operations import TrustedAccessRoleBindingsOperations as OperationClass - elif api_version == '2022-08-02-preview': + elif api_version == "2022-08-02-preview": from ..v2022_08_02_preview.aio.operations import TrustedAccessRoleBindingsOperations as OperationClass - elif api_version == '2022-08-03-preview': + elif api_version == "2022-08-03-preview": from ..v2022_08_03_preview.aio.operations import TrustedAccessRoleBindingsOperations as OperationClass - elif api_version == '2022-09-02-preview': + elif api_version == "2022-09-02-preview": from ..v2022_09_02_preview.aio.operations import TrustedAccessRoleBindingsOperations as OperationClass - elif api_version == '2022-10-02-preview': + elif api_version == "2022-10-02-preview": from ..v2022_10_02_preview.aio.operations import TrustedAccessRoleBindingsOperations as OperationClass - elif api_version == '2022-11-02-preview': + elif api_version == "2022-11-02-preview": from ..v2022_11_02_preview.aio.operations import TrustedAccessRoleBindingsOperations as OperationClass - elif api_version == '2023-01-02-preview': + elif api_version == "2023-01-02-preview": from ..v2023_01_02_preview.aio.operations import TrustedAccessRoleBindingsOperations as OperationClass - elif api_version == '2023-02-02-preview': + elif api_version == "2023-02-02-preview": from ..v2023_02_02_preview.aio.operations import TrustedAccessRoleBindingsOperations as OperationClass - elif api_version == '2023-03-02-preview': + elif api_version == "2023-03-02-preview": from ..v2023_03_02_preview.aio.operations import TrustedAccessRoleBindingsOperations as OperationClass - elif api_version == '2023-04-02-preview': + elif api_version == "2023-04-02-preview": from ..v2023_04_02_preview.aio.operations import TrustedAccessRoleBindingsOperations as OperationClass - elif api_version == '2023-05-02-preview': + elif api_version == "2023-05-02-preview": from ..v2023_05_02_preview.aio.operations import TrustedAccessRoleBindingsOperations as OperationClass - elif api_version == '2023-06-02-preview': + elif api_version == "2023-06-02-preview": from ..v2023_06_02_preview.aio.operations import TrustedAccessRoleBindingsOperations as OperationClass - elif api_version == '2023-07-02-preview': + elif api_version == "2023-07-02-preview": from ..v2023_07_02_preview.aio.operations import TrustedAccessRoleBindingsOperations as OperationClass - elif api_version == '2023-08-02-preview': + elif api_version == "2023-08-02-preview": from ..v2023_08_02_preview.aio.operations import TrustedAccessRoleBindingsOperations as OperationClass - elif api_version == '2023-09-01': + elif api_version == "2023-09-01": from ..v2023_09_01.aio.operations import TrustedAccessRoleBindingsOperations as OperationClass - elif api_version == '2023-09-02-preview': + elif api_version == "2023-09-02-preview": from ..v2023_09_02_preview.aio.operations import TrustedAccessRoleBindingsOperations as OperationClass - elif api_version == '2023-10-01': + elif api_version == "2023-10-01": from ..v2023_10_01.aio.operations import TrustedAccessRoleBindingsOperations as OperationClass - elif api_version == '2023-10-02-preview': + elif api_version == "2023-10-02-preview": from ..v2023_10_02_preview.aio.operations import TrustedAccessRoleBindingsOperations as OperationClass - elif api_version == '2023-11-01': + elif api_version == "2023-11-01": from ..v2023_11_01.aio.operations import TrustedAccessRoleBindingsOperations as OperationClass - elif api_version == '2023-11-02-preview': + elif api_version == "2023-11-02-preview": from ..v2023_11_02_preview.aio.operations import TrustedAccessRoleBindingsOperations as OperationClass - elif api_version == '2024-01-01': + elif api_version == "2024-01-01": from ..v2024_01_01.aio.operations import TrustedAccessRoleBindingsOperations as OperationClass - elif api_version == '2024-01-02-preview': + elif api_version == "2024-01-02-preview": from ..v2024_01_02_preview.aio.operations import TrustedAccessRoleBindingsOperations as OperationClass - elif api_version == '2024-02-01': + elif api_version == "2024-02-01": from ..v2024_02_01.aio.operations import TrustedAccessRoleBindingsOperations as OperationClass - elif api_version == '2024-02-02-preview': + elif api_version == "2024-02-02-preview": from ..v2024_02_02_preview.aio.operations import TrustedAccessRoleBindingsOperations as OperationClass - elif api_version == '2024-03-02-preview': + elif api_version == "2024-03-02-preview": from ..v2024_03_02_preview.aio.operations import TrustedAccessRoleBindingsOperations as OperationClass - elif api_version == '2024-04-02-preview': + elif api_version == "2024-04-02-preview": from ..v2024_04_02_preview.aio.operations import TrustedAccessRoleBindingsOperations as OperationClass - elif api_version == '2024-05-01': + elif api_version == "2024-05-01": from ..v2024_05_01.aio.operations import TrustedAccessRoleBindingsOperations as OperationClass - elif api_version == '2024-05-02-preview': + elif api_version == "2024-05-02-preview": from ..v2024_05_02_preview.aio.operations import TrustedAccessRoleBindingsOperations as OperationClass - elif api_version == '2024-06-02-preview': + elif api_version == "2024-06-02-preview": from ..v2024_06_02_preview.aio.operations import TrustedAccessRoleBindingsOperations as OperationClass - elif api_version == '2024-07-01': + elif api_version == "2024-07-01": from ..v2024_07_01.aio.operations import TrustedAccessRoleBindingsOperations as OperationClass - elif api_version == '2024-07-02-preview': + elif api_version == "2024-07-02-preview": from ..v2024_07_02_preview.aio.operations import TrustedAccessRoleBindingsOperations as OperationClass - elif api_version == '2024-08-01': + elif api_version == "2024-08-01": from ..v2024_08_01.aio.operations import TrustedAccessRoleBindingsOperations as OperationClass else: - raise ValueError("API version {} does not have operation group 'trusted_access_role_bindings'".format(api_version)) + raise ValueError( + "API version {} does not have operation group 'trusted_access_role_bindings'".format(api_version) + ) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) + return OperationClass( + self._client, + self._config, + Serializer(self._models_dict(api_version)), + Deserializer(self._models_dict(api_version)), + api_version, + ) @property def trusted_access_roles(self): """Instance depends on the API version: - * 2022-04-02-preview: :class:`TrustedAccessRolesOperations` - * 2022-05-02-preview: :class:`TrustedAccessRolesOperations` - * 2022-06-02-preview: :class:`TrustedAccessRolesOperations` - * 2022-07-02-preview: :class:`TrustedAccessRolesOperations` - * 2022-08-02-preview: :class:`TrustedAccessRolesOperations` - * 2022-08-03-preview: :class:`TrustedAccessRolesOperations` - * 2022-09-02-preview: :class:`TrustedAccessRolesOperations` - * 2022-10-02-preview: :class:`TrustedAccessRolesOperations` - * 2022-11-02-preview: :class:`TrustedAccessRolesOperations` - * 2023-01-02-preview: :class:`TrustedAccessRolesOperations` - * 2023-02-02-preview: :class:`TrustedAccessRolesOperations` - * 2023-03-02-preview: :class:`TrustedAccessRolesOperations` - * 2023-04-02-preview: :class:`TrustedAccessRolesOperations` - * 2023-05-02-preview: :class:`TrustedAccessRolesOperations` - * 2023-06-02-preview: :class:`TrustedAccessRolesOperations` - * 2023-07-02-preview: :class:`TrustedAccessRolesOperations` - * 2023-08-02-preview: :class:`TrustedAccessRolesOperations` - * 2023-09-01: :class:`TrustedAccessRolesOperations` - * 2023-09-02-preview: :class:`TrustedAccessRolesOperations` - * 2023-10-01: :class:`TrustedAccessRolesOperations` - * 2023-10-02-preview: :class:`TrustedAccessRolesOperations` - * 2023-11-01: :class:`TrustedAccessRolesOperations` - * 2023-11-02-preview: :class:`TrustedAccessRolesOperations` - * 2024-01-01: :class:`TrustedAccessRolesOperations` - * 2024-01-02-preview: :class:`TrustedAccessRolesOperations` - * 2024-02-01: :class:`TrustedAccessRolesOperations` - * 2024-02-02-preview: :class:`TrustedAccessRolesOperations` - * 2024-03-02-preview: :class:`TrustedAccessRolesOperations` - * 2024-04-02-preview: :class:`TrustedAccessRolesOperations` - * 2024-05-01: :class:`TrustedAccessRolesOperations` - * 2024-05-02-preview: :class:`TrustedAccessRolesOperations` - * 2024-06-02-preview: :class:`TrustedAccessRolesOperations` - * 2024-07-01: :class:`TrustedAccessRolesOperations` - * 2024-07-02-preview: :class:`TrustedAccessRolesOperations` - * 2024-08-01: :class:`TrustedAccessRolesOperations` + * 2022-04-02-preview: :class:`TrustedAccessRolesOperations` + * 2022-05-02-preview: :class:`TrustedAccessRolesOperations` + * 2022-06-02-preview: :class:`TrustedAccessRolesOperations` + * 2022-07-02-preview: :class:`TrustedAccessRolesOperations` + * 2022-08-02-preview: :class:`TrustedAccessRolesOperations` + * 2022-08-03-preview: :class:`TrustedAccessRolesOperations` + * 2022-09-02-preview: :class:`TrustedAccessRolesOperations` + * 2022-10-02-preview: :class:`TrustedAccessRolesOperations` + * 2022-11-02-preview: :class:`TrustedAccessRolesOperations` + * 2023-01-02-preview: :class:`TrustedAccessRolesOperations` + * 2023-02-02-preview: :class:`TrustedAccessRolesOperations` + * 2023-03-02-preview: :class:`TrustedAccessRolesOperations` + * 2023-04-02-preview: :class:`TrustedAccessRolesOperations` + * 2023-05-02-preview: :class:`TrustedAccessRolesOperations` + * 2023-06-02-preview: :class:`TrustedAccessRolesOperations` + * 2023-07-02-preview: :class:`TrustedAccessRolesOperations` + * 2023-08-02-preview: :class:`TrustedAccessRolesOperations` + * 2023-09-01: :class:`TrustedAccessRolesOperations` + * 2023-09-02-preview: :class:`TrustedAccessRolesOperations` + * 2023-10-01: :class:`TrustedAccessRolesOperations` + * 2023-10-02-preview: :class:`TrustedAccessRolesOperations` + * 2023-11-01: :class:`TrustedAccessRolesOperations` + * 2023-11-02-preview: :class:`TrustedAccessRolesOperations` + * 2024-01-01: :class:`TrustedAccessRolesOperations` + * 2024-01-02-preview: :class:`TrustedAccessRolesOperations` + * 2024-02-01: :class:`TrustedAccessRolesOperations` + * 2024-02-02-preview: :class:`TrustedAccessRolesOperations` + * 2024-03-02-preview: :class:`TrustedAccessRolesOperations` + * 2024-04-02-preview: :class:`TrustedAccessRolesOperations` + * 2024-05-01: :class:`TrustedAccessRolesOperations` + * 2024-05-02-preview: :class:`TrustedAccessRolesOperations` + * 2024-06-02-preview: :class:`TrustedAccessRolesOperations` + * 2024-07-01: :class:`TrustedAccessRolesOperations` + * 2024-07-02-preview: :class:`TrustedAccessRolesOperations` + * 2024-08-01: :class:`TrustedAccessRolesOperations` """ - api_version = self._get_api_version('trusted_access_roles') - if api_version == '2022-04-02-preview': + api_version = self._get_api_version("trusted_access_roles") + if api_version == "2022-04-02-preview": from ..v2022_04_02_preview.aio.operations import TrustedAccessRolesOperations as OperationClass - elif api_version == '2022-05-02-preview': + elif api_version == "2022-05-02-preview": from ..v2022_05_02_preview.aio.operations import TrustedAccessRolesOperations as OperationClass - elif api_version == '2022-06-02-preview': + elif api_version == "2022-06-02-preview": from ..v2022_06_02_preview.aio.operations import TrustedAccessRolesOperations as OperationClass - elif api_version == '2022-07-02-preview': + elif api_version == "2022-07-02-preview": from ..v2022_07_02_preview.aio.operations import TrustedAccessRolesOperations as OperationClass - elif api_version == '2022-08-02-preview': + elif api_version == "2022-08-02-preview": from ..v2022_08_02_preview.aio.operations import TrustedAccessRolesOperations as OperationClass - elif api_version == '2022-08-03-preview': + elif api_version == "2022-08-03-preview": from ..v2022_08_03_preview.aio.operations import TrustedAccessRolesOperations as OperationClass - elif api_version == '2022-09-02-preview': + elif api_version == "2022-09-02-preview": from ..v2022_09_02_preview.aio.operations import TrustedAccessRolesOperations as OperationClass - elif api_version == '2022-10-02-preview': + elif api_version == "2022-10-02-preview": from ..v2022_10_02_preview.aio.operations import TrustedAccessRolesOperations as OperationClass - elif api_version == '2022-11-02-preview': + elif api_version == "2022-11-02-preview": from ..v2022_11_02_preview.aio.operations import TrustedAccessRolesOperations as OperationClass - elif api_version == '2023-01-02-preview': + elif api_version == "2023-01-02-preview": from ..v2023_01_02_preview.aio.operations import TrustedAccessRolesOperations as OperationClass - elif api_version == '2023-02-02-preview': + elif api_version == "2023-02-02-preview": from ..v2023_02_02_preview.aio.operations import TrustedAccessRolesOperations as OperationClass - elif api_version == '2023-03-02-preview': + elif api_version == "2023-03-02-preview": from ..v2023_03_02_preview.aio.operations import TrustedAccessRolesOperations as OperationClass - elif api_version == '2023-04-02-preview': + elif api_version == "2023-04-02-preview": from ..v2023_04_02_preview.aio.operations import TrustedAccessRolesOperations as OperationClass - elif api_version == '2023-05-02-preview': + elif api_version == "2023-05-02-preview": from ..v2023_05_02_preview.aio.operations import TrustedAccessRolesOperations as OperationClass - elif api_version == '2023-06-02-preview': + elif api_version == "2023-06-02-preview": from ..v2023_06_02_preview.aio.operations import TrustedAccessRolesOperations as OperationClass - elif api_version == '2023-07-02-preview': + elif api_version == "2023-07-02-preview": from ..v2023_07_02_preview.aio.operations import TrustedAccessRolesOperations as OperationClass - elif api_version == '2023-08-02-preview': + elif api_version == "2023-08-02-preview": from ..v2023_08_02_preview.aio.operations import TrustedAccessRolesOperations as OperationClass - elif api_version == '2023-09-01': + elif api_version == "2023-09-01": from ..v2023_09_01.aio.operations import TrustedAccessRolesOperations as OperationClass - elif api_version == '2023-09-02-preview': + elif api_version == "2023-09-02-preview": from ..v2023_09_02_preview.aio.operations import TrustedAccessRolesOperations as OperationClass - elif api_version == '2023-10-01': + elif api_version == "2023-10-01": from ..v2023_10_01.aio.operations import TrustedAccessRolesOperations as OperationClass - elif api_version == '2023-10-02-preview': + elif api_version == "2023-10-02-preview": from ..v2023_10_02_preview.aio.operations import TrustedAccessRolesOperations as OperationClass - elif api_version == '2023-11-01': + elif api_version == "2023-11-01": from ..v2023_11_01.aio.operations import TrustedAccessRolesOperations as OperationClass - elif api_version == '2023-11-02-preview': + elif api_version == "2023-11-02-preview": from ..v2023_11_02_preview.aio.operations import TrustedAccessRolesOperations as OperationClass - elif api_version == '2024-01-01': + elif api_version == "2024-01-01": from ..v2024_01_01.aio.operations import TrustedAccessRolesOperations as OperationClass - elif api_version == '2024-01-02-preview': + elif api_version == "2024-01-02-preview": from ..v2024_01_02_preview.aio.operations import TrustedAccessRolesOperations as OperationClass - elif api_version == '2024-02-01': + elif api_version == "2024-02-01": from ..v2024_02_01.aio.operations import TrustedAccessRolesOperations as OperationClass - elif api_version == '2024-02-02-preview': + elif api_version == "2024-02-02-preview": from ..v2024_02_02_preview.aio.operations import TrustedAccessRolesOperations as OperationClass - elif api_version == '2024-03-02-preview': + elif api_version == "2024-03-02-preview": from ..v2024_03_02_preview.aio.operations import TrustedAccessRolesOperations as OperationClass - elif api_version == '2024-04-02-preview': + elif api_version == "2024-04-02-preview": from ..v2024_04_02_preview.aio.operations import TrustedAccessRolesOperations as OperationClass - elif api_version == '2024-05-01': + elif api_version == "2024-05-01": from ..v2024_05_01.aio.operations import TrustedAccessRolesOperations as OperationClass - elif api_version == '2024-05-02-preview': + elif api_version == "2024-05-02-preview": from ..v2024_05_02_preview.aio.operations import TrustedAccessRolesOperations as OperationClass - elif api_version == '2024-06-02-preview': + elif api_version == "2024-06-02-preview": from ..v2024_06_02_preview.aio.operations import TrustedAccessRolesOperations as OperationClass - elif api_version == '2024-07-01': + elif api_version == "2024-07-01": from ..v2024_07_01.aio.operations import TrustedAccessRolesOperations as OperationClass - elif api_version == '2024-07-02-preview': + elif api_version == "2024-07-02-preview": from ..v2024_07_02_preview.aio.operations import TrustedAccessRolesOperations as OperationClass - elif api_version == '2024-08-01': + elif api_version == "2024-08-01": from ..v2024_08_01.aio.operations import TrustedAccessRolesOperations as OperationClass else: raise ValueError("API version {} does not have operation group 'trusted_access_roles'".format(api_version)) self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) + return OperationClass( + self._client, + self._config, + Serializer(self._models_dict(api_version)), + Deserializer(self._models_dict(api_version)), + api_version, + ) async def close(self): await self._client.close() + async def __aenter__(self): await self._client.__aenter__() return self + async def __aexit__(self, *exc_details): await self._client.__aexit__(*exc_details) diff --git a/sdk/containerservice/azure-mgmt-containerservice/setup.py b/sdk/containerservice/azure-mgmt-containerservice/setup.py index 2aae6908860b9..cebcbd8e986e3 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/setup.py +++ b/sdk/containerservice/azure-mgmt-containerservice/setup.py @@ -22,9 +22,11 @@ # 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"), + ( + 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) diff --git a/sdk/containerservice/azure-mgmt-containerservice/tests/test_container_service_container_services_operations_async_test.py b/sdk/containerservice/azure-mgmt-containerservice/tests/test_container_service_container_services_operations_async_test.py index 3f2c95b38feb8..d828467071872 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/tests/test_container_service_container_services_operations_async_test.py +++ b/sdk/containerservice/azure-mgmt-containerservice/tests/test_container_service_container_services_operations_async_test.py @@ -13,6 +13,7 @@ AZURE_LOCATION = "eastus" + @pytest.mark.live_test_only class TestContainerServiceContainerServicesOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): @@ -25,4 +26,4 @@ async def test_list_by_resource_group(self, resource_group): resource_group_name=resource_group.name, ) result = [r async for r in response] - assert result == [] \ No newline at end of file + assert result == [] diff --git a/sdk/containerservice/azure-mgmt-containerservice/tests/test_container_service_container_services_operations_test.py b/sdk/containerservice/azure-mgmt-containerservice/tests/test_container_service_container_services_operations_test.py index eeabd80432825..070553019453e 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/tests/test_container_service_container_services_operations_test.py +++ b/sdk/containerservice/azure-mgmt-containerservice/tests/test_container_service_container_services_operations_test.py @@ -12,6 +12,7 @@ AZURE_LOCATION = "eastus" + @pytest.mark.live_test_only class TestContainerServiceContainerServicesOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): diff --git a/sdk/containerservice/azure-mgmt-containerservice/tests/test_container_service_operations_async_test.py b/sdk/containerservice/azure-mgmt-containerservice/tests/test_container_service_operations_async_test.py index fec109b98822a..8fb25f37dd003 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/tests/test_container_service_operations_async_test.py +++ b/sdk/containerservice/azure-mgmt-containerservice/tests/test_container_service_operations_async_test.py @@ -13,6 +13,7 @@ AZURE_LOCATION = "eastus" + @pytest.mark.live_test_only class TestContainerServiceOperationsAsync(AzureMgmtRecordedTestCase): def setup_method(self, method): diff --git a/sdk/containerservice/azure-mgmt-containerservice/tests/test_container_service_operations_test.py b/sdk/containerservice/azure-mgmt-containerservice/tests/test_container_service_operations_test.py index e9ca08bd3f854..d50d4bd740f49 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/tests/test_container_service_operations_test.py +++ b/sdk/containerservice/azure-mgmt-containerservice/tests/test_container_service_operations_test.py @@ -12,6 +12,7 @@ AZURE_LOCATION = "eastus" + @pytest.mark.live_test_only class TestContainerServiceOperations(AzureMgmtRecordedTestCase): def setup_method(self, method): diff --git a/sdk/containerservice/azure-mgmt-containerservice/tests/test_mgmt_aks.py b/sdk/containerservice/azure-mgmt-containerservice/tests/test_mgmt_aks.py index 841a82d0680d5..f57082f58b579 100644 --- a/sdk/containerservice/azure-mgmt-containerservice/tests/test_mgmt_aks.py +++ b/sdk/containerservice/azure-mgmt-containerservice/tests/test_mgmt_aks.py @@ -32,21 +32,19 @@ import azure.mgmt.containerservice from devtools_testutils import AzureMgmtRecordedTestCase, ResourceGroupPreparer, recorded_by_proxy -AZURE_LOCATION = 'eastus' +AZURE_LOCATION = "eastus" class TestMgmtContainerServiceClient(AzureMgmtRecordedTestCase): def setup_method(self, method): - self.mgmt_client = self.create_mgmt_client( - azure.mgmt.containerservice.ContainerServiceClient - ) + self.mgmt_client = self.create_mgmt_client(azure.mgmt.containerservice.ContainerServiceClient) - @pytest.mark.skip('hard to test') + @pytest.mark.skip("hard to test") @ResourceGroupPreparer() def test_managed_clusters(self, resource_group): - CLIENT_ID = getattr(self.settings, 'CLIENT_ID', "123") - CLIENT_SECRET = getattr(self.settings, 'CLIENT_SECRET', "123") + CLIENT_ID = getattr(self.settings, "CLIENT_ID", "123") + CLIENT_SECRET = getattr(self.settings, "CLIENT_SECRET", "123") RESOURCE_GROUP = resource_group.name RESOURCE_NAME = "7" @@ -68,31 +66,31 @@ def test_managed_clusters(self, resource_group): "mode": "System", } ], - "service_principal_profile": { - "client_id": CLIENT_ID, - "secret": CLIENT_SECRET - }, - "location": AZURE_LOCATION + "service_principal_profile": {"client_id": CLIENT_ID, "secret": CLIENT_SECRET}, + "location": AZURE_LOCATION, } for i in range(10): try: - result = self.mgmt_client.managed_clusters.begin_create_or_update(resource_group_name=RESOURCE_GROUP, - resource_name=RESOURCE_NAME, - parameters=BODY) + result = self.mgmt_client.managed_clusters.begin_create_or_update( + resource_group_name=RESOURCE_GROUP, resource_name=RESOURCE_NAME, parameters=BODY + ) result.result() except azure.core.exceptions.ResourceExistsError: time.sleep(30) else: break # 2 - self.mgmt_client.managed_clusters.list_cluster_admin_credentials(resource_group_name=RESOURCE_GROUP, - resource_name=RESOURCE_NAME) + self.mgmt_client.managed_clusters.list_cluster_admin_credentials( + resource_group_name=RESOURCE_GROUP, resource_name=RESOURCE_NAME + ) # 3 - self.mgmt_client.managed_clusters.list_cluster_user_credentials(resource_group_name=RESOURCE_GROUP, - resource_name=RESOURCE_NAME) + self.mgmt_client.managed_clusters.list_cluster_user_credentials( + resource_group_name=RESOURCE_GROUP, resource_name=RESOURCE_NAME + ) # 4 - self.mgmt_client.managed_clusters.get_upgrade_profile(resource_group_name=RESOURCE_GROUP, - resource_name=RESOURCE_NAME) + self.mgmt_client.managed_clusters.get_upgrade_profile( + resource_group_name=RESOURCE_GROUP, resource_name=RESOURCE_NAME + ) # # 5 # result = self.mgmt_client.managed_clusters.begin_stop(resource_group_name=RESOURCE_GROUP, # resource_name=RESOURCE_NAME) @@ -112,24 +110,22 @@ def test_managed_clusters(self, resource_group): # resource_name=RESOURCE_NAME) result.result() # 11 - BODY = { - "tags": { - "tier": "testing", - "archv3": "" - } - } - result = self.mgmt_client.managed_clusters.begin_update_tags(resource_group_name=RESOURCE_GROUP, - resource_name=RESOURCE_NAME, parameters=BODY) + BODY = {"tags": {"tier": "testing", "archv3": ""}} + result = self.mgmt_client.managed_clusters.begin_update_tags( + resource_group_name=RESOURCE_GROUP, resource_name=RESOURCE_NAME, parameters=BODY + ) result.result() # 12 - self.mgmt_client.managed_clusters.list_cluster_monitoring_user_credentials(resource_group_name=RESOURCE_GROUP, - resource_name=RESOURCE_NAME) + self.mgmt_client.managed_clusters.list_cluster_monitoring_user_credentials( + resource_group_name=RESOURCE_GROUP, resource_name=RESOURCE_NAME + ) # 13 - result = self.mgmt_client.managed_clusters.begin_delete(resource_group_name=RESOURCE_GROUP, - resource_name=RESOURCE_NAME) + result = self.mgmt_client.managed_clusters.begin_delete( + resource_group_name=RESOURCE_GROUP, resource_name=RESOURCE_NAME + ) result.result() - @pytest.mark.skip('duplicated testcase') + @pytest.mark.skip("duplicated testcase") @ResourceGroupPreparer() @recorded_by_proxy def test_operations(self): @@ -137,11 +133,11 @@ def test_operations(self): for item in result: print(item.as_dict()) - @pytest.mark.skip('hard to test') + @pytest.mark.skip("hard to test") @ResourceGroupPreparer() def test_privateLinkResources(self, resource_group): - CLIENT_ID = getattr(self.settings, 'CLIENT_ID', "123") - CLIENT_SECRET = getattr(self.settings, 'CLIENT_SECRET', "123") + CLIENT_ID = getattr(self.settings, "CLIENT_ID", "123") + CLIENT_SECRET = getattr(self.settings, "CLIENT_SECRET", "123") RESOURCE_GROUP = resource_group.name RESOURCE_NAME = "2" @@ -162,20 +158,15 @@ def test_privateLinkResources(self, resource_group): "mode": "System", } ], - "api_server_access_profile": { - "enable_private_cluster": True # private cluster - }, - "service_principal_profile": { - "client_id": CLIENT_ID, - "secret": CLIENT_SECRET - }, - "location": AZURE_LOCATION + "api_server_access_profile": {"enable_private_cluster": True}, # private cluster + "service_principal_profile": {"client_id": CLIENT_ID, "secret": CLIENT_SECRET}, + "location": AZURE_LOCATION, } for i in range(10): try: - result = self.mgmt_client.managed_clusters.begin_create_or_update(resource_group_name=RESOURCE_GROUP, - resource_name=RESOURCE_NAME, - parameters=BODY) + result = self.mgmt_client.managed_clusters.begin_create_or_update( + resource_group_name=RESOURCE_GROUP, resource_name=RESOURCE_NAME, parameters=BODY + ) result.result() except azure.core.exceptions.ResourceExistsError: time.sleep(30) @@ -185,11 +176,11 @@ def test_privateLinkResources(self, resource_group): # 1 self.mgmt_client.private_link_resources.list(resource_group_name=RESOURCE_GROUP, resource_name=RESOURCE_NAME) - @pytest.mark.skip('hard to test') + @pytest.mark.skip("hard to test") @ResourceGroupPreparer() def test_resolvePrivateLinkServiceId(self, resource_group): - CLIENT_ID = getattr(self.settings, 'CLIENT_ID', "123") - CLIENT_SECRET = getattr(self.settings, 'CLIENT_SECRET', "123") + CLIENT_ID = getattr(self.settings, "CLIENT_ID", "123") + CLIENT_SECRET = getattr(self.settings, "CLIENT_SECRET", "123") RESOURCE_GROUP = resource_group.name RESOURCE_NAME = "3" @@ -210,20 +201,15 @@ def test_resolvePrivateLinkServiceId(self, resource_group): "mode": "System", } ], - "api_server_access_profile": { - "enable_private_cluster": True # private cluster - }, - "service_principal_profile": { - "client_id": CLIENT_ID, - "secret": CLIENT_SECRET - }, - "location": AZURE_LOCATION + "api_server_access_profile": {"enable_private_cluster": True}, # private cluster + "service_principal_profile": {"client_id": CLIENT_ID, "secret": CLIENT_SECRET}, + "location": AZURE_LOCATION, } for i in range(10): try: - result = self.mgmt_client.managed_clusters.begin_create_or_update(resource_group_name=RESOURCE_GROUP, - resource_name=RESOURCE_NAME, - parameters=BODY) + result = self.mgmt_client.managed_clusters.begin_create_or_update( + resource_group_name=RESOURCE_GROUP, resource_name=RESOURCE_NAME, parameters=BODY + ) result.result() except azure.core.exceptions.ResourceExistsError: time.sleep(30) @@ -231,17 +217,16 @@ def test_resolvePrivateLinkServiceId(self, resource_group): break # 1 - BODY = { - "name": "testManagement" - } - self.mgmt_client.resolve_private_link_service_id.post(resource_group_name=RESOURCE_GROUP, - resource_name=RESOURCE_NAME, parameters=BODY) + BODY = {"name": "testManagement"} + self.mgmt_client.resolve_private_link_service_id.post( + resource_group_name=RESOURCE_GROUP, resource_name=RESOURCE_NAME, parameters=BODY + ) - @pytest.mark.skip('hard to test') + @pytest.mark.skip("hard to test") @ResourceGroupPreparer() def test_agentPools(self, resource_group): - CLIENT_ID = getattr(self.settings, 'CLIENT_ID', "123") - CLIENT_SECRET = getattr(self.settings, 'CLIENT_SECRET', "123") + CLIENT_ID = getattr(self.settings, "CLIENT_ID", "123") + CLIENT_SECRET = getattr(self.settings, "CLIENT_SECRET", "123") RESOURCE_GROUP = resource_group.name RESOURCE_NAME = "4" AGENT_POOL_NAME = "aksagent" @@ -265,14 +250,12 @@ def test_agentPools(self, resource_group): "mode": "System", } ], - "service_principal_profile": { - "client_id": CLIENT_ID, - "secret": CLIENT_SECRET - }, - "location": AZURE_LOCATION + "service_principal_profile": {"client_id": CLIENT_ID, "secret": CLIENT_SECRET}, + "location": AZURE_LOCATION, } - result = self.mgmt_client.managed_clusters.begin_create_or_update(resource_group_name=RESOURCE_GROUP, - resource_name=RESOURCE_NAME, parameters=BODY) + result = self.mgmt_client.managed_clusters.begin_create_or_update( + resource_group_name=RESOURCE_GROUP, resource_name=RESOURCE_NAME, parameters=BODY + ) result.result() # 1 @@ -283,21 +266,19 @@ def test_agentPools(self, resource_group): "os_type": "Linux", "type": "VirtualMachineScaleSets", "mode": MODE, - "availability_zones": [ - "1", - "2", - "3" - ], + "availability_zones": ["1", "2", "3"], # "scale_set_priority": "Regular", # "scale_set_eviction_policy": "Delete", - "node_taints": [] + "node_taints": [], } for i in range(10): try: - result = self.mgmt_client.agent_pools.begin_create_or_update(resource_group_name=RESOURCE_GROUP, - resource_name=RESOURCE_NAME, - agent_pool_name=AGENT_POOL_NAME, - parameters=BODY) + result = self.mgmt_client.agent_pools.begin_create_or_update( + resource_group_name=RESOURCE_GROUP, + resource_name=RESOURCE_NAME, + agent_pool_name=AGENT_POOL_NAME, + parameters=BODY, + ) result = result.result() except azure.core.exceptions.ResourceExistsError: time.sleep(30) @@ -305,11 +286,13 @@ def test_agentPools(self, resource_group): break # 2 - self.mgmt_client.agent_pools.get(resource_group_name=RESOURCE_GROUP, resource_name=RESOURCE_NAME, - agent_pool_name=AGENT_POOL_NAME) + self.mgmt_client.agent_pools.get( + resource_group_name=RESOURCE_GROUP, resource_name=RESOURCE_NAME, agent_pool_name=AGENT_POOL_NAME + ) # 3 - self.mgmt_client.agent_pools.get_available_agent_pool_versions(resource_group_name=RESOURCE_GROUP, - resource_name=RESOURCE_NAME) + self.mgmt_client.agent_pools.get_available_agent_pool_versions( + resource_group_name=RESOURCE_GROUP, resource_name=RESOURCE_NAME + ) # 4 self.mgmt_client.agent_pools.list(resource_group_name=RESOURCE_GROUP, resource_name=RESOURCE_NAME) @@ -567,5 +550,5 @@ def test_agentPools(self, resource_group): # # result = result.result() -if __name__ == '__main__': +if __name__ == "__main__": unittest.main() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/CHANGELOG.md b/sdk/containerservice/azure-mgmt-containerservicefleet/CHANGELOG.md index 0e35ddbf3d72f..eb071e20db603 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/CHANGELOG.md +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/CHANGELOG.md @@ -1,5 +1,11 @@ # Release History +## 3.0.0 (2024-10-31) + +### Breaking Changes + +- This package now only targets the latest Api-Version available on Azure and removes APIs of other Api-Version. After this change, the package can have much smaller size. If your application requires a specific and non-latest Api-Version, it's recommended to pin this package to the previous released version; If your application always only use latest Api-Version, please ingore this change. + ## 2.1.0 (2024-10-21) ### Features Added diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/_meta.json b/sdk/containerservice/azure-mgmt-containerservicefleet/_meta.json index b732e480fb679..31288126b1f84 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/_meta.json +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/_meta.json @@ -1,21 +1,11 @@ { - "commit": "399cbac2de1bc0acbed4c9a0a864a9c84da3692e", + "commit": "a4fc4c6bda9ff2315671bca69f9de40a43e2bd8c", "repository_url": "https://github.com/Azure/azure-rest-api-specs", "autorest": "3.10.2", "use": [ "@autorest/python@6.19.0", "@autorest/modelerfour@4.27.0" ], - "autorest_command": "autorest specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/readme.md --generate-sample=True --generate-test=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/home/vsts/work/1/azure-sdk-for-python/sdk --use=@autorest/python@6.19.0 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False", + "autorest_command": "autorest specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/readme.md --generate-sample=True --generate-test=True --include-x-ms-examples-original-file=True --python --python-sdks-folder=/mnt/vss/_work/1/azure-sdk-for-python/sdk --tag=package-2024-04 --use=@autorest/python@6.19.0 --use=@autorest/modelerfour@4.27.0 --version=3.10.2 --version-tolerant=False", "readme": "specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/readme.md", - "package-2023-06-preview": "2024-07-17 13:51:57 -0700 c02b366afa77a3e2a746719cea713b231b4b41bb preview/2023-06-15-preview/fleets.json", - "package-2023-03-preview": "2024-07-17 13:51:57 -0700 c02b366afa77a3e2a746719cea713b231b4b41bb preview/2023-03-15-preview/fleets.json", - "package-2022-09-preview": "2024-06-14 00:56:33 -0700 db63bea839f5648462c94e685d5cc96f8e8b38ba preview/2022-09-02-preview/fleets.json", - "package-2022-07-preview": "2023-02-15 15:17:59 +0800 67527326606bd3c71700e2b96ff3c9ce9e655e29 preview/2022-07-02-preview/fleets.json", - "package-2022-06-preview": "2023-02-15 15:17:59 +0800 67527326606bd3c71700e2b96ff3c9ce9e655e29 preview/2022-06-02-preview/fleets.json", - "package-2023-08-preview": "2024-07-17 13:51:57 -0700 c02b366afa77a3e2a746719cea713b231b4b41bb preview/2023-08-15-preview/fleets.json", - "package-2023-10": "2024-07-17 13:51:57 -0700 c02b366afa77a3e2a746719cea713b231b4b41bb stable/2023-10-15/fleets.json", - "package-2024-02-preview": "2024-07-17 13:51:57 -0700 c02b366afa77a3e2a746719cea713b231b4b41bb preview/2024-02-02-preview/fleets.json", - "package-2024-04": "2024-07-17 13:51:57 -0700 c02b366afa77a3e2a746719cea713b231b4b41bb stable/2024-04-01/fleets.json", - "package-2024-05-preview": "2024-09-20 16:08:37 -0700 3aa1c23a75a3af0cc5845f52cb68a98f6889a970 preview/2024-05-02-preview/fleets.json" } \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/__init__.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/__init__.py index b7d7040aff553..78b8b4b91a49e 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/__init__.py @@ -7,14 +7,20 @@ # -------------------------------------------------------------------------- from ._container_service_fleet_mgmt_client import ContainerServiceFleetMgmtClient -__all__ = ['ContainerServiceFleetMgmtClient'] +from ._version import VERSION + +__version__ = VERSION try: - from ._patch import patch_sdk # type: ignore - patch_sdk() + from ._patch import __all__ as _patch_all + from ._patch import * # pylint: disable=unused-wildcard-import except ImportError: - pass + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk -from ._version import VERSION +__all__ = [ + "ContainerServiceFleetMgmtClient", +] +__all__.extend([p for p in _patch_all if p not in __all__]) -__version__ = VERSION +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/_configuration.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/_configuration.py index 047c5f78b2040..272c39b1f573b 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/_configuration.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/_configuration.py @@ -1,13 +1,11 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- + from typing import Any, TYPE_CHECKING from azure.core.pipeline import policies @@ -19,7 +17,8 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class ContainerServiceFleetMgmtClientConfiguration: + +class ContainerServiceFleetMgmtClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long """Configuration for ContainerServiceFleetMgmtClient. Note that all parameters used to create this instance are saved as instance @@ -29,14 +28,14 @@ class ContainerServiceFleetMgmtClientConfiguration: :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str + :keyword api_version: Api Version. Default value is "2024-04-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ - def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - **kwargs: Any - ): + def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: + api_version: str = kwargs.pop("api_version", "2024-04-01") + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -44,23 +43,23 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'azure-mgmt-containerservicefleet/{}'.format(VERSION)) + self.api_version = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-containerservicefleet/{}".format(VERSION)) self.polling_interval = kwargs.get("polling_interval", 30) self._configure(**kwargs) - def _configure( - self, - **kwargs: Any - ): - 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') + 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.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = ARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/_container_service_fleet_mgmt_client.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/_container_service_fleet_mgmt_client.py index 5c33a960eac5e..748b6e7f48cdd 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/_container_service_fleet_mgmt_client.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/_container_service_fleet_mgmt_client.py @@ -1,82 +1,73 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# 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. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, TYPE_CHECKING from typing_extensions import Self from azure.core.pipeline import policies +from azure.core.rest import HttpRequest, HttpResponse from azure.mgmt.core import ARMPipelineClient from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy -from azure.profiles import KnownProfiles, ProfileDefinition -from azure.profiles.multiapiclient import MultiApiClientMixin +from . import models as _models from ._configuration import ContainerServiceFleetMgmtClientConfiguration from ._serialization import Deserializer, Serializer +from .operations import ( + FleetMembersOperations, + FleetUpdateStrategiesOperations, + FleetsOperations, + Operations, + UpdateRunsOperations, +) if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials import TokenCredential -class _SDKClient(object): - def __init__(self, *args, **kwargs): - """This is a fake class to support current implemetation of MultiApiClientMixin." - Will be removed in final version of multiapi azure-core based client - """ - pass -class ContainerServiceFleetMgmtClient(MultiApiClientMixin, _SDKClient): +class ContainerServiceFleetMgmtClient: # pylint: disable=client-accepts-api-version-keyword """Azure Kubernetes Fleet Manager api client. - This ready contains multiple API versions, to help you deal with all of the Azure clouds - (Azure Stack, Azure Government, Azure China, etc.). - By default, it uses the latest API version available on public Azure. - For production, you should stick to a particular api-version and/or profile. - The profile sets a mapping between an operation group and its API version. - The api-version parameter sets the default API version if the operation - group is not described in the profile. - + :ivar operations: Operations operations + :vartype operations: azure.mgmt.containerservicefleet.operations.Operations + :ivar fleets: FleetsOperations operations + :vartype fleets: azure.mgmt.containerservicefleet.operations.FleetsOperations + :ivar fleet_members: FleetMembersOperations operations + :vartype fleet_members: azure.mgmt.containerservicefleet.operations.FleetMembersOperations + :ivar update_runs: UpdateRunsOperations operations + :vartype update_runs: azure.mgmt.containerservicefleet.operations.UpdateRunsOperations + :ivar fleet_update_strategies: FleetUpdateStrategiesOperations operations + :vartype fleet_update_strategies: + azure.mgmt.containerservicefleet.operations.FleetUpdateStrategiesOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials.TokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :param api_version: API version to use if no profile is provided, or if missing in profile. - :type api_version: str - :param base_url: Service URL + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :param profile: A profile definition, from KnownProfiles to dict. - :type profile: azure.profiles.KnownProfiles - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword api_version: Api Version. Default value is "2024-04-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ - DEFAULT_API_VERSION = '2024-04-01' - _PROFILE_TAG = "azure.mgmt.containerservicefleet.ContainerServiceFleetMgmtClient" - LATEST_PROFILE = ProfileDefinition({ - _PROFILE_TAG: { - None: DEFAULT_API_VERSION, - }}, - _PROFILE_TAG + " latest" - ) - def __init__( self, credential: "TokenCredential", subscription_id: str, - api_version: Optional[str]=None, base_url: str = "https://management.azure.com", - profile: KnownProfiles=KnownProfiles.default, **kwargs: Any - ): - if api_version: - kwargs.setdefault('api_version', api_version) - self._config = ContainerServiceFleetMgmtClientConfiguration(credential, subscription_id, **kwargs) + ) -> None: + self._config = ContainerServiceFleetMgmtClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -95,256 +86,48 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) - super(ContainerServiceFleetMgmtClient, self).__init__( - api_version=api_version, - profile=profile + self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.fleets = FleetsOperations(self._client, self._config, self._serialize, self._deserialize) + self.fleet_members = FleetMembersOperations(self._client, self._config, self._serialize, self._deserialize) + self.update_runs = UpdateRunsOperations(self._client, self._config, self._serialize, self._deserialize) + self.fleet_update_strategies = FleetUpdateStrategiesOperations( + self._client, self._config, self._serialize, self._deserialize ) - @classmethod - def _models_dict(cls, api_version): - return {k: v for k, v in cls.models(api_version).__dict__.items() if isinstance(v, type)} - - @classmethod - def models(cls, api_version=DEFAULT_API_VERSION): - """Module depends on the API version: - - * 2022-09-02-preview: :mod:`v2022_06_02_preview.models` - * 2022-07-02-preview: :mod:`v2022_07_02_preview.models` - * 2022-06-02-preview: :mod:`v2022_09_02_preview.models` - * 2023-03-15-preview: :mod:`v2023_03_15_preview.models` - * 2023-06-15-preview: :mod:`v2023_06_15_preview.models` - * 2023-08-15-preview: :mod:`v2023_08_15_preview.models` - * 2023-10-15: :mod:`v2023_10_15.models` - * 2024-02-02-preview: :mod:`v2024_02_02_preview.models` - * 2024-04-01: :mod:`v2024_04_01.models` - * 2024-05-02-preview: :mod:`v2024_05_02_preview.models` - """ - if api_version == '2022-09-02-preview': - from .v2022_06_02_preview import models - return models - elif api_version == '2022-07-02-preview': - from .v2022_07_02_preview import models - return models - elif api_version == '2022-06-02-preview': - from .v2022_09_02_preview import models - return models - elif api_version == '2023-03-15-preview': - from .v2023_03_15_preview import models - return models - elif api_version == '2023-06-15-preview': - from .v2023_06_15_preview import models - return models - elif api_version == '2023-08-15-preview': - from .v2023_08_15_preview import models - return models - elif api_version == '2023-10-15': - from .v2023_10_15 import models - return models - elif api_version == '2024-02-02-preview': - from .v2024_02_02_preview import models - return models - elif api_version == '2024-04-01': - from .v2024_04_01 import models - return models - elif api_version == '2024-05-02-preview': - from .v2024_05_02_preview import models - return models - raise ValueError("API version {} is not available".format(api_version)) - - @property - def auto_upgrade_profiles(self): - """Instance depends on the API version: - - * 2024-05-02-preview: :class:`AutoUpgradeProfilesOperations` - """ - api_version = self._get_api_version('auto_upgrade_profiles') - if api_version == '2024-05-02-preview': - from .v2024_05_02_preview.operations import AutoUpgradeProfilesOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'auto_upgrade_profiles'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - - @property - def fleet_members(self): - """Instance depends on the API version: + def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: + """Runs the network request through the client's chained policies. - * 2022-09-02-preview: :class:`FleetMembersOperations` - * 2022-07-02-preview: :class:`FleetMembersOperations` - * 2022-06-02-preview: :class:`FleetMembersOperations` - * 2023-03-15-preview: :class:`FleetMembersOperations` - * 2023-06-15-preview: :class:`FleetMembersOperations` - * 2023-08-15-preview: :class:`FleetMembersOperations` - * 2023-10-15: :class:`FleetMembersOperations` - * 2024-02-02-preview: :class:`FleetMembersOperations` - * 2024-04-01: :class:`FleetMembersOperations` - * 2024-05-02-preview: :class:`FleetMembersOperations` - """ - api_version = self._get_api_version('fleet_members') - if api_version == '2022-09-02-preview': - from .v2022_06_02_preview.operations import FleetMembersOperations as OperationClass - elif api_version == '2022-07-02-preview': - from .v2022_07_02_preview.operations import FleetMembersOperations as OperationClass - elif api_version == '2022-06-02-preview': - from .v2022_09_02_preview.operations import FleetMembersOperations as OperationClass - elif api_version == '2023-03-15-preview': - from .v2023_03_15_preview.operations import FleetMembersOperations as OperationClass - elif api_version == '2023-06-15-preview': - from .v2023_06_15_preview.operations import FleetMembersOperations as OperationClass - elif api_version == '2023-08-15-preview': - from .v2023_08_15_preview.operations import FleetMembersOperations as OperationClass - elif api_version == '2023-10-15': - from .v2023_10_15.operations import FleetMembersOperations as OperationClass - elif api_version == '2024-02-02-preview': - from .v2024_02_02_preview.operations import FleetMembersOperations as OperationClass - elif api_version == '2024-04-01': - from .v2024_04_01.operations import FleetMembersOperations as OperationClass - elif api_version == '2024-05-02-preview': - from .v2024_05_02_preview.operations import FleetMembersOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'fleet_members'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - - @property - def fleet_update_strategies(self): - """Instance depends on the API version: - - * 2023-08-15-preview: :class:`FleetUpdateStrategiesOperations` - * 2023-10-15: :class:`FleetUpdateStrategiesOperations` - * 2024-02-02-preview: :class:`FleetUpdateStrategiesOperations` - * 2024-04-01: :class:`FleetUpdateStrategiesOperations` - * 2024-05-02-preview: :class:`FleetUpdateStrategiesOperations` - """ - api_version = self._get_api_version('fleet_update_strategies') - if api_version == '2023-08-15-preview': - from .v2023_08_15_preview.operations import FleetUpdateStrategiesOperations as OperationClass - elif api_version == '2023-10-15': - from .v2023_10_15.operations import FleetUpdateStrategiesOperations as OperationClass - elif api_version == '2024-02-02-preview': - from .v2024_02_02_preview.operations import FleetUpdateStrategiesOperations as OperationClass - elif api_version == '2024-04-01': - from .v2024_04_01.operations import FleetUpdateStrategiesOperations as OperationClass - elif api_version == '2024-05-02-preview': - from .v2024_05_02_preview.operations import FleetUpdateStrategiesOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'fleet_update_strategies'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = client._send_request(request) + - @property - def fleets(self): - """Instance depends on the API version: + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - * 2022-09-02-preview: :class:`FleetsOperations` - * 2022-07-02-preview: :class:`FleetsOperations` - * 2022-06-02-preview: :class:`FleetsOperations` - * 2023-03-15-preview: :class:`FleetsOperations` - * 2023-06-15-preview: :class:`FleetsOperations` - * 2023-08-15-preview: :class:`FleetsOperations` - * 2023-10-15: :class:`FleetsOperations` - * 2024-02-02-preview: :class:`FleetsOperations` - * 2024-04-01: :class:`FleetsOperations` - * 2024-05-02-preview: :class:`FleetsOperations` + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.HttpResponse """ - api_version = self._get_api_version('fleets') - if api_version == '2022-09-02-preview': - from .v2022_06_02_preview.operations import FleetsOperations as OperationClass - elif api_version == '2022-07-02-preview': - from .v2022_07_02_preview.operations import FleetsOperations as OperationClass - elif api_version == '2022-06-02-preview': - from .v2022_09_02_preview.operations import FleetsOperations as OperationClass - elif api_version == '2023-03-15-preview': - from .v2023_03_15_preview.operations import FleetsOperations as OperationClass - elif api_version == '2023-06-15-preview': - from .v2023_06_15_preview.operations import FleetsOperations as OperationClass - elif api_version == '2023-08-15-preview': - from .v2023_08_15_preview.operations import FleetsOperations as OperationClass - elif api_version == '2023-10-15': - from .v2023_10_15.operations import FleetsOperations as OperationClass - elif api_version == '2024-02-02-preview': - from .v2024_02_02_preview.operations import FleetsOperations as OperationClass - elif api_version == '2024-04-01': - from .v2024_04_01.operations import FleetsOperations as OperationClass - elif api_version == '2024-05-02-preview': - from .v2024_05_02_preview.operations import FleetsOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'fleets'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - - @property - def operations(self): - """Instance depends on the API version: - * 2022-09-02-preview: :class:`Operations` - * 2023-03-15-preview: :class:`Operations` - * 2023-06-15-preview: :class:`Operations` - * 2023-08-15-preview: :class:`Operations` - * 2023-10-15: :class:`Operations` - * 2024-02-02-preview: :class:`Operations` - * 2024-04-01: :class:`Operations` - * 2024-05-02-preview: :class:`Operations` - """ - api_version = self._get_api_version('operations') - if api_version == '2022-09-02-preview': - from .v2022_06_02_preview.operations import Operations as OperationClass - elif api_version == '2023-03-15-preview': - from .v2023_03_15_preview.operations import Operations as OperationClass - elif api_version == '2023-06-15-preview': - from .v2023_06_15_preview.operations import Operations as OperationClass - elif api_version == '2023-08-15-preview': - from .v2023_08_15_preview.operations import Operations as OperationClass - elif api_version == '2023-10-15': - from .v2023_10_15.operations import Operations as OperationClass - elif api_version == '2024-02-02-preview': - from .v2024_02_02_preview.operations import Operations as OperationClass - elif api_version == '2024-04-01': - from .v2024_04_01.operations import Operations as OperationClass - elif api_version == '2024-05-02-preview': - from .v2024_05_02_preview.operations import Operations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'operations'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore - @property - def update_runs(self): - """Instance depends on the API version: - - * 2023-03-15-preview: :class:`UpdateRunsOperations` - * 2023-06-15-preview: :class:`UpdateRunsOperations` - * 2023-08-15-preview: :class:`UpdateRunsOperations` - * 2023-10-15: :class:`UpdateRunsOperations` - * 2024-02-02-preview: :class:`UpdateRunsOperations` - * 2024-04-01: :class:`UpdateRunsOperations` - * 2024-05-02-preview: :class:`UpdateRunsOperations` - """ - api_version = self._get_api_version('update_runs') - if api_version == '2023-03-15-preview': - from .v2023_03_15_preview.operations import UpdateRunsOperations as OperationClass - elif api_version == '2023-06-15-preview': - from .v2023_06_15_preview.operations import UpdateRunsOperations as OperationClass - elif api_version == '2023-08-15-preview': - from .v2023_08_15_preview.operations import UpdateRunsOperations as OperationClass - elif api_version == '2023-10-15': - from .v2023_10_15.operations import UpdateRunsOperations as OperationClass - elif api_version == '2024-02-02-preview': - from .v2024_02_02_preview.operations import UpdateRunsOperations as OperationClass - elif api_version == '2024-04-01': - from .v2024_04_01.operations import UpdateRunsOperations as OperationClass - elif api_version == '2024-05-02-preview': - from .v2024_05_02_preview.operations import UpdateRunsOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'update_runs'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - - def close(self): + def close(self) -> None: self._client.close() - def __enter__(self): + + def __enter__(self) -> Self: self._client.__enter__() return self - def __exit__(self, *exc_details): + + def __exit__(self, *exc_details: Any) -> None: self._client.__exit__(*exc_details) diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_06_02_preview/_patch.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/_patch.py similarity index 100% rename from sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_06_02_preview/_patch.py rename to sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/_patch.py diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/_serialization.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/_serialization.py index 59f1fcf71bc97..8139854b97bb8 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/_serialization.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/_serialization.py @@ -351,9 +351,7 @@ def serialize(self, keep_readonly: bool = False, **kwargs: Any) -> JSON: def as_dict( self, keep_readonly: bool = True, - key_transformer: Callable[ - [str, Dict[str, Any], Any], Any - ] = attribute_transformer, + key_transformer: Callable[[str, Dict[str, Any], Any], Any] = attribute_transformer, **kwargs: Any ) -> JSON: """Return a dict that can be serialized using json.dump. @@ -542,7 +540,7 @@ class Serializer(object): "multiple": lambda x, y: x % y != 0, } - def __init__(self, classes: Optional[Mapping[str, type]]=None): + def __init__(self, classes: Optional[Mapping[str, type]] = None): self.serialize_type = { "iso-8601": Serializer.serialize_iso, "rfc-1123": Serializer.serialize_rfc, @@ -750,7 +748,7 @@ def query(self, name, data, data_type, **kwargs): # Treat the list aside, since we don't want to encode the div separator if data_type.startswith("["): internal_data_type = data_type[1:-1] - do_quote = not kwargs.get('skip_quote', False) + do_quote = not kwargs.get("skip_quote", False) return self.serialize_iter(data, internal_data_type, do_quote=do_quote, **kwargs) # Not a list, regular serialization @@ -909,12 +907,8 @@ def serialize_iter(self, data, iter_type, div=None, **kwargs): raise serialized.append(None) - if kwargs.get('do_quote', False): - serialized = [ - '' if s is None else quote(str(s), safe='') - for s - in serialized - ] + if kwargs.get("do_quote", False): + serialized = ["" if s is None else quote(str(s), safe="") for s in serialized] if div: serialized = ["" if s is None else str(s) for s in serialized] @@ -1371,7 +1365,7 @@ class Deserializer(object): valid_date = re.compile(r"\d{4}[-]\d{2}[-]\d{2}T\d{2}:\d{2}:\d{2}" r"\.?\d*Z?[-+]?[\d{2}]?:?[\d{2}]?") - def __init__(self, classes: Optional[Mapping[str, type]]=None): + def __init__(self, classes: Optional[Mapping[str, type]] = None): self.deserialize_type = { "iso-8601": Deserializer.deserialize_iso, "rfc-1123": Deserializer.deserialize_rfc, diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/_version.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/_version.py index 46c39ed64eb9b..cac9f5d10f8b7 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/_version.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/_version.py @@ -1,8 +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. +# 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 = "2.1.0" +VERSION = "3.0.0" diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/aio/__init__.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/aio/__init__.py index 4a067dd28d88d..af1d7b0b47fe9 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/aio/__init__.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/aio/__init__.py @@ -7,4 +7,17 @@ # -------------------------------------------------------------------------- from ._container_service_fleet_mgmt_client import ContainerServiceFleetMgmtClient -__all__ = ['ContainerServiceFleetMgmtClient'] + +try: + from ._patch import __all__ as _patch_all + from ._patch import * # pylint: disable=unused-wildcard-import +except ImportError: + _patch_all = [] +from ._patch import patch_sdk as _patch_sdk + +__all__ = [ + "ContainerServiceFleetMgmtClient", +] +__all__.extend([p for p in _patch_all if p not in __all__]) + +_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/aio/_configuration.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/aio/_configuration.py index aa02d819c7059..8473d07bde9cd 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/aio/_configuration.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/aio/_configuration.py @@ -1,13 +1,11 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# Licensed under the MIT License. See License.txt in the project root for license information. # Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is -# regenerated. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- + from typing import Any, TYPE_CHECKING from azure.core.pipeline import policies @@ -19,7 +17,8 @@ # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class ContainerServiceFleetMgmtClientConfiguration: + +class ContainerServiceFleetMgmtClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long """Configuration for ContainerServiceFleetMgmtClient. Note that all parameters used to create this instance are saved as instance @@ -29,14 +28,14 @@ class ContainerServiceFleetMgmtClientConfiguration: :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str + :keyword api_version: Api Version. Default value is "2024-04-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str """ - def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - **kwargs: Any - ) -> None: + def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: + api_version: str = kwargs.pop("api_version", "2024-04-01") + if credential is None: raise ValueError("Parameter 'credential' must not be None.") if subscription_id is None: @@ -44,23 +43,23 @@ def __init__( self.credential = credential self.subscription_id = subscription_id - self.credential_scopes = kwargs.pop('credential_scopes', ['https://management.azure.com/.default']) - kwargs.setdefault('sdk_moniker', 'azure-mgmt-containerservicefleet/{}'.format(VERSION)) + self.api_version = api_version + self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) + kwargs.setdefault("sdk_moniker", "mgmt-containerservicefleet/{}".format(VERSION)) self.polling_interval = kwargs.get("polling_interval", 30) 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') + 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.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) + self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) + self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) + self.authentication_policy = kwargs.get("authentication_policy") if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs) + self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( + self.credential, *self.credential_scopes, **kwargs + ) diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/aio/_container_service_fleet_mgmt_client.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/aio/_container_service_fleet_mgmt_client.py index 0fd6f449cd048..0b14a61497c18 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/aio/_container_service_fleet_mgmt_client.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/aio/_container_service_fleet_mgmt_client.py @@ -1,82 +1,73 @@ # coding=utf-8 # -------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# +# 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. +# Changes may cause incorrect behavior and will be lost if the code is regenerated. # -------------------------------------------------------------------------- -from typing import Any, Optional, TYPE_CHECKING +from copy import deepcopy +from typing import Any, Awaitable, TYPE_CHECKING from typing_extensions import Self from azure.core.pipeline import policies +from azure.core.rest import AsyncHttpResponse, HttpRequest from azure.mgmt.core import AsyncARMPipelineClient from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy -from azure.profiles import KnownProfiles, ProfileDefinition -from azure.profiles.multiapiclient import MultiApiClientMixin +from .. import models as _models from .._serialization import Deserializer, Serializer from ._configuration import ContainerServiceFleetMgmtClientConfiguration +from .operations import ( + FleetMembersOperations, + FleetUpdateStrategiesOperations, + FleetsOperations, + Operations, + UpdateRunsOperations, +) if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports from azure.core.credentials_async import AsyncTokenCredential -class _SDKClient(object): - def __init__(self, *args, **kwargs): - """This is a fake class to support current implemetation of MultiApiClientMixin." - Will be removed in final version of multiapi azure-core based client - """ - pass -class ContainerServiceFleetMgmtClient(MultiApiClientMixin, _SDKClient): +class ContainerServiceFleetMgmtClient: # pylint: disable=client-accepts-api-version-keyword """Azure Kubernetes Fleet Manager api client. - This ready contains multiple API versions, to help you deal with all of the Azure clouds - (Azure Stack, Azure Government, Azure China, etc.). - By default, it uses the latest API version available on public Azure. - For production, you should stick to a particular api-version and/or profile. - The profile sets a mapping between an operation group and its API version. - The api-version parameter sets the default API version if the operation - group is not described in the profile. - + :ivar operations: Operations operations + :vartype operations: azure.mgmt.containerservicefleet.aio.operations.Operations + :ivar fleets: FleetsOperations operations + :vartype fleets: azure.mgmt.containerservicefleet.aio.operations.FleetsOperations + :ivar fleet_members: FleetMembersOperations operations + :vartype fleet_members: azure.mgmt.containerservicefleet.aio.operations.FleetMembersOperations + :ivar update_runs: UpdateRunsOperations operations + :vartype update_runs: azure.mgmt.containerservicefleet.aio.operations.UpdateRunsOperations + :ivar fleet_update_strategies: FleetUpdateStrategiesOperations operations + :vartype fleet_update_strategies: + azure.mgmt.containerservicefleet.aio.operations.FleetUpdateStrategiesOperations :param credential: Credential needed for the client to connect to Azure. Required. :type credential: ~azure.core.credentials_async.AsyncTokenCredential :param subscription_id: The ID of the target subscription. Required. :type subscription_id: str - :param api_version: API version to use if no profile is provided, or if missing in profile. - :type api_version: str - :param base_url: Service URL + :param base_url: Service URL. Default value is "https://management.azure.com". :type base_url: str - :param profile: A profile definition, from KnownProfiles to dict. - :type profile: azure.profiles.KnownProfiles - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no Retry-After header is present. + :keyword api_version: Api Version. Default value is "2024-04-01". Note that overriding this + default value may result in unsupported behavior. + :paramtype api_version: str + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no + Retry-After header is present. """ - DEFAULT_API_VERSION = '2024-04-01' - _PROFILE_TAG = "azure.mgmt.containerservicefleet.ContainerServiceFleetMgmtClient" - LATEST_PROFILE = ProfileDefinition({ - _PROFILE_TAG: { - None: DEFAULT_API_VERSION, - }}, - _PROFILE_TAG + " latest" - ) - def __init__( self, credential: "AsyncTokenCredential", subscription_id: str, - api_version: Optional[str] = None, base_url: str = "https://management.azure.com", - profile: KnownProfiles = KnownProfiles.default, **kwargs: Any ) -> None: - if api_version: - kwargs.setdefault('api_version', api_version) - self._config = ContainerServiceFleetMgmtClientConfiguration(credential, subscription_id, **kwargs) + self._config = ContainerServiceFleetMgmtClientConfiguration( + credential=credential, subscription_id=subscription_id, **kwargs + ) _policies = kwargs.pop("policies", None) if _policies is None: _policies = [ @@ -95,256 +86,50 @@ def __init__( policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, self._config.http_logging_policy, ] - self._client = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) - super(ContainerServiceFleetMgmtClient, self).__init__( - api_version=api_version, - profile=profile + self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) + + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} + self._serialize = Serializer(client_models) + self._deserialize = Deserializer(client_models) + self._serialize.client_side_validation = False + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) + self.fleets = FleetsOperations(self._client, self._config, self._serialize, self._deserialize) + self.fleet_members = FleetMembersOperations(self._client, self._config, self._serialize, self._deserialize) + self.update_runs = UpdateRunsOperations(self._client, self._config, self._serialize, self._deserialize) + self.fleet_update_strategies = FleetUpdateStrategiesOperations( + self._client, self._config, self._serialize, self._deserialize ) - @classmethod - def _models_dict(cls, api_version): - return {k: v for k, v in cls.models(api_version).__dict__.items() if isinstance(v, type)} - - @classmethod - def models(cls, api_version=DEFAULT_API_VERSION): - """Module depends on the API version: - - * 2022-09-02-preview: :mod:`v2022_06_02_preview.models` - * 2022-07-02-preview: :mod:`v2022_07_02_preview.models` - * 2022-06-02-preview: :mod:`v2022_09_02_preview.models` - * 2023-03-15-preview: :mod:`v2023_03_15_preview.models` - * 2023-06-15-preview: :mod:`v2023_06_15_preview.models` - * 2023-08-15-preview: :mod:`v2023_08_15_preview.models` - * 2023-10-15: :mod:`v2023_10_15.models` - * 2024-02-02-preview: :mod:`v2024_02_02_preview.models` - * 2024-04-01: :mod:`v2024_04_01.models` - * 2024-05-02-preview: :mod:`v2024_05_02_preview.models` - """ - if api_version == '2022-09-02-preview': - from ..v2022_06_02_preview import models - return models - elif api_version == '2022-07-02-preview': - from ..v2022_07_02_preview import models - return models - elif api_version == '2022-06-02-preview': - from ..v2022_09_02_preview import models - return models - elif api_version == '2023-03-15-preview': - from ..v2023_03_15_preview import models - return models - elif api_version == '2023-06-15-preview': - from ..v2023_06_15_preview import models - return models - elif api_version == '2023-08-15-preview': - from ..v2023_08_15_preview import models - return models - elif api_version == '2023-10-15': - from ..v2023_10_15 import models - return models - elif api_version == '2024-02-02-preview': - from ..v2024_02_02_preview import models - return models - elif api_version == '2024-04-01': - from ..v2024_04_01 import models - return models - elif api_version == '2024-05-02-preview': - from ..v2024_05_02_preview import models - return models - raise ValueError("API version {} is not available".format(api_version)) - - @property - def auto_upgrade_profiles(self): - """Instance depends on the API version: - - * 2024-05-02-preview: :class:`AutoUpgradeProfilesOperations` - """ - api_version = self._get_api_version('auto_upgrade_profiles') - if api_version == '2024-05-02-preview': - from ..v2024_05_02_preview.aio.operations import AutoUpgradeProfilesOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'auto_upgrade_profiles'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - - @property - def fleet_members(self): - """Instance depends on the API version: + def _send_request( + self, request: HttpRequest, *, stream: bool = False, **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: + """Runs the network request through the client's chained policies. - * 2022-09-02-preview: :class:`FleetMembersOperations` - * 2022-07-02-preview: :class:`FleetMembersOperations` - * 2022-06-02-preview: :class:`FleetMembersOperations` - * 2023-03-15-preview: :class:`FleetMembersOperations` - * 2023-06-15-preview: :class:`FleetMembersOperations` - * 2023-08-15-preview: :class:`FleetMembersOperations` - * 2023-10-15: :class:`FleetMembersOperations` - * 2024-02-02-preview: :class:`FleetMembersOperations` - * 2024-04-01: :class:`FleetMembersOperations` - * 2024-05-02-preview: :class:`FleetMembersOperations` - """ - api_version = self._get_api_version('fleet_members') - if api_version == '2022-09-02-preview': - from ..v2022_06_02_preview.aio.operations import FleetMembersOperations as OperationClass - elif api_version == '2022-07-02-preview': - from ..v2022_07_02_preview.aio.operations import FleetMembersOperations as OperationClass - elif api_version == '2022-06-02-preview': - from ..v2022_09_02_preview.aio.operations import FleetMembersOperations as OperationClass - elif api_version == '2023-03-15-preview': - from ..v2023_03_15_preview.aio.operations import FleetMembersOperations as OperationClass - elif api_version == '2023-06-15-preview': - from ..v2023_06_15_preview.aio.operations import FleetMembersOperations as OperationClass - elif api_version == '2023-08-15-preview': - from ..v2023_08_15_preview.aio.operations import FleetMembersOperations as OperationClass - elif api_version == '2023-10-15': - from ..v2023_10_15.aio.operations import FleetMembersOperations as OperationClass - elif api_version == '2024-02-02-preview': - from ..v2024_02_02_preview.aio.operations import FleetMembersOperations as OperationClass - elif api_version == '2024-04-01': - from ..v2024_04_01.aio.operations import FleetMembersOperations as OperationClass - elif api_version == '2024-05-02-preview': - from ..v2024_05_02_preview.aio.operations import FleetMembersOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'fleet_members'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - - @property - def fleet_update_strategies(self): - """Instance depends on the API version: - - * 2023-08-15-preview: :class:`FleetUpdateStrategiesOperations` - * 2023-10-15: :class:`FleetUpdateStrategiesOperations` - * 2024-02-02-preview: :class:`FleetUpdateStrategiesOperations` - * 2024-04-01: :class:`FleetUpdateStrategiesOperations` - * 2024-05-02-preview: :class:`FleetUpdateStrategiesOperations` - """ - api_version = self._get_api_version('fleet_update_strategies') - if api_version == '2023-08-15-preview': - from ..v2023_08_15_preview.aio.operations import FleetUpdateStrategiesOperations as OperationClass - elif api_version == '2023-10-15': - from ..v2023_10_15.aio.operations import FleetUpdateStrategiesOperations as OperationClass - elif api_version == '2024-02-02-preview': - from ..v2024_02_02_preview.aio.operations import FleetUpdateStrategiesOperations as OperationClass - elif api_version == '2024-04-01': - from ..v2024_04_01.aio.operations import FleetUpdateStrategiesOperations as OperationClass - elif api_version == '2024-05-02-preview': - from ..v2024_05_02_preview.aio.operations import FleetUpdateStrategiesOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'fleet_update_strategies'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) + >>> from azure.core.rest import HttpRequest + >>> request = HttpRequest("GET", "https://www.example.org/") + + >>> response = await client._send_request(request) + - @property - def fleets(self): - """Instance depends on the API version: + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - * 2022-09-02-preview: :class:`FleetsOperations` - * 2022-07-02-preview: :class:`FleetsOperations` - * 2022-06-02-preview: :class:`FleetsOperations` - * 2023-03-15-preview: :class:`FleetsOperations` - * 2023-06-15-preview: :class:`FleetsOperations` - * 2023-08-15-preview: :class:`FleetsOperations` - * 2023-10-15: :class:`FleetsOperations` - * 2024-02-02-preview: :class:`FleetsOperations` - * 2024-04-01: :class:`FleetsOperations` - * 2024-05-02-preview: :class:`FleetsOperations` + :param request: The network request you want to make. Required. + :type request: ~azure.core.rest.HttpRequest + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. + :return: The response of your network call. Does not do error handling on your response. + :rtype: ~azure.core.rest.AsyncHttpResponse """ - api_version = self._get_api_version('fleets') - if api_version == '2022-09-02-preview': - from ..v2022_06_02_preview.aio.operations import FleetsOperations as OperationClass - elif api_version == '2022-07-02-preview': - from ..v2022_07_02_preview.aio.operations import FleetsOperations as OperationClass - elif api_version == '2022-06-02-preview': - from ..v2022_09_02_preview.aio.operations import FleetsOperations as OperationClass - elif api_version == '2023-03-15-preview': - from ..v2023_03_15_preview.aio.operations import FleetsOperations as OperationClass - elif api_version == '2023-06-15-preview': - from ..v2023_06_15_preview.aio.operations import FleetsOperations as OperationClass - elif api_version == '2023-08-15-preview': - from ..v2023_08_15_preview.aio.operations import FleetsOperations as OperationClass - elif api_version == '2023-10-15': - from ..v2023_10_15.aio.operations import FleetsOperations as OperationClass - elif api_version == '2024-02-02-preview': - from ..v2024_02_02_preview.aio.operations import FleetsOperations as OperationClass - elif api_version == '2024-04-01': - from ..v2024_04_01.aio.operations import FleetsOperations as OperationClass - elif api_version == '2024-05-02-preview': - from ..v2024_05_02_preview.aio.operations import FleetsOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'fleets'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - - @property - def operations(self): - """Instance depends on the API version: - * 2022-09-02-preview: :class:`Operations` - * 2023-03-15-preview: :class:`Operations` - * 2023-06-15-preview: :class:`Operations` - * 2023-08-15-preview: :class:`Operations` - * 2023-10-15: :class:`Operations` - * 2024-02-02-preview: :class:`Operations` - * 2024-04-01: :class:`Operations` - * 2024-05-02-preview: :class:`Operations` - """ - api_version = self._get_api_version('operations') - if api_version == '2022-09-02-preview': - from ..v2022_06_02_preview.aio.operations import Operations as OperationClass - elif api_version == '2023-03-15-preview': - from ..v2023_03_15_preview.aio.operations import Operations as OperationClass - elif api_version == '2023-06-15-preview': - from ..v2023_06_15_preview.aio.operations import Operations as OperationClass - elif api_version == '2023-08-15-preview': - from ..v2023_08_15_preview.aio.operations import Operations as OperationClass - elif api_version == '2023-10-15': - from ..v2023_10_15.aio.operations import Operations as OperationClass - elif api_version == '2024-02-02-preview': - from ..v2024_02_02_preview.aio.operations import Operations as OperationClass - elif api_version == '2024-04-01': - from ..v2024_04_01.aio.operations import Operations as OperationClass - elif api_version == '2024-05-02-preview': - from ..v2024_05_02_preview.aio.operations import Operations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'operations'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) + request_copy = deepcopy(request) + request_copy.url = self._client.format_url(request_copy.url) + return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore - @property - def update_runs(self): - """Instance depends on the API version: - - * 2023-03-15-preview: :class:`UpdateRunsOperations` - * 2023-06-15-preview: :class:`UpdateRunsOperations` - * 2023-08-15-preview: :class:`UpdateRunsOperations` - * 2023-10-15: :class:`UpdateRunsOperations` - * 2024-02-02-preview: :class:`UpdateRunsOperations` - * 2024-04-01: :class:`UpdateRunsOperations` - * 2024-05-02-preview: :class:`UpdateRunsOperations` - """ - api_version = self._get_api_version('update_runs') - if api_version == '2023-03-15-preview': - from ..v2023_03_15_preview.aio.operations import UpdateRunsOperations as OperationClass - elif api_version == '2023-06-15-preview': - from ..v2023_06_15_preview.aio.operations import UpdateRunsOperations as OperationClass - elif api_version == '2023-08-15-preview': - from ..v2023_08_15_preview.aio.operations import UpdateRunsOperations as OperationClass - elif api_version == '2023-10-15': - from ..v2023_10_15.aio.operations import UpdateRunsOperations as OperationClass - elif api_version == '2024-02-02-preview': - from ..v2024_02_02_preview.aio.operations import UpdateRunsOperations as OperationClass - elif api_version == '2024-04-01': - from ..v2024_04_01.aio.operations import UpdateRunsOperations as OperationClass - elif api_version == '2024-05-02-preview': - from ..v2024_05_02_preview.aio.operations import UpdateRunsOperations as OperationClass - else: - raise ValueError("API version {} does not have operation group 'update_runs'".format(api_version)) - self._config.api_version = api_version - return OperationClass(self._client, self._config, Serializer(self._models_dict(api_version)), Deserializer(self._models_dict(api_version)), api_version) - - async def close(self): + async def close(self) -> None: await self._client.close() - async def __aenter__(self): + + async def __aenter__(self) -> Self: await self._client.__aenter__() return self - async def __aexit__(self, *exc_details): + + async def __aexit__(self, *exc_details: Any) -> None: await self._client.__aexit__(*exc_details) diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_06_02_preview/aio/_patch.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/aio/_patch.py similarity index 100% rename from sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_06_02_preview/aio/_patch.py rename to sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/aio/_patch.py diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/aio/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/aio/operations/__init__.py similarity index 100% rename from sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/aio/operations/__init__.py rename to sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/aio/operations/__init__.py diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_04_01/aio/operations/_fleet_members_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/aio/operations/_fleet_members_operations.py similarity index 95% rename from sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_04_01/aio/operations/_fleet_members_operations.py rename to sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/aio/operations/_fleet_members_operations.py index 0d08af0c14673..5d9adc5a9494e 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_04_01/aio/operations/_fleet_members_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/aio/operations/_fleet_members_operations.py @@ -54,7 +54,7 @@ class FleetMembersOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.containerservicefleet.v2024_04_01.aio.ContainerServiceFleetMgmtClient`'s + :class:`~azure.mgmt.containerservicefleet.aio.ContainerServiceFleetMgmtClient`'s :attr:`fleet_members` attribute. """ @@ -66,7 +66,6 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_fleet( @@ -81,13 +80,13 @@ def list_by_fleet( :type fleet_name: str :return: An iterator like instance of either FleetMember or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservicefleet.v2024_04_01.models.FleetMember] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservicefleet.models.FleetMember] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.FleetMemberListResult] = kwargs.pop("cls", None) error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -120,7 +119,7 @@ def prepare_request(next_link=None): for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() } ) - _next_request_params["api-version"] = self._api_version + _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) @@ -167,7 +166,7 @@ async def get( :param fleet_member_name: The name of the Fleet member resource. Required. :type fleet_member_name: str :return: FleetMember or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2024_04_01.models.FleetMember + :rtype: ~azure.mgmt.containerservicefleet.models.FleetMember :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -181,7 +180,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.FleetMember] = kwargs.pop("cls", None) _request = build_get_request( @@ -235,7 +234,7 @@ async def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) @@ -314,7 +313,7 @@ async def begin_create( :param fleet_member_name: The name of the Fleet member resource. Required. :type fleet_member_name: str :param resource: Resource create parameters. Required. - :type resource: ~azure.mgmt.containerservicefleet.v2024_04_01.models.FleetMember + :type resource: ~azure.mgmt.containerservicefleet.models.FleetMember :param if_match: The request should only proceed if an entity matches this string. Default value is None. :type if_match: str @@ -327,7 +326,7 @@ async def begin_create( :return: An instance of AsyncLROPoller that returns either FleetMember or the result of cls(response) :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2024_04_01.models.FleetMember] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.models.FleetMember] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -367,7 +366,7 @@ async def begin_create( :return: An instance of AsyncLROPoller that returns either FleetMember or the result of cls(response) :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2024_04_01.models.FleetMember] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.models.FleetMember] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -393,7 +392,7 @@ async def begin_create( :type fleet_member_name: str :param resource: Resource create parameters. Is either a FleetMember type or a IO[bytes] type. Required. - :type resource: ~azure.mgmt.containerservicefleet.v2024_04_01.models.FleetMember or IO[bytes] + :type resource: ~azure.mgmt.containerservicefleet.models.FleetMember or IO[bytes] :param if_match: The request should only proceed if an entity matches this string. Default value is None. :type if_match: str @@ -403,13 +402,13 @@ async def begin_create( :return: An instance of AsyncLROPoller that returns either FleetMember or the result of cls(response) :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2024_04_01.models.FleetMember] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.models.FleetMember] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.FleetMember] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -479,7 +478,7 @@ async def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) @@ -557,7 +556,7 @@ async def begin_update( :param fleet_member_name: The name of the Fleet member resource. Required. :type fleet_member_name: str :param properties: The resource properties to be updated. Required. - :type properties: ~azure.mgmt.containerservicefleet.v2024_04_01.models.FleetMemberUpdate + :type properties: ~azure.mgmt.containerservicefleet.models.FleetMemberUpdate :param if_match: The request should only proceed if an entity matches this string. Default value is None. :type if_match: str @@ -567,7 +566,7 @@ async def begin_update( :return: An instance of AsyncLROPoller that returns either FleetMember or the result of cls(response) :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2024_04_01.models.FleetMember] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.models.FleetMember] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -603,7 +602,7 @@ async def begin_update( :return: An instance of AsyncLROPoller that returns either FleetMember or the result of cls(response) :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2024_04_01.models.FleetMember] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.models.FleetMember] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -628,21 +627,20 @@ async def begin_update( :type fleet_member_name: str :param properties: The resource properties to be updated. Is either a FleetMemberUpdate type or a IO[bytes] type. Required. - :type properties: ~azure.mgmt.containerservicefleet.v2024_04_01.models.FleetMemberUpdate or - IO[bytes] + :type properties: ~azure.mgmt.containerservicefleet.models.FleetMemberUpdate or IO[bytes] :param if_match: The request should only proceed if an entity matches this string. Default value is None. :type if_match: str :return: An instance of AsyncLROPoller that returns either FleetMember or the result of cls(response) :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2024_04_01.models.FleetMember] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.models.FleetMember] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.FleetMember] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -710,7 +708,7 @@ async def _delete_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( @@ -782,7 +780,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_04_01/aio/operations/_fleet_update_strategies_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/aio/operations/_fleet_update_strategies_operations.py similarity index 95% rename from sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_04_01/aio/operations/_fleet_update_strategies_operations.py rename to sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/aio/operations/_fleet_update_strategies_operations.py index 26bf6bec1d513..3424d6929782a 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_04_01/aio/operations/_fleet_update_strategies_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/aio/operations/_fleet_update_strategies_operations.py @@ -53,7 +53,7 @@ class FleetUpdateStrategiesOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.containerservicefleet.v2024_04_01.aio.ContainerServiceFleetMgmtClient`'s + :class:`~azure.mgmt.containerservicefleet.aio.ContainerServiceFleetMgmtClient`'s :attr:`fleet_update_strategies` attribute. """ @@ -65,7 +65,6 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_fleet( @@ -80,13 +79,13 @@ def list_by_fleet( :type fleet_name: str :return: An iterator like instance of either FleetUpdateStrategy or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservicefleet.v2024_04_01.models.FleetUpdateStrategy] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservicefleet.models.FleetUpdateStrategy] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.FleetUpdateStrategyListResult] = kwargs.pop("cls", None) error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -119,7 +118,7 @@ def prepare_request(next_link=None): for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() } ) - _next_request_params["api-version"] = self._api_version + _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) @@ -166,7 +165,7 @@ async def get( :param update_strategy_name: The name of the UpdateStrategy resource. Required. :type update_strategy_name: str :return: FleetUpdateStrategy or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2024_04_01.models.FleetUpdateStrategy + :rtype: ~azure.mgmt.containerservicefleet.models.FleetUpdateStrategy :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -180,7 +179,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.FleetUpdateStrategy] = kwargs.pop("cls", None) _request = build_get_request( @@ -234,7 +233,7 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) @@ -313,7 +312,7 @@ async def begin_create_or_update( :param update_strategy_name: The name of the UpdateStrategy resource. Required. :type update_strategy_name: str :param resource: Resource create parameters. Required. - :type resource: ~azure.mgmt.containerservicefleet.v2024_04_01.models.FleetUpdateStrategy + :type resource: ~azure.mgmt.containerservicefleet.models.FleetUpdateStrategy :param if_match: The request should only proceed if an entity matches this string. Default value is None. :type if_match: str @@ -326,7 +325,7 @@ async def begin_create_or_update( :return: An instance of AsyncLROPoller that returns either FleetUpdateStrategy or the result of cls(response) :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2024_04_01.models.FleetUpdateStrategy] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.models.FleetUpdateStrategy] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -366,7 +365,7 @@ async def begin_create_or_update( :return: An instance of AsyncLROPoller that returns either FleetUpdateStrategy or the result of cls(response) :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2024_04_01.models.FleetUpdateStrategy] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.models.FleetUpdateStrategy] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -392,8 +391,7 @@ async def begin_create_or_update( :type update_strategy_name: str :param resource: Resource create parameters. Is either a FleetUpdateStrategy type or a IO[bytes] type. Required. - :type resource: ~azure.mgmt.containerservicefleet.v2024_04_01.models.FleetUpdateStrategy or - IO[bytes] + :type resource: ~azure.mgmt.containerservicefleet.models.FleetUpdateStrategy or IO[bytes] :param if_match: The request should only proceed if an entity matches this string. Default value is None. :type if_match: str @@ -403,13 +401,13 @@ async def begin_create_or_update( :return: An instance of AsyncLROPoller that returns either FleetUpdateStrategy or the result of cls(response) :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2024_04_01.models.FleetUpdateStrategy] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.models.FleetUpdateStrategy] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.FleetUpdateStrategy] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -478,7 +476,7 @@ async def _delete_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( @@ -550,7 +548,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_04_01/aio/operations/_fleets_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/aio/operations/_fleets_operations.py similarity index 94% rename from sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_04_01/aio/operations/_fleets_operations.py rename to sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/aio/operations/_fleets_operations.py index 290ff0c72294f..2e47da8c13dae 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_04_01/aio/operations/_fleets_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/aio/operations/_fleets_operations.py @@ -56,7 +56,7 @@ class FleetsOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.containerservicefleet.v2024_04_01.aio.ContainerServiceFleetMgmtClient`'s + :class:`~azure.mgmt.containerservicefleet.aio.ContainerServiceFleetMgmtClient`'s :attr:`fleets` attribute. """ @@ -68,21 +68,19 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.Fleet"]: """Lists fleets in the specified subscription. :return: An iterator like instance of either Fleet or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservicefleet.v2024_04_01.models.Fleet] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservicefleet.models.Fleet] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.FleetListResult] = kwargs.pop("cls", None) error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -113,7 +111,7 @@ def prepare_request(next_link=None): for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() } ) - _next_request_params["api-version"] = self._api_version + _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) @@ -154,14 +152,13 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Asy Required. :type resource_group_name: str :return: An iterator like instance of either Fleet or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservicefleet.v2024_04_01.models.Fleet] + :rtype: ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservicefleet.models.Fleet] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.FleetListResult] = kwargs.pop("cls", None) error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -193,7 +190,7 @@ def prepare_request(next_link=None): for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() } ) - _next_request_params["api-version"] = self._api_version + _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) @@ -236,7 +233,7 @@ async def get(self, resource_group_name: str, fleet_name: str, **kwargs: Any) -> :param fleet_name: The name of the Fleet resource. Required. :type fleet_name: str :return: Fleet or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2024_04_01.models.Fleet + :rtype: ~azure.mgmt.containerservicefleet.models.Fleet :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -250,7 +247,7 @@ async def get(self, resource_group_name: str, fleet_name: str, **kwargs: Any) -> _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Fleet] = kwargs.pop("cls", None) _request = build_get_request( @@ -302,7 +299,7 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) @@ -377,7 +374,7 @@ async def begin_create_or_update( :param fleet_name: The name of the Fleet resource. Required. :type fleet_name: str :param resource: Resource create parameters. Required. - :type resource: ~azure.mgmt.containerservicefleet.v2024_04_01.models.Fleet + :type resource: ~azure.mgmt.containerservicefleet.models.Fleet :param if_match: The request should only proceed if an entity matches this string. Default value is None. :type if_match: str @@ -388,8 +385,7 @@ async def begin_create_or_update( Default value is "application/json". :paramtype content_type: str :return: An instance of AsyncLROPoller that returns either Fleet or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2024_04_01.models.Fleet] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.models.Fleet] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -424,8 +420,7 @@ async def begin_create_or_update( Default value is "application/json". :paramtype content_type: str :return: An instance of AsyncLROPoller that returns either Fleet or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2024_04_01.models.Fleet] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.models.Fleet] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -448,7 +443,7 @@ async def begin_create_or_update( :type fleet_name: str :param resource: Resource create parameters. Is either a Fleet type or a IO[bytes] type. Required. - :type resource: ~azure.mgmt.containerservicefleet.v2024_04_01.models.Fleet or IO[bytes] + :type resource: ~azure.mgmt.containerservicefleet.models.Fleet or IO[bytes] :param if_match: The request should only proceed if an entity matches this string. Default value is None. :type if_match: str @@ -456,14 +451,13 @@ async def begin_create_or_update( value is None. :type if_none_match: str :return: An instance of AsyncLROPoller that returns either Fleet or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2024_04_01.models.Fleet] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.models.Fleet] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Fleet] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -531,7 +525,7 @@ async def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) @@ -605,7 +599,7 @@ async def begin_update( :param fleet_name: The name of the Fleet resource. Required. :type fleet_name: str :param properties: The resource properties to be updated. Required. - :type properties: ~azure.mgmt.containerservicefleet.v2024_04_01.models.FleetPatch + :type properties: ~azure.mgmt.containerservicefleet.models.FleetPatch :param if_match: The request should only proceed if an entity matches this string. Default value is None. :type if_match: str @@ -613,8 +607,7 @@ async def begin_update( Default value is "application/json". :paramtype content_type: str :return: An instance of AsyncLROPoller that returns either Fleet or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2024_04_01.models.Fleet] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.models.Fleet] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -645,8 +638,7 @@ async def begin_update( Default value is "application/json". :paramtype content_type: str :return: An instance of AsyncLROPoller that returns either Fleet or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2024_04_01.models.Fleet] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.models.Fleet] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -668,19 +660,18 @@ async def begin_update( :type fleet_name: str :param properties: The resource properties to be updated. Is either a FleetPatch type or a IO[bytes] type. Required. - :type properties: ~azure.mgmt.containerservicefleet.v2024_04_01.models.FleetPatch or IO[bytes] + :type properties: ~azure.mgmt.containerservicefleet.models.FleetPatch or IO[bytes] :param if_match: The request should only proceed if an entity matches this string. Default value is None. :type if_match: str :return: An instance of AsyncLROPoller that returns either Fleet or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2024_04_01.models.Fleet] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.models.Fleet] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Fleet] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -742,7 +733,7 @@ async def _delete_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( @@ -806,7 +797,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -858,7 +849,7 @@ async def list_credentials( :param fleet_name: The name of the Fleet resource. Required. :type fleet_name: str :return: FleetCredentialResults or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2024_04_01.models.FleetCredentialResults + :rtype: ~azure.mgmt.containerservicefleet.models.FleetCredentialResults :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -872,7 +863,7 @@ async def list_credentials( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.FleetCredentialResults] = kwargs.pop("cls", None) _request = build_list_credentials_request( diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/aio/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/aio/operations/_operations.py similarity index 93% rename from sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/aio/operations/_operations.py rename to sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/aio/operations/_operations.py index cf43908968f79..8cb105f2dec3e 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/aio/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/aio/operations/_operations.py @@ -42,7 +42,7 @@ class Operations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.containerservicefleet.v2023_10_15.aio.ContainerServiceFleetMgmtClient`'s + :class:`~azure.mgmt.containerservicefleet.aio.ContainerServiceFleetMgmtClient`'s :attr:`operations` attribute. """ @@ -54,7 +54,6 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: @@ -62,13 +61,13 @@ def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: :return: An iterator like instance of either Operation or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservicefleet.v2023_10_15.models.Operation] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservicefleet.models.Operation] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-10-15")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -98,7 +97,7 @@ def prepare_request(next_link=None): for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() } ) - _next_request_params["api-version"] = self._api_version + _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_06_02_preview/aio/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/aio/operations/_patch.py similarity index 100% rename from sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_06_02_preview/aio/operations/_patch.py rename to sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/aio/operations/_patch.py diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_04_01/aio/operations/_update_runs_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/aio/operations/_update_runs_operations.py similarity index 95% rename from sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_04_01/aio/operations/_update_runs_operations.py rename to sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/aio/operations/_update_runs_operations.py index cd6c7d8583709..c7aa6da1c8bab 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_04_01/aio/operations/_update_runs_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/aio/operations/_update_runs_operations.py @@ -56,7 +56,7 @@ class UpdateRunsOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.containerservicefleet.v2024_04_01.aio.ContainerServiceFleetMgmtClient`'s + :class:`~azure.mgmt.containerservicefleet.aio.ContainerServiceFleetMgmtClient`'s :attr:`update_runs` attribute. """ @@ -68,7 +68,6 @@ def __init__(self, *args, **kwargs) -> None: self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_fleet( @@ -83,13 +82,13 @@ def list_by_fleet( :type fleet_name: str :return: An iterator like instance of either UpdateRun or the result of cls(response) :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservicefleet.v2024_04_01.models.UpdateRun] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservicefleet.models.UpdateRun] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.UpdateRunListResult] = kwargs.pop("cls", None) error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -122,7 +121,7 @@ def prepare_request(next_link=None): for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() } ) - _next_request_params["api-version"] = self._api_version + _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) @@ -169,7 +168,7 @@ async def get( :param update_run_name: The name of the UpdateRun resource. Required. :type update_run_name: str :return: UpdateRun or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2024_04_01.models.UpdateRun + :rtype: ~azure.mgmt.containerservicefleet.models.UpdateRun :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -183,7 +182,7 @@ async def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.UpdateRun] = kwargs.pop("cls", None) _request = build_get_request( @@ -237,7 +236,7 @@ async def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) @@ -316,7 +315,7 @@ async def begin_create_or_update( :param update_run_name: The name of the UpdateRun resource. Required. :type update_run_name: str :param resource: Resource create parameters. Required. - :type resource: ~azure.mgmt.containerservicefleet.v2024_04_01.models.UpdateRun + :type resource: ~azure.mgmt.containerservicefleet.models.UpdateRun :param if_match: The request should only proceed if an entity matches this string. Default value is None. :type if_match: str @@ -328,8 +327,7 @@ async def begin_create_or_update( :paramtype content_type: str :return: An instance of AsyncLROPoller that returns either UpdateRun or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2024_04_01.models.UpdateRun] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.models.UpdateRun] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -368,8 +366,7 @@ async def begin_create_or_update( :paramtype content_type: str :return: An instance of AsyncLROPoller that returns either UpdateRun or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2024_04_01.models.UpdateRun] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.models.UpdateRun] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -395,7 +392,7 @@ async def begin_create_or_update( :type update_run_name: str :param resource: Resource create parameters. Is either a UpdateRun type or a IO[bytes] type. Required. - :type resource: ~azure.mgmt.containerservicefleet.v2024_04_01.models.UpdateRun or IO[bytes] + :type resource: ~azure.mgmt.containerservicefleet.models.UpdateRun or IO[bytes] :param if_match: The request should only proceed if an entity matches this string. Default value is None. :type if_match: str @@ -404,14 +401,13 @@ async def begin_create_or_update( :type if_none_match: str :return: An instance of AsyncLROPoller that returns either UpdateRun or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2024_04_01.models.UpdateRun] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.models.UpdateRun] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.UpdateRun] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -480,7 +476,7 @@ async def _delete_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( @@ -552,7 +548,7 @@ async def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -613,7 +609,7 @@ async def _skip_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) @@ -691,7 +687,7 @@ async def begin_skip( :param update_run_name: The name of the UpdateRun resource. Required. :type update_run_name: str :param body: The content of the action request. Required. - :type body: ~azure.mgmt.containerservicefleet.v2024_04_01.models.SkipProperties + :type body: ~azure.mgmt.containerservicefleet.models.SkipProperties :param if_match: The request should only proceed if an entity matches this string. Default value is None. :type if_match: str @@ -700,8 +696,7 @@ async def begin_skip( :paramtype content_type: str :return: An instance of AsyncLROPoller that returns either UpdateRun or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2024_04_01.models.UpdateRun] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.models.UpdateRun] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -736,8 +731,7 @@ async def begin_skip( :paramtype content_type: str :return: An instance of AsyncLROPoller that returns either UpdateRun or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2024_04_01.models.UpdateRun] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.models.UpdateRun] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -762,20 +756,19 @@ async def begin_skip( :type update_run_name: str :param body: The content of the action request. Is either a SkipProperties type or a IO[bytes] type. Required. - :type body: ~azure.mgmt.containerservicefleet.v2024_04_01.models.SkipProperties or IO[bytes] + :type body: ~azure.mgmt.containerservicefleet.models.SkipProperties or IO[bytes] :param if_match: The request should only proceed if an entity matches this string. Default value is None. :type if_match: str :return: An instance of AsyncLROPoller that returns either UpdateRun or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2024_04_01.models.UpdateRun] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.models.UpdateRun] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.UpdateRun] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -842,7 +835,7 @@ async def _start_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_start_request( @@ -909,14 +902,13 @@ async def begin_start( :type if_match: str :return: An instance of AsyncLROPoller that returns either UpdateRun or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2024_04_01.models.UpdateRun] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.models.UpdateRun] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.UpdateRun] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -980,7 +972,7 @@ async def _stop_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) _request = build_stop_request( @@ -1047,14 +1039,13 @@ async def begin_stop( :type if_match: str :return: An instance of AsyncLROPoller that returns either UpdateRun or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2024_04_01.models.UpdateRun] + :rtype: ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.models.UpdateRun] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.UpdateRun] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/models.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/models.py deleted file mode 100644 index 3e8a887745e1c..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/models.py +++ /dev/null @@ -1,7 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for -# license information. -# -------------------------------------------------------------------------- -from .v2024_04_01.models import * diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/models/__init__.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/models/__init__.py similarity index 100% rename from sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/models/__init__.py rename to sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/models/__init__.py diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/models/_container_service_fleet_mgmt_client_enums.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/models/_container_service_fleet_mgmt_client_enums.py similarity index 100% rename from sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/models/_container_service_fleet_mgmt_client_enums.py rename to sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/models/_container_service_fleet_mgmt_client_enums.py diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_04_01/models/_models_py3.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/models/_models_py3.py similarity index 89% rename from sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_04_01/models/_models_py3.py rename to sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/models/_models_py3.py index bf8d5afc8f758..ce067530b79f3 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_04_01/models/_models_py3.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/models/_models_py3.py @@ -10,7 +10,7 @@ import datetime from typing import Any, Dict, List, Optional, TYPE_CHECKING, Union -from ... import _serialization +from .. import _serialization if TYPE_CHECKING: # pylint: disable=unused-import,ungrouped-imports @@ -105,10 +105,9 @@ class ErrorDetail(_serialization.Model): :ivar target: The error target. :vartype target: str :ivar details: The error details. - :vartype details: list[~azure.mgmt.containerservicefleet.v2024_04_01.models.ErrorDetail] + :vartype details: list[~azure.mgmt.containerservicefleet.models.ErrorDetail] :ivar additional_info: The error additional info. - :vartype additional_info: - list[~azure.mgmt.containerservicefleet.v2024_04_01.models.ErrorAdditionalInfo] + :vartype additional_info: list[~azure.mgmt.containerservicefleet.models.ErrorAdditionalInfo] """ _validation = { @@ -142,7 +141,7 @@ class ErrorResponse(_serialization.Model): operations. (This also follows the OData error response format.). :ivar error: The error object. - :vartype error: ~azure.mgmt.containerservicefleet.v2024_04_01.models.ErrorDetail + :vartype error: ~azure.mgmt.containerservicefleet.models.ErrorDetail """ _attribute_map = { @@ -152,7 +151,7 @@ class ErrorResponse(_serialization.Model): def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: Any) -> None: """ :keyword error: The error object. - :paramtype error: ~azure.mgmt.containerservicefleet.v2024_04_01.models.ErrorDetail + :paramtype error: ~azure.mgmt.containerservicefleet.models.ErrorDetail """ super().__init__(**kwargs) self.error = error @@ -173,7 +172,7 @@ class Resource(_serialization.Model): :vartype type: str :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. - :vartype system_data: ~azure.mgmt.containerservicefleet.v2024_04_01.models.SystemData + :vartype system_data: ~azure.mgmt.containerservicefleet.models.SystemData """ _validation = { @@ -217,7 +216,7 @@ class TrackedResource(Resource): :vartype type: str :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. - :vartype system_data: ~azure.mgmt.containerservicefleet.v2024_04_01.models.SystemData + :vartype system_data: ~azure.mgmt.containerservicefleet.models.SystemData :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar location: The geo-location where the resource lives. Required. @@ -270,7 +269,7 @@ class Fleet(TrackedResource): :vartype type: str :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. - :vartype system_data: ~azure.mgmt.containerservicefleet.v2024_04_01.models.SystemData + :vartype system_data: ~azure.mgmt.containerservicefleet.models.SystemData :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar location: The geo-location where the resource lives. Required. @@ -281,13 +280,13 @@ class Fleet(TrackedResource): (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. :vartype e_tag: str :ivar identity: Managed identity. - :vartype identity: ~azure.mgmt.containerservicefleet.v2024_04_01.models.ManagedServiceIdentity + :vartype identity: ~azure.mgmt.containerservicefleet.models.ManagedServiceIdentity :ivar provisioning_state: The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Creating", "Updating", and "Deleting". :vartype provisioning_state: str or - ~azure.mgmt.containerservicefleet.v2024_04_01.models.FleetProvisioningState + ~azure.mgmt.containerservicefleet.models.FleetProvisioningState :ivar hub_profile: The FleetHubProfile configures the Fleet's hub. - :vartype hub_profile: ~azure.mgmt.containerservicefleet.v2024_04_01.models.FleetHubProfile + :vartype hub_profile: ~azure.mgmt.containerservicefleet.models.FleetHubProfile """ _validation = { @@ -328,10 +327,9 @@ def __init__( :keyword location: The geo-location where the resource lives. Required. :paramtype location: str :keyword identity: Managed identity. - :paramtype identity: - ~azure.mgmt.containerservicefleet.v2024_04_01.models.ManagedServiceIdentity + :paramtype identity: ~azure.mgmt.containerservicefleet.models.ManagedServiceIdentity :keyword hub_profile: The FleetHubProfile configures the Fleet's hub. - :paramtype hub_profile: ~azure.mgmt.containerservicefleet.v2024_04_01.models.FleetHubProfile + :paramtype hub_profile: ~azure.mgmt.containerservicefleet.models.FleetHubProfile """ super().__init__(tags=tags, location=location, **kwargs) self.e_tag = None @@ -374,8 +372,7 @@ class FleetCredentialResults(_serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :ivar kubeconfigs: Array of base64-encoded Kubernetes configuration files. - :vartype kubeconfigs: - list[~azure.mgmt.containerservicefleet.v2024_04_01.models.FleetCredentialResult] + :vartype kubeconfigs: list[~azure.mgmt.containerservicefleet.models.FleetCredentialResult] """ _validation = { @@ -401,9 +398,9 @@ class FleetHubProfile(_serialization.Model): :vartype dns_prefix: str :ivar api_server_access_profile: The access profile for the Fleet hub API server. :vartype api_server_access_profile: - ~azure.mgmt.containerservicefleet.v2024_04_01.models.APIServerAccessProfile + ~azure.mgmt.containerservicefleet.models.APIServerAccessProfile :ivar agent_profile: The agent profile for the Fleet hub. - :vartype agent_profile: ~azure.mgmt.containerservicefleet.v2024_04_01.models.AgentProfile + :vartype agent_profile: ~azure.mgmt.containerservicefleet.models.AgentProfile :ivar fqdn: The FQDN of the Fleet hub. :vartype fqdn: str :ivar kubernetes_version: The Kubernetes version of the Fleet hub. @@ -445,9 +442,9 @@ def __init__( :paramtype dns_prefix: str :keyword api_server_access_profile: The access profile for the Fleet hub API server. :paramtype api_server_access_profile: - ~azure.mgmt.containerservicefleet.v2024_04_01.models.APIServerAccessProfile + ~azure.mgmt.containerservicefleet.models.APIServerAccessProfile :keyword agent_profile: The agent profile for the Fleet hub. - :paramtype agent_profile: ~azure.mgmt.containerservicefleet.v2024_04_01.models.AgentProfile + :paramtype agent_profile: ~azure.mgmt.containerservicefleet.models.AgentProfile """ super().__init__(**kwargs) self.dns_prefix = dns_prefix @@ -464,7 +461,7 @@ class FleetListResult(_serialization.Model): All required parameters must be populated in order to send to server. :ivar value: The Fleet items on this page. Required. - :vartype value: list[~azure.mgmt.containerservicefleet.v2024_04_01.models.Fleet] + :vartype value: list[~azure.mgmt.containerservicefleet.models.Fleet] :ivar next_link: The link to the next page of items. :vartype next_link: str """ @@ -481,7 +478,7 @@ class FleetListResult(_serialization.Model): def __init__(self, *, value: List["_models.Fleet"], next_link: Optional[str] = None, **kwargs: Any) -> None: """ :keyword value: The Fleet items on this page. Required. - :paramtype value: list[~azure.mgmt.containerservicefleet.v2024_04_01.models.Fleet] + :paramtype value: list[~azure.mgmt.containerservicefleet.models.Fleet] :keyword next_link: The link to the next page of items. :paramtype next_link: str """ @@ -506,7 +503,7 @@ class ProxyResource(Resource): :vartype type: str :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. - :vartype system_data: ~azure.mgmt.containerservicefleet.v2024_04_01.models.SystemData + :vartype system_data: ~azure.mgmt.containerservicefleet.models.SystemData """ @@ -525,7 +522,7 @@ class FleetMember(ProxyResource): :vartype type: str :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. - :vartype system_data: ~azure.mgmt.containerservicefleet.v2024_04_01.models.SystemData + :vartype system_data: ~azure.mgmt.containerservicefleet.models.SystemData :ivar e_tag: If eTag is provided in the response body, it may also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match @@ -540,7 +537,7 @@ class FleetMember(ProxyResource): :ivar provisioning_state: The status of the last operation. Known values are: "Succeeded", "Failed", "Canceled", "Joining", "Leaving", and "Updating". :vartype provisioning_state: str or - ~azure.mgmt.containerservicefleet.v2024_04_01.models.FleetMemberProvisioningState + ~azure.mgmt.containerservicefleet.models.FleetMemberProvisioningState """ _validation = { @@ -588,7 +585,7 @@ class FleetMemberListResult(_serialization.Model): All required parameters must be populated in order to send to server. :ivar value: The FleetMember items on this page. Required. - :vartype value: list[~azure.mgmt.containerservicefleet.v2024_04_01.models.FleetMember] + :vartype value: list[~azure.mgmt.containerservicefleet.models.FleetMember] :ivar next_link: The link to the next page of items. :vartype next_link: str """ @@ -605,7 +602,7 @@ class FleetMemberListResult(_serialization.Model): def __init__(self, *, value: List["_models.FleetMember"], next_link: Optional[str] = None, **kwargs: Any) -> None: """ :keyword value: The FleetMember items on this page. Required. - :paramtype value: list[~azure.mgmt.containerservicefleet.v2024_04_01.models.FleetMember] + :paramtype value: list[~azure.mgmt.containerservicefleet.models.FleetMember] :keyword next_link: The link to the next page of items. :paramtype next_link: str """ @@ -644,7 +641,7 @@ class FleetPatch(_serialization.Model): :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar identity: Managed identity. - :vartype identity: ~azure.mgmt.containerservicefleet.v2024_04_01.models.ManagedServiceIdentity + :vartype identity: ~azure.mgmt.containerservicefleet.models.ManagedServiceIdentity """ _attribute_map = { @@ -663,8 +660,7 @@ def __init__( :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword identity: Managed identity. - :paramtype identity: - ~azure.mgmt.containerservicefleet.v2024_04_01.models.ManagedServiceIdentity + :paramtype identity: ~azure.mgmt.containerservicefleet.models.ManagedServiceIdentity """ super().__init__(**kwargs) self.tags = tags @@ -686,7 +682,7 @@ class FleetUpdateStrategy(ProxyResource): :vartype type: str :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. - :vartype system_data: ~azure.mgmt.containerservicefleet.v2024_04_01.models.SystemData + :vartype system_data: ~azure.mgmt.containerservicefleet.models.SystemData :ivar e_tag: If eTag is provided in the response body, it may also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match @@ -695,9 +691,9 @@ class FleetUpdateStrategy(ProxyResource): :ivar provisioning_state: The provisioning state of the UpdateStrategy resource. Known values are: "Succeeded", "Failed", and "Canceled". :vartype provisioning_state: str or - ~azure.mgmt.containerservicefleet.v2024_04_01.models.FleetUpdateStrategyProvisioningState + ~azure.mgmt.containerservicefleet.models.FleetUpdateStrategyProvisioningState :ivar strategy: Defines the update sequence of the clusters. - :vartype strategy: ~azure.mgmt.containerservicefleet.v2024_04_01.models.UpdateRunStrategy + :vartype strategy: ~azure.mgmt.containerservicefleet.models.UpdateRunStrategy """ _validation = { @@ -722,7 +718,7 @@ class FleetUpdateStrategy(ProxyResource): def __init__(self, *, strategy: Optional["_models.UpdateRunStrategy"] = None, **kwargs: Any) -> None: """ :keyword strategy: Defines the update sequence of the clusters. - :paramtype strategy: ~azure.mgmt.containerservicefleet.v2024_04_01.models.UpdateRunStrategy + :paramtype strategy: ~azure.mgmt.containerservicefleet.models.UpdateRunStrategy """ super().__init__(**kwargs) self.e_tag = None @@ -736,7 +732,7 @@ class FleetUpdateStrategyListResult(_serialization.Model): All required parameters must be populated in order to send to server. :ivar value: The FleetUpdateStrategy items on this page. Required. - :vartype value: list[~azure.mgmt.containerservicefleet.v2024_04_01.models.FleetUpdateStrategy] + :vartype value: list[~azure.mgmt.containerservicefleet.models.FleetUpdateStrategy] :ivar next_link: The link to the next page of items. :vartype next_link: str """ @@ -755,8 +751,7 @@ def __init__( ) -> None: """ :keyword value: The FleetUpdateStrategy items on this page. Required. - :paramtype value: - list[~azure.mgmt.containerservicefleet.v2024_04_01.models.FleetUpdateStrategy] + :paramtype value: list[~azure.mgmt.containerservicefleet.models.FleetUpdateStrategy] :keyword next_link: The link to the next page of items. :paramtype next_link: str """ @@ -771,12 +766,10 @@ class ManagedClusterUpdate(_serialization.Model): All required parameters must be populated in order to send to server. :ivar upgrade: The upgrade to apply to the ManagedClusters. Required. - :vartype upgrade: - ~azure.mgmt.containerservicefleet.v2024_04_01.models.ManagedClusterUpgradeSpec + :vartype upgrade: ~azure.mgmt.containerservicefleet.models.ManagedClusterUpgradeSpec :ivar node_image_selection: The node image upgrade to be applied to the target nodes in update run. - :vartype node_image_selection: - ~azure.mgmt.containerservicefleet.v2024_04_01.models.NodeImageSelection + :vartype node_image_selection: ~azure.mgmt.containerservicefleet.models.NodeImageSelection """ _validation = { @@ -797,12 +790,10 @@ def __init__( ) -> None: """ :keyword upgrade: The upgrade to apply to the ManagedClusters. Required. - :paramtype upgrade: - ~azure.mgmt.containerservicefleet.v2024_04_01.models.ManagedClusterUpgradeSpec + :paramtype upgrade: ~azure.mgmt.containerservicefleet.models.ManagedClusterUpgradeSpec :keyword node_image_selection: The node image upgrade to be applied to the target nodes in update run. - :paramtype node_image_selection: - ~azure.mgmt.containerservicefleet.v2024_04_01.models.NodeImageSelection + :paramtype node_image_selection: ~azure.mgmt.containerservicefleet.models.NodeImageSelection """ super().__init__(**kwargs) self.upgrade = upgrade @@ -816,8 +807,7 @@ class ManagedClusterUpgradeSpec(_serialization.Model): :ivar type: ManagedClusterUpgradeType is the type of upgrade to be applied. Required. Known values are: "Full", "NodeImageOnly", and "ControlPlaneOnly". - :vartype type: str or - ~azure.mgmt.containerservicefleet.v2024_04_01.models.ManagedClusterUpgradeType + :vartype type: str or ~azure.mgmt.containerservicefleet.models.ManagedClusterUpgradeType :ivar kubernetes_version: The Kubernetes version to upgrade the member clusters to. :vartype kubernetes_version: str """ @@ -841,8 +831,7 @@ def __init__( """ :keyword type: ManagedClusterUpgradeType is the type of upgrade to be applied. Required. Known values are: "Full", "NodeImageOnly", and "ControlPlaneOnly". - :paramtype type: str or - ~azure.mgmt.containerservicefleet.v2024_04_01.models.ManagedClusterUpgradeType + :paramtype type: str or ~azure.mgmt.containerservicefleet.models.ManagedClusterUpgradeType :keyword kubernetes_version: The Kubernetes version to upgrade the member clusters to. :paramtype kubernetes_version: str """ @@ -867,14 +856,13 @@ class ManagedServiceIdentity(_serialization.Model): :ivar type: Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). Required. Known values are: "None", "SystemAssigned", "UserAssigned", and "SystemAssigned, UserAssigned". - :vartype type: str or - ~azure.mgmt.containerservicefleet.v2024_04_01.models.ManagedServiceIdentityType + :vartype type: str or ~azure.mgmt.containerservicefleet.models.ManagedServiceIdentityType :ivar user_assigned_identities: The set of user assigned identities associated with the resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. # pylint: disable=line-too-long The dictionary values can be empty objects ({}) in requests. :vartype user_assigned_identities: dict[str, - ~azure.mgmt.containerservicefleet.v2024_04_01.models.UserAssignedIdentity] + ~azure.mgmt.containerservicefleet.models.UserAssignedIdentity] """ _validation = { @@ -901,14 +889,13 @@ def __init__( :keyword type: Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). Required. Known values are: "None", "SystemAssigned", "UserAssigned", and "SystemAssigned, UserAssigned". - :paramtype type: str or - ~azure.mgmt.containerservicefleet.v2024_04_01.models.ManagedServiceIdentityType + :paramtype type: str or ~azure.mgmt.containerservicefleet.models.ManagedServiceIdentityType :keyword user_assigned_identities: The set of user assigned identities associated with the resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. # pylint: disable=line-too-long The dictionary values can be empty objects ({}) in requests. :paramtype user_assigned_identities: dict[str, - ~azure.mgmt.containerservicefleet.v2024_04_01.models.UserAssignedIdentity] + ~azure.mgmt.containerservicefleet.models.UserAssignedIdentity] """ super().__init__(**kwargs) self.principal_id = None @@ -923,7 +910,7 @@ class MemberUpdateStatus(_serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :ivar status: The status of the MemberUpdate operation. - :vartype status: ~azure.mgmt.containerservicefleet.v2024_04_01.models.UpdateStatus + :vartype status: ~azure.mgmt.containerservicefleet.models.UpdateStatus :ivar name: The name of the FleetMember. :vartype name: str :ivar cluster_resource_id: The Azure resource id of the target Kubernetes cluster. @@ -966,8 +953,7 @@ class NodeImageSelection(_serialization.Model): All required parameters must be populated in order to send to server. :ivar type: The node image upgrade type. Required. Known values are: "Latest" and "Consistent". - :vartype type: str or - ~azure.mgmt.containerservicefleet.v2024_04_01.models.NodeImageSelectionType + :vartype type: str or ~azure.mgmt.containerservicefleet.models.NodeImageSelectionType """ _validation = { @@ -982,8 +968,7 @@ def __init__(self, *, type: Union[str, "_models.NodeImageSelectionType"], **kwar """ :keyword type: The node image upgrade type. Required. Known values are: "Latest" and "Consistent". - :paramtype type: str or - ~azure.mgmt.containerservicefleet.v2024_04_01.models.NodeImageSelectionType + :paramtype type: str or ~azure.mgmt.containerservicefleet.models.NodeImageSelectionType """ super().__init__(**kwargs) self.type = type @@ -996,7 +981,7 @@ class NodeImageSelectionStatus(_serialization.Model): :ivar selected_node_image_versions: The image versions to upgrade the nodes to. :vartype selected_node_image_versions: - list[~azure.mgmt.containerservicefleet.v2024_04_01.models.NodeImageVersion] + list[~azure.mgmt.containerservicefleet.models.NodeImageVersion] """ _validation = { @@ -1049,14 +1034,14 @@ class Operation(_serialization.Model): data-plane operations and "false" for ARM/control-plane operations. :vartype is_data_action: bool :ivar display: Localized display information for this particular operation. - :vartype display: ~azure.mgmt.containerservicefleet.v2024_04_01.models.OperationDisplay + :vartype display: ~azure.mgmt.containerservicefleet.models.OperationDisplay :ivar origin: The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default value is "user,system". Known values are: "user", "system", and "user,system". - :vartype origin: str or ~azure.mgmt.containerservicefleet.v2024_04_01.models.Origin + :vartype origin: str or ~azure.mgmt.containerservicefleet.models.Origin :ivar action_type: Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. "Internal" - :vartype action_type: str or ~azure.mgmt.containerservicefleet.v2024_04_01.models.ActionType + :vartype action_type: str or ~azure.mgmt.containerservicefleet.models.ActionType """ _validation = { @@ -1077,7 +1062,7 @@ class Operation(_serialization.Model): def __init__(self, *, display: Optional["_models.OperationDisplay"] = None, **kwargs: Any) -> None: """ :keyword display: Localized display information for this particular operation. - :paramtype display: ~azure.mgmt.containerservicefleet.v2024_04_01.models.OperationDisplay + :paramtype display: ~azure.mgmt.containerservicefleet.models.OperationDisplay """ super().__init__(**kwargs) self.name = None @@ -1136,7 +1121,7 @@ class OperationListResult(_serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :ivar value: List of operations supported by the resource provider. - :vartype value: list[~azure.mgmt.containerservicefleet.v2024_04_01.models.Operation] + :vartype value: list[~azure.mgmt.containerservicefleet.models.Operation] :ivar next_link: URL to get the next set of operation list results (if there are any). :vartype next_link: str """ @@ -1164,7 +1149,7 @@ class SkipProperties(_serialization.Model): All required parameters must be populated in order to send to server. :ivar targets: The targets to skip. Required. - :vartype targets: list[~azure.mgmt.containerservicefleet.v2024_04_01.models.SkipTarget] + :vartype targets: list[~azure.mgmt.containerservicefleet.models.SkipTarget] """ _validation = { @@ -1178,7 +1163,7 @@ class SkipProperties(_serialization.Model): def __init__(self, *, targets: List["_models.SkipTarget"], **kwargs: Any) -> None: """ :keyword targets: The targets to skip. Required. - :paramtype targets: list[~azure.mgmt.containerservicefleet.v2024_04_01.models.SkipTarget] + :paramtype targets: list[~azure.mgmt.containerservicefleet.models.SkipTarget] """ super().__init__(**kwargs) self.targets = targets @@ -1191,7 +1176,7 @@ class SkipTarget(_serialization.Model): :ivar type: The skip target type. Required. Known values are: "Member", "Group", "Stage", and "AfterStageWait". - :vartype type: str or ~azure.mgmt.containerservicefleet.v2024_04_01.models.TargetType + :vartype type: str or ~azure.mgmt.containerservicefleet.models.TargetType :ivar name: The skip target's name. To skip a member/group/stage, use the member/group/stage's name; Tp skip an after stage wait, use the parent stage's name. Required. @@ -1212,7 +1197,7 @@ def __init__(self, *, type: Union[str, "_models.TargetType"], name: str, **kwarg """ :keyword type: The skip target type. Required. Known values are: "Member", "Group", "Stage", and "AfterStageWait". - :paramtype type: str or ~azure.mgmt.containerservicefleet.v2024_04_01.models.TargetType + :paramtype type: str or ~azure.mgmt.containerservicefleet.models.TargetType :keyword name: The skip target's name. To skip a member/group/stage, use the member/group/stage's name; Tp skip an after stage wait, use the parent stage's name. Required. @@ -1230,16 +1215,14 @@ class SystemData(_serialization.Model): :vartype created_by: str :ivar created_by_type: The type of identity that created the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - :vartype created_by_type: str or - ~azure.mgmt.containerservicefleet.v2024_04_01.models.CreatedByType + :vartype created_by_type: str or ~azure.mgmt.containerservicefleet.models.CreatedByType :ivar created_at: The timestamp of resource creation (UTC). :vartype created_at: ~datetime.datetime :ivar last_modified_by: The identity that last modified the resource. :vartype last_modified_by: str :ivar last_modified_by_type: The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - :vartype last_modified_by_type: str or - ~azure.mgmt.containerservicefleet.v2024_04_01.models.CreatedByType + :vartype last_modified_by_type: str or ~azure.mgmt.containerservicefleet.models.CreatedByType :ivar last_modified_at: The timestamp of resource last modification (UTC). :vartype last_modified_at: ~datetime.datetime """ @@ -1269,16 +1252,14 @@ def __init__( :paramtype created_by: str :keyword created_by_type: The type of identity that created the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - :paramtype created_by_type: str or - ~azure.mgmt.containerservicefleet.v2024_04_01.models.CreatedByType + :paramtype created_by_type: str or ~azure.mgmt.containerservicefleet.models.CreatedByType :keyword created_at: The timestamp of resource creation (UTC). :paramtype created_at: ~datetime.datetime :keyword last_modified_by: The identity that last modified the resource. :paramtype last_modified_by: str :keyword last_modified_by_type: The type of identity that last modified the resource. Known values are: "User", "Application", "ManagedIdentity", and "Key". - :paramtype last_modified_by_type: str or - ~azure.mgmt.containerservicefleet.v2024_04_01.models.CreatedByType + :paramtype last_modified_by_type: str or ~azure.mgmt.containerservicefleet.models.CreatedByType :keyword last_modified_at: The timestamp of resource last modification (UTC). :paramtype last_modified_at: ~datetime.datetime """ @@ -1325,11 +1306,11 @@ class UpdateGroupStatus(_serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :ivar status: The status of the UpdateGroup. - :vartype status: ~azure.mgmt.containerservicefleet.v2024_04_01.models.UpdateStatus + :vartype status: ~azure.mgmt.containerservicefleet.models.UpdateStatus :ivar name: The name of the UpdateGroup. :vartype name: str :ivar members: The list of member this UpdateGroup updates. - :vartype members: list[~azure.mgmt.containerservicefleet.v2024_04_01.models.MemberUpdateStatus] + :vartype members: list[~azure.mgmt.containerservicefleet.models.MemberUpdateStatus] """ _validation = { @@ -1367,7 +1348,7 @@ class UpdateRun(ProxyResource): :vartype type: str :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy information. - :vartype system_data: ~azure.mgmt.containerservicefleet.v2024_04_01.models.SystemData + :vartype system_data: ~azure.mgmt.containerservicefleet.models.SystemData :ivar e_tag: If eTag is provided in the response body, it may also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match @@ -1376,7 +1357,7 @@ class UpdateRun(ProxyResource): :ivar provisioning_state: The provisioning state of the UpdateRun resource. Known values are: "Succeeded", "Failed", and "Canceled". :vartype provisioning_state: str or - ~azure.mgmt.containerservicefleet.v2024_04_01.models.UpdateRunProvisioningState + ~azure.mgmt.containerservicefleet.models.UpdateRunProvisioningState :ivar update_strategy_id: The resource id of the FleetUpdateStrategy resource to reference. When creating a new run, there are three ways to define a strategy for the run: @@ -1399,13 +1380,12 @@ class UpdateRun(ProxyResource): If not set, all members will be updated sequentially. The UpdateRun status will show a single UpdateStage and a single UpdateGroup targeting all members. The strategy of the UpdateRun can be modified until the run is started. - :vartype strategy: ~azure.mgmt.containerservicefleet.v2024_04_01.models.UpdateRunStrategy + :vartype strategy: ~azure.mgmt.containerservicefleet.models.UpdateRunStrategy :ivar managed_cluster_update: The update to be applied to all clusters in the UpdateRun. The managedClusterUpdate can be modified until the run is started. - :vartype managed_cluster_update: - ~azure.mgmt.containerservicefleet.v2024_04_01.models.ManagedClusterUpdate + :vartype managed_cluster_update: ~azure.mgmt.containerservicefleet.models.ManagedClusterUpdate :ivar status: The status of the UpdateRun. - :vartype status: ~azure.mgmt.containerservicefleet.v2024_04_01.models.UpdateRunStatus + :vartype status: ~azure.mgmt.containerservicefleet.models.UpdateRunStatus """ _validation = { @@ -1462,11 +1442,11 @@ def __init__( If not set, all members will be updated sequentially. The UpdateRun status will show a single UpdateStage and a single UpdateGroup targeting all members. The strategy of the UpdateRun can be modified until the run is started. - :paramtype strategy: ~azure.mgmt.containerservicefleet.v2024_04_01.models.UpdateRunStrategy + :paramtype strategy: ~azure.mgmt.containerservicefleet.models.UpdateRunStrategy :keyword managed_cluster_update: The update to be applied to all clusters in the UpdateRun. The managedClusterUpdate can be modified until the run is started. :paramtype managed_cluster_update: - ~azure.mgmt.containerservicefleet.v2024_04_01.models.ManagedClusterUpdate + ~azure.mgmt.containerservicefleet.models.ManagedClusterUpdate """ super().__init__(**kwargs) self.e_tag = None @@ -1483,7 +1463,7 @@ class UpdateRunListResult(_serialization.Model): All required parameters must be populated in order to send to server. :ivar value: The UpdateRun items on this page. Required. - :vartype value: list[~azure.mgmt.containerservicefleet.v2024_04_01.models.UpdateRun] + :vartype value: list[~azure.mgmt.containerservicefleet.models.UpdateRun] :ivar next_link: The link to the next page of items. :vartype next_link: str """ @@ -1500,7 +1480,7 @@ class UpdateRunListResult(_serialization.Model): def __init__(self, *, value: List["_models.UpdateRun"], next_link: Optional[str] = None, **kwargs: Any) -> None: """ :keyword value: The UpdateRun items on this page. Required. - :paramtype value: list[~azure.mgmt.containerservicefleet.v2024_04_01.models.UpdateRun] + :paramtype value: list[~azure.mgmt.containerservicefleet.models.UpdateRun] :keyword next_link: The link to the next page of items. :paramtype next_link: str """ @@ -1515,14 +1495,14 @@ class UpdateRunStatus(_serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :ivar status: The status of the UpdateRun. - :vartype status: ~azure.mgmt.containerservicefleet.v2024_04_01.models.UpdateStatus + :vartype status: ~azure.mgmt.containerservicefleet.models.UpdateStatus :ivar stages: The stages composing an update run. Stages are run sequentially withing an UpdateRun. - :vartype stages: list[~azure.mgmt.containerservicefleet.v2024_04_01.models.UpdateStageStatus] + :vartype stages: list[~azure.mgmt.containerservicefleet.models.UpdateStageStatus] :ivar node_image_selection: The node image upgrade specs for the update run. It is only set in update run when ``NodeImageSelection.type`` is ``Consistent``. :vartype node_image_selection: - ~azure.mgmt.containerservicefleet.v2024_04_01.models.NodeImageSelectionStatus + ~azure.mgmt.containerservicefleet.models.NodeImageSelectionStatus """ _validation = { @@ -1557,7 +1537,7 @@ class UpdateRunStrategy(_serialization.Model): All required parameters must be populated in order to send to server. :ivar stages: The list of stages that compose this update run. Min size: 1. Required. - :vartype stages: list[~azure.mgmt.containerservicefleet.v2024_04_01.models.UpdateStage] + :vartype stages: list[~azure.mgmt.containerservicefleet.models.UpdateStage] """ _validation = { @@ -1571,7 +1551,7 @@ class UpdateRunStrategy(_serialization.Model): def __init__(self, *, stages: List["_models.UpdateStage"], **kwargs: Any) -> None: """ :keyword stages: The list of stages that compose this update run. Min size: 1. Required. - :paramtype stages: list[~azure.mgmt.containerservicefleet.v2024_04_01.models.UpdateStage] + :paramtype stages: list[~azure.mgmt.containerservicefleet.models.UpdateStage] """ super().__init__(**kwargs) self.stages = stages @@ -1587,7 +1567,7 @@ class UpdateStage(_serialization.Model): :vartype name: str :ivar groups: Defines the groups to be executed in parallel in this stage. Duplicate groups are not allowed. Min size: 1. - :vartype groups: list[~azure.mgmt.containerservicefleet.v2024_04_01.models.UpdateGroup] + :vartype groups: list[~azure.mgmt.containerservicefleet.models.UpdateGroup] :ivar after_stage_wait_in_seconds: The time in seconds to wait at the end of this stage before starting the next one. Defaults to 0 seconds if unspecified. :vartype after_stage_wait_in_seconds: int @@ -1616,7 +1596,7 @@ def __init__( :paramtype name: str :keyword groups: Defines the groups to be executed in parallel in this stage. Duplicate groups are not allowed. Min size: 1. - :paramtype groups: list[~azure.mgmt.containerservicefleet.v2024_04_01.models.UpdateGroup] + :paramtype groups: list[~azure.mgmt.containerservicefleet.models.UpdateGroup] :keyword after_stage_wait_in_seconds: The time in seconds to wait at the end of this stage before starting the next one. Defaults to 0 seconds if unspecified. :paramtype after_stage_wait_in_seconds: int @@ -1633,14 +1613,13 @@ class UpdateStageStatus(_serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :ivar status: The status of the UpdateStage. - :vartype status: ~azure.mgmt.containerservicefleet.v2024_04_01.models.UpdateStatus + :vartype status: ~azure.mgmt.containerservicefleet.models.UpdateStatus :ivar name: The name of the UpdateStage. :vartype name: str :ivar groups: The list of groups to be updated as part of this UpdateStage. - :vartype groups: list[~azure.mgmt.containerservicefleet.v2024_04_01.models.UpdateGroupStatus] + :vartype groups: list[~azure.mgmt.containerservicefleet.models.UpdateGroupStatus] :ivar after_stage_wait_status: The status of the wait period configured on the UpdateStage. - :vartype after_stage_wait_status: - ~azure.mgmt.containerservicefleet.v2024_04_01.models.WaitStatus + :vartype after_stage_wait_status: ~azure.mgmt.containerservicefleet.models.WaitStatus """ _validation = { @@ -1677,9 +1656,9 @@ class UpdateStatus(_serialization.Model): :vartype completed_time: ~datetime.datetime :ivar state: The State of the operation or group. Known values are: "NotStarted", "Running", "Stopping", "Stopped", "Skipped", "Failed", and "Completed". - :vartype state: str or ~azure.mgmt.containerservicefleet.v2024_04_01.models.UpdateState + :vartype state: str or ~azure.mgmt.containerservicefleet.models.UpdateState :ivar error: The error details when a failure is encountered. - :vartype error: ~azure.mgmt.containerservicefleet.v2024_04_01.models.ErrorDetail + :vartype error: ~azure.mgmt.containerservicefleet.models.ErrorDetail """ _validation = { @@ -1739,7 +1718,7 @@ class WaitStatus(_serialization.Model): Variables are only populated by the server, and will be ignored when sending a request. :ivar status: The status of the wait duration. - :vartype status: ~azure.mgmt.containerservicefleet.v2024_04_01.models.UpdateStatus + :vartype status: ~azure.mgmt.containerservicefleet.models.UpdateStatus :ivar wait_duration_in_seconds: The wait duration configured in seconds. :vartype wait_duration_in_seconds: int """ diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_06_02_preview/models/_patch.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/models/_patch.py similarity index 100% rename from sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_06_02_preview/models/_patch.py rename to sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/models/_patch.py diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/operations/__init__.py similarity index 100% rename from sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/operations/__init__.py rename to sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/operations/__init__.py diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_04_01/operations/_fleet_members_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/operations/_fleet_members_operations.py similarity index 95% rename from sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_04_01/operations/_fleet_members_operations.py rename to sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/operations/_fleet_members_operations.py index 5f45d384ae077..01c83aacc6585 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_04_01/operations/_fleet_members_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/operations/_fleet_members_operations.py @@ -31,7 +31,7 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from ..._serialization import Serializer +from .._serialization import Serializer if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -290,7 +290,7 @@ class FleetMembersOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.containerservicefleet.v2024_04_01.ContainerServiceFleetMgmtClient`'s + :class:`~azure.mgmt.containerservicefleet.ContainerServiceFleetMgmtClient`'s :attr:`fleet_members` attribute. """ @@ -302,7 +302,6 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_fleet( @@ -316,14 +315,13 @@ def list_by_fleet( :param fleet_name: The name of the Fleet resource. Required. :type fleet_name: str :return: An iterator like instance of either FleetMember or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservicefleet.v2024_04_01.models.FleetMember] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerservicefleet.models.FleetMember] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.FleetMemberListResult] = kwargs.pop("cls", None) error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -356,7 +354,7 @@ def prepare_request(next_link=None): for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() } ) - _next_request_params["api-version"] = self._api_version + _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) @@ -403,7 +401,7 @@ def get( :param fleet_member_name: The name of the Fleet member resource. Required. :type fleet_member_name: str :return: FleetMember or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2024_04_01.models.FleetMember + :rtype: ~azure.mgmt.containerservicefleet.models.FleetMember :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -417,7 +415,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.FleetMember] = kwargs.pop("cls", None) _request = build_get_request( @@ -471,7 +469,7 @@ def _create_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) @@ -550,7 +548,7 @@ def begin_create( :param fleet_member_name: The name of the Fleet member resource. Required. :type fleet_member_name: str :param resource: Resource create parameters. Required. - :type resource: ~azure.mgmt.containerservicefleet.v2024_04_01.models.FleetMember + :type resource: ~azure.mgmt.containerservicefleet.models.FleetMember :param if_match: The request should only proceed if an entity matches this string. Default value is None. :type if_match: str @@ -562,8 +560,7 @@ def begin_create( :paramtype content_type: str :return: An instance of LROPoller that returns either FleetMember or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2024_04_01.models.FleetMember] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.models.FleetMember] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -602,8 +599,7 @@ def begin_create( :paramtype content_type: str :return: An instance of LROPoller that returns either FleetMember or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2024_04_01.models.FleetMember] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.models.FleetMember] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -629,7 +625,7 @@ def begin_create( :type fleet_member_name: str :param resource: Resource create parameters. Is either a FleetMember type or a IO[bytes] type. Required. - :type resource: ~azure.mgmt.containerservicefleet.v2024_04_01.models.FleetMember or IO[bytes] + :type resource: ~azure.mgmt.containerservicefleet.models.FleetMember or IO[bytes] :param if_match: The request should only proceed if an entity matches this string. Default value is None. :type if_match: str @@ -638,14 +634,13 @@ def begin_create( :type if_none_match: str :return: An instance of LROPoller that returns either FleetMember or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2024_04_01.models.FleetMember] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.models.FleetMember] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.FleetMember] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -714,7 +709,7 @@ def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) @@ -792,7 +787,7 @@ def begin_update( :param fleet_member_name: The name of the Fleet member resource. Required. :type fleet_member_name: str :param properties: The resource properties to be updated. Required. - :type properties: ~azure.mgmt.containerservicefleet.v2024_04_01.models.FleetMemberUpdate + :type properties: ~azure.mgmt.containerservicefleet.models.FleetMemberUpdate :param if_match: The request should only proceed if an entity matches this string. Default value is None. :type if_match: str @@ -801,8 +796,7 @@ def begin_update( :paramtype content_type: str :return: An instance of LROPoller that returns either FleetMember or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2024_04_01.models.FleetMember] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.models.FleetMember] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -837,8 +831,7 @@ def begin_update( :paramtype content_type: str :return: An instance of LROPoller that returns either FleetMember or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2024_04_01.models.FleetMember] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.models.FleetMember] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -863,21 +856,19 @@ def begin_update( :type fleet_member_name: str :param properties: The resource properties to be updated. Is either a FleetMemberUpdate type or a IO[bytes] type. Required. - :type properties: ~azure.mgmt.containerservicefleet.v2024_04_01.models.FleetMemberUpdate or - IO[bytes] + :type properties: ~azure.mgmt.containerservicefleet.models.FleetMemberUpdate or IO[bytes] :param if_match: The request should only proceed if an entity matches this string. Default value is None. :type if_match: str :return: An instance of LROPoller that returns either FleetMember or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2024_04_01.models.FleetMember] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.models.FleetMember] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.FleetMember] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -944,7 +935,7 @@ def _delete_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( @@ -1016,7 +1007,7 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_04_01/operations/_fleet_update_strategies_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/operations/_fleet_update_strategies_operations.py similarity index 96% rename from sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_04_01/operations/_fleet_update_strategies_operations.py rename to sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/operations/_fleet_update_strategies_operations.py index ed247ee6f54e1..34f0ccfe06376 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_04_01/operations/_fleet_update_strategies_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/operations/_fleet_update_strategies_operations.py @@ -31,7 +31,7 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from ..._serialization import Serializer +from .._serialization import Serializer if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -236,7 +236,7 @@ class FleetUpdateStrategiesOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.containerservicefleet.v2024_04_01.ContainerServiceFleetMgmtClient`'s + :class:`~azure.mgmt.containerservicefleet.ContainerServiceFleetMgmtClient`'s :attr:`fleet_update_strategies` attribute. """ @@ -248,7 +248,6 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_fleet( @@ -263,13 +262,13 @@ def list_by_fleet( :type fleet_name: str :return: An iterator like instance of either FleetUpdateStrategy or the result of cls(response) :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservicefleet.v2024_04_01.models.FleetUpdateStrategy] + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservicefleet.models.FleetUpdateStrategy] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.FleetUpdateStrategyListResult] = kwargs.pop("cls", None) error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -302,7 +301,7 @@ def prepare_request(next_link=None): for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() } ) - _next_request_params["api-version"] = self._api_version + _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) @@ -349,7 +348,7 @@ def get( :param update_strategy_name: The name of the UpdateStrategy resource. Required. :type update_strategy_name: str :return: FleetUpdateStrategy or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2024_04_01.models.FleetUpdateStrategy + :rtype: ~azure.mgmt.containerservicefleet.models.FleetUpdateStrategy :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -363,7 +362,7 @@ def get( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.FleetUpdateStrategy] = kwargs.pop("cls", None) _request = build_get_request( @@ -417,7 +416,7 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) @@ -496,7 +495,7 @@ def begin_create_or_update( :param update_strategy_name: The name of the UpdateStrategy resource. Required. :type update_strategy_name: str :param resource: Resource create parameters. Required. - :type resource: ~azure.mgmt.containerservicefleet.v2024_04_01.models.FleetUpdateStrategy + :type resource: ~azure.mgmt.containerservicefleet.models.FleetUpdateStrategy :param if_match: The request should only proceed if an entity matches this string. Default value is None. :type if_match: str @@ -509,7 +508,7 @@ def begin_create_or_update( :return: An instance of LROPoller that returns either FleetUpdateStrategy or the result of cls(response) :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2024_04_01.models.FleetUpdateStrategy] + ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.models.FleetUpdateStrategy] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -549,7 +548,7 @@ def begin_create_or_update( :return: An instance of LROPoller that returns either FleetUpdateStrategy or the result of cls(response) :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2024_04_01.models.FleetUpdateStrategy] + ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.models.FleetUpdateStrategy] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -575,8 +574,7 @@ def begin_create_or_update( :type update_strategy_name: str :param resource: Resource create parameters. Is either a FleetUpdateStrategy type or a IO[bytes] type. Required. - :type resource: ~azure.mgmt.containerservicefleet.v2024_04_01.models.FleetUpdateStrategy or - IO[bytes] + :type resource: ~azure.mgmt.containerservicefleet.models.FleetUpdateStrategy or IO[bytes] :param if_match: The request should only proceed if an entity matches this string. Default value is None. :type if_match: str @@ -586,13 +584,13 @@ def begin_create_or_update( :return: An instance of LROPoller that returns either FleetUpdateStrategy or the result of cls(response) :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2024_04_01.models.FleetUpdateStrategy] + ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.models.FleetUpdateStrategy] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.FleetUpdateStrategy] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -660,7 +658,7 @@ def _delete_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( @@ -732,7 +730,7 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_04_01/operations/_fleets_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/operations/_fleets_operations.py similarity index 95% rename from sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_04_01/operations/_fleets_operations.py rename to sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/operations/_fleets_operations.py index 6d811f1c179c6..abd62a23cefd5 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_04_01/operations/_fleets_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/operations/_fleets_operations.py @@ -31,7 +31,7 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from ..._serialization import Serializer +from .._serialization import Serializer if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -297,7 +297,7 @@ class FleetsOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.containerservicefleet.v2024_04_01.ContainerServiceFleetMgmtClient`'s + :class:`~azure.mgmt.containerservicefleet.ContainerServiceFleetMgmtClient`'s :attr:`fleets` attribute. """ @@ -309,21 +309,19 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.Fleet"]: """Lists fleets in the specified subscription. :return: An iterator like instance of either Fleet or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservicefleet.v2024_04_01.models.Fleet] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerservicefleet.models.Fleet] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.FleetListResult] = kwargs.pop("cls", None) error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -354,7 +352,7 @@ def prepare_request(next_link=None): for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() } ) - _next_request_params["api-version"] = self._api_version + _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) @@ -395,14 +393,13 @@ def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Ite Required. :type resource_group_name: str :return: An iterator like instance of either Fleet or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservicefleet.v2024_04_01.models.Fleet] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerservicefleet.models.Fleet] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.FleetListResult] = kwargs.pop("cls", None) error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -434,7 +431,7 @@ def prepare_request(next_link=None): for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() } ) - _next_request_params["api-version"] = self._api_version + _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) @@ -477,7 +474,7 @@ def get(self, resource_group_name: str, fleet_name: str, **kwargs: Any) -> _mode :param fleet_name: The name of the Fleet resource. Required. :type fleet_name: str :return: Fleet or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2024_04_01.models.Fleet + :rtype: ~azure.mgmt.containerservicefleet.models.Fleet :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -491,7 +488,7 @@ def get(self, resource_group_name: str, fleet_name: str, **kwargs: Any) -> _mode _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.Fleet] = kwargs.pop("cls", None) _request = build_get_request( @@ -543,7 +540,7 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) @@ -618,7 +615,7 @@ def begin_create_or_update( :param fleet_name: The name of the Fleet resource. Required. :type fleet_name: str :param resource: Resource create parameters. Required. - :type resource: ~azure.mgmt.containerservicefleet.v2024_04_01.models.Fleet + :type resource: ~azure.mgmt.containerservicefleet.models.Fleet :param if_match: The request should only proceed if an entity matches this string. Default value is None. :type if_match: str @@ -629,8 +626,7 @@ def begin_create_or_update( Default value is "application/json". :paramtype content_type: str :return: An instance of LROPoller that returns either Fleet or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2024_04_01.models.Fleet] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.models.Fleet] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -665,8 +661,7 @@ def begin_create_or_update( Default value is "application/json". :paramtype content_type: str :return: An instance of LROPoller that returns either Fleet or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2024_04_01.models.Fleet] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.models.Fleet] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -689,7 +684,7 @@ def begin_create_or_update( :type fleet_name: str :param resource: Resource create parameters. Is either a Fleet type or a IO[bytes] type. Required. - :type resource: ~azure.mgmt.containerservicefleet.v2024_04_01.models.Fleet or IO[bytes] + :type resource: ~azure.mgmt.containerservicefleet.models.Fleet or IO[bytes] :param if_match: The request should only proceed if an entity matches this string. Default value is None. :type if_match: str @@ -697,14 +692,13 @@ def begin_create_or_update( value is None. :type if_none_match: str :return: An instance of LROPoller that returns either Fleet or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2024_04_01.models.Fleet] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.models.Fleet] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Fleet] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -771,7 +765,7 @@ def _update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) @@ -845,7 +839,7 @@ def begin_update( :param fleet_name: The name of the Fleet resource. Required. :type fleet_name: str :param properties: The resource properties to be updated. Required. - :type properties: ~azure.mgmt.containerservicefleet.v2024_04_01.models.FleetPatch + :type properties: ~azure.mgmt.containerservicefleet.models.FleetPatch :param if_match: The request should only proceed if an entity matches this string. Default value is None. :type if_match: str @@ -853,8 +847,7 @@ def begin_update( Default value is "application/json". :paramtype content_type: str :return: An instance of LROPoller that returns either Fleet or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2024_04_01.models.Fleet] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.models.Fleet] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -885,8 +878,7 @@ def begin_update( Default value is "application/json". :paramtype content_type: str :return: An instance of LROPoller that returns either Fleet or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2024_04_01.models.Fleet] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.models.Fleet] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -908,19 +900,18 @@ def begin_update( :type fleet_name: str :param properties: The resource properties to be updated. Is either a FleetPatch type or a IO[bytes] type. Required. - :type properties: ~azure.mgmt.containerservicefleet.v2024_04_01.models.FleetPatch or IO[bytes] + :type properties: ~azure.mgmt.containerservicefleet.models.FleetPatch or IO[bytes] :param if_match: The request should only proceed if an entity matches this string. Default value is None. :type if_match: str :return: An instance of LROPoller that returns either Fleet or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2024_04_01.models.Fleet] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.models.Fleet] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.Fleet] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -981,7 +972,7 @@ def _delete_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( @@ -1045,7 +1036,7 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -1097,7 +1088,7 @@ def list_credentials( :param fleet_name: The name of the Fleet resource. Required. :type fleet_name: str :return: FleetCredentialResults or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2024_04_01.models.FleetCredentialResults + :rtype: ~azure.mgmt.containerservicefleet.models.FleetCredentialResults :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -1111,7 +1102,7 @@ def list_credentials( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.FleetCredentialResults] = kwargs.pop("cls", None) _request = build_list_credentials_request( diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_04_01/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/operations/_operations.py similarity index 92% rename from sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_04_01/operations/_operations.py rename to sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/operations/_operations.py index 0fc02c2dc73db..7e8d020df6523 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_04_01/operations/_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/operations/_operations.py @@ -26,7 +26,7 @@ from azure.mgmt.core.exceptions import ARMErrorFormat from .. import models as _models -from ..._serialization import Serializer +from .._serialization import Serializer if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -64,7 +64,7 @@ class Operations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.containerservicefleet.v2024_04_01.ContainerServiceFleetMgmtClient`'s + :class:`~azure.mgmt.containerservicefleet.ContainerServiceFleetMgmtClient`'s :attr:`operations` attribute. """ @@ -76,21 +76,19 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: """List the operations for the provider. :return: An iterator like instance of either Operation or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservicefleet.v2024_04_01.models.Operation] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerservicefleet.models.Operation] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -120,7 +118,7 @@ def prepare_request(next_link=None): for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() } ) - _next_request_params["api-version"] = self._api_version + _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_06_02_preview/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/operations/_patch.py similarity index 100% rename from sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_06_02_preview/operations/_patch.py rename to sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/operations/_patch.py diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_04_01/operations/_update_runs_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/operations/_update_runs_operations.py similarity index 95% rename from sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_04_01/operations/_update_runs_operations.py rename to sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/operations/_update_runs_operations.py index cf848206f27f9..32aeac64b414a 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_04_01/operations/_update_runs_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/operations/_update_runs_operations.py @@ -31,7 +31,7 @@ from azure.mgmt.core.polling.arm_polling import ARMPolling from .. import models as _models -from ..._serialization import Serializer +from .._serialization import Serializer if sys.version_info >= (3, 9): from collections.abc import MutableMapping @@ -392,7 +392,7 @@ class UpdateRunsOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.containerservicefleet.v2024_04_01.ContainerServiceFleetMgmtClient`'s + :class:`~azure.mgmt.containerservicefleet.ContainerServiceFleetMgmtClient`'s :attr:`update_runs` attribute. """ @@ -404,7 +404,6 @@ def __init__(self, *args, **kwargs): self._config = input_args.pop(0) if input_args else kwargs.pop("config") self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") @distributed_trace def list_by_fleet(self, resource_group_name: str, fleet_name: str, **kwargs: Any) -> Iterable["_models.UpdateRun"]: @@ -416,14 +415,13 @@ def list_by_fleet(self, resource_group_name: str, fleet_name: str, **kwargs: Any :param fleet_name: The name of the Fleet resource. Required. :type fleet_name: str :return: An iterator like instance of either UpdateRun or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservicefleet.v2024_04_01.models.UpdateRun] + :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.containerservicefleet.models.UpdateRun] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.UpdateRunListResult] = kwargs.pop("cls", None) error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -456,7 +454,7 @@ def prepare_request(next_link=None): for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() } ) - _next_request_params["api-version"] = self._api_version + _next_request_params["api-version"] = self._config.api_version _request = HttpRequest( "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params ) @@ -501,7 +499,7 @@ def get(self, resource_group_name: str, fleet_name: str, update_run_name: str, * :param update_run_name: The name of the UpdateRun resource. Required. :type update_run_name: str :return: UpdateRun or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2024_04_01.models.UpdateRun + :rtype: ~azure.mgmt.containerservicefleet.models.UpdateRun :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -515,7 +513,7 @@ def get(self, resource_group_name: str, fleet_name: str, update_run_name: str, * _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.UpdateRun] = kwargs.pop("cls", None) _request = build_get_request( @@ -569,7 +567,7 @@ def _create_or_update_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) @@ -648,7 +646,7 @@ def begin_create_or_update( :param update_run_name: The name of the UpdateRun resource. Required. :type update_run_name: str :param resource: Resource create parameters. Required. - :type resource: ~azure.mgmt.containerservicefleet.v2024_04_01.models.UpdateRun + :type resource: ~azure.mgmt.containerservicefleet.models.UpdateRun :param if_match: The request should only proceed if an entity matches this string. Default value is None. :type if_match: str @@ -659,8 +657,7 @@ def begin_create_or_update( Default value is "application/json". :paramtype content_type: str :return: An instance of LROPoller that returns either UpdateRun or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2024_04_01.models.UpdateRun] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.models.UpdateRun] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -698,8 +695,7 @@ def begin_create_or_update( Default value is "application/json". :paramtype content_type: str :return: An instance of LROPoller that returns either UpdateRun or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2024_04_01.models.UpdateRun] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.models.UpdateRun] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -725,7 +721,7 @@ def begin_create_or_update( :type update_run_name: str :param resource: Resource create parameters. Is either a UpdateRun type or a IO[bytes] type. Required. - :type resource: ~azure.mgmt.containerservicefleet.v2024_04_01.models.UpdateRun or IO[bytes] + :type resource: ~azure.mgmt.containerservicefleet.models.UpdateRun or IO[bytes] :param if_match: The request should only proceed if an entity matches this string. Default value is None. :type if_match: str @@ -733,14 +729,13 @@ def begin_create_or_update( value is None. :type if_none_match: str :return: An instance of LROPoller that returns either UpdateRun or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2024_04_01.models.UpdateRun] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.models.UpdateRun] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.UpdateRun] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -808,7 +803,7 @@ def _delete_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_delete_request( @@ -880,7 +875,7 @@ def begin_delete( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[None] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -941,7 +936,7 @@ def _skip_initial( _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) @@ -1019,7 +1014,7 @@ def begin_skip( :param update_run_name: The name of the UpdateRun resource. Required. :type update_run_name: str :param body: The content of the action request. Required. - :type body: ~azure.mgmt.containerservicefleet.v2024_04_01.models.SkipProperties + :type body: ~azure.mgmt.containerservicefleet.models.SkipProperties :param if_match: The request should only proceed if an entity matches this string. Default value is None. :type if_match: str @@ -1027,8 +1022,7 @@ def begin_skip( Default value is "application/json". :paramtype content_type: str :return: An instance of LROPoller that returns either UpdateRun or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2024_04_01.models.UpdateRun] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.models.UpdateRun] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -1062,8 +1056,7 @@ def begin_skip( Default value is "application/json". :paramtype content_type: str :return: An instance of LROPoller that returns either UpdateRun or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2024_04_01.models.UpdateRun] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.models.UpdateRun] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -1088,19 +1081,18 @@ def begin_skip( :type update_run_name: str :param body: The content of the action request. Is either a SkipProperties type or a IO[bytes] type. Required. - :type body: ~azure.mgmt.containerservicefleet.v2024_04_01.models.SkipProperties or IO[bytes] + :type body: ~azure.mgmt.containerservicefleet.models.SkipProperties or IO[bytes] :param if_match: The request should only proceed if an entity matches this string. Default value is None. :type if_match: str :return: An instance of LROPoller that returns either UpdateRun or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2024_04_01.models.UpdateRun] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.models.UpdateRun] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) cls: ClsType[_models.UpdateRun] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -1167,7 +1159,7 @@ def _start_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_start_request( @@ -1233,14 +1225,13 @@ def begin_start( value is None. :type if_match: str :return: An instance of LROPoller that returns either UpdateRun or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2024_04_01.models.UpdateRun] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.models.UpdateRun] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.UpdateRun] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) @@ -1304,7 +1295,7 @@ def _stop_initial( _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) _request = build_stop_request( @@ -1370,14 +1361,13 @@ def begin_stop( value is None. :type if_match: str :return: An instance of LROPoller that returns either UpdateRun or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2024_04_01.models.UpdateRun] + :rtype: ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.models.UpdateRun] :raises ~azure.core.exceptions.HttpResponseError: """ _headers = kwargs.pop("headers", {}) or {} _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.UpdateRun] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_06_02_preview/__init__.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_06_02_preview/__init__.py deleted file mode 100644 index 78b8b4b91a49e..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_06_02_preview/__init__.py +++ /dev/null @@ -1,26 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._container_service_fleet_mgmt_client import ContainerServiceFleetMgmtClient -from ._version import VERSION - -__version__ = VERSION - -try: - from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ContainerServiceFleetMgmtClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) - -_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_06_02_preview/_configuration.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_06_02_preview/_configuration.py deleted file mode 100644 index 5d03ccc61cbed..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_06_02_preview/_configuration.py +++ /dev/null @@ -1,65 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any, TYPE_CHECKING - -from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy - -from ._version import VERSION - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials import TokenCredential - - -class ContainerServiceFleetMgmtClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long - """Configuration for ContainerServiceFleetMgmtClient. - - 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. Required. - :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :keyword api_version: Api Version. Default value is "2022-09-02-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2022-09-02-preview") - - if credential is None: - raise ValueError("Parameter 'credential' must not be None.") - if subscription_id is None: - raise ValueError("Parameter 'subscription_id' must not be None.") - - self.credential = credential - self.subscription_id = subscription_id - self.api_version = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-containerservicefleet/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - 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.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") - if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_06_02_preview/_container_service_fleet_mgmt_client.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_06_02_preview/_container_service_fleet_mgmt_client.py deleted file mode 100644 index 3d17da08ba951..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_06_02_preview/_container_service_fleet_mgmt_client.py +++ /dev/null @@ -1,126 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, TYPE_CHECKING -from typing_extensions import Self - -from azure.core.pipeline import policies -from azure.core.rest import HttpRequest, HttpResponse -from azure.mgmt.core import ARMPipelineClient -from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy - -from . import models as _models -from .._serialization import Deserializer, Serializer -from ._configuration import ContainerServiceFleetMgmtClientConfiguration -from .operations import FleetMembersOperations, FleetsOperations, Operations - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials import TokenCredential - - -class ContainerServiceFleetMgmtClient: # pylint: disable=client-accepts-api-version-keyword - """Azure Kubernetes Fleet Manager api client. - - :ivar operations: Operations operations - :vartype operations: azure.mgmt.containerservicefleet.v2022_06_02_preview.operations.Operations - :ivar fleets: FleetsOperations operations - :vartype fleets: - azure.mgmt.containerservicefleet.v2022_06_02_preview.operations.FleetsOperations - :ivar fleet_members: FleetMembersOperations operations - :vartype fleet_members: - azure.mgmt.containerservicefleet.v2022_06_02_preview.operations.FleetMembersOperations - :param credential: Credential needed for the client to connect to Azure. Required. - :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". - :type base_url: str - :keyword api_version: Api Version. Default value is "2022-09-02-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - """ - - def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any - ) -> None: - self._config = ContainerServiceFleetMgmtClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs - ) - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - ARMAutoResourceProviderRegistrationPolicy(), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) - - client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer(client_models) - self._deserialize = Deserializer(client_models) - self._serialize.client_side_validation = False - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize, "2022-09-02-preview" - ) - self.fleets = FleetsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-09-02-preview" - ) - self.fleet_members = FleetMembersOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-09-02-preview" - ) - - def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.HttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore - - def close(self) -> None: - self._client.close() - - def __enter__(self) -> Self: - self._client.__enter__() - return self - - def __exit__(self, *exc_details: Any) -> None: - self._client.__exit__(*exc_details) diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_06_02_preview/_metadata.json b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_06_02_preview/_metadata.json deleted file mode 100644 index 7ba159ecdedd9..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_06_02_preview/_metadata.json +++ /dev/null @@ -1,112 +0,0 @@ -{ - "chosen_version": "2022-09-02-preview", - "total_api_version_list": ["2022-09-02-preview"], - "client": { - "name": "ContainerServiceFleetMgmtClient", - "filename": "_container_service_fleet_mgmt_client", - "description": "Azure Kubernetes Fleet Manager api client.", - "host_value": "\"https://management.azure.com\"", - "parameterized_host_template": null, - "azure_arm": true, - "has_public_lro_operations": true, - "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ContainerServiceFleetMgmtClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ContainerServiceFleetMgmtClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" - }, - "global_parameters": { - "sync": { - "credential": { - "signature": "credential: \"TokenCredential\",", - "description": "Credential needed for the client to connect to Azure. Required.", - "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true, - "method_location": "positional" - }, - "subscription_id": { - "signature": "subscription_id: str,", - "description": "The ID of the target subscription. Required.", - "docstring_type": "str", - "required": true, - "method_location": "positional" - } - }, - "async": { - "credential": { - "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure. Required.", - "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", - "required": true - }, - "subscription_id": { - "signature": "subscription_id: str,", - "description": "The ID of the target subscription. Required.", - "docstring_type": "str", - "required": true - } - }, - "constant": { - }, - "call": "credential, subscription_id", - "service_client_specific": { - "sync": { - "api_version": { - "signature": "api_version: Optional[str]=None,", - "description": "API version to use if no profile is provided, or if missing in profile.", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", - "description": "Service URL", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "profile": { - "signature": "profile: KnownProfiles=KnownProfiles.default,", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false, - "method_location": "positional" - } - }, - "async": { - "api_version": { - "signature": "api_version: Optional[str] = None,", - "description": "API version to use if no profile is provided, or if missing in profile.", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", - "description": "Service URL", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "profile": { - "signature": "profile: KnownProfiles = KnownProfiles.default,", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false, - "method_location": "positional" - } - } - } - }, - "config": { - "credential": true, - "credential_scopes": ["https://management.azure.com/.default"], - "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", - "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", - "sync_imports": "{\"regular\": {\"sdkcore\": {\"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"sdkcore\": {\"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" - }, - "operation_groups": { - "operations": "Operations", - "fleets": "FleetsOperations", - "fleet_members": "FleetMembersOperations" - } -} diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_06_02_preview/_version.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_06_02_preview/_version.py deleted file mode 100644 index 83f24ab509461..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_06_02_preview/_version.py +++ /dev/null @@ -1,9 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -VERSION = "2.1.0" diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_06_02_preview/aio/__init__.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_06_02_preview/aio/__init__.py deleted file mode 100644 index af1d7b0b47fe9..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_06_02_preview/aio/__init__.py +++ /dev/null @@ -1,23 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._container_service_fleet_mgmt_client import ContainerServiceFleetMgmtClient - -try: - from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ContainerServiceFleetMgmtClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) - -_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_06_02_preview/aio/_configuration.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_06_02_preview/aio/_configuration.py deleted file mode 100644 index 2debdb91f6fc0..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_06_02_preview/aio/_configuration.py +++ /dev/null @@ -1,65 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any, TYPE_CHECKING - -from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy - -from .._version import VERSION - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential - - -class ContainerServiceFleetMgmtClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long - """Configuration for ContainerServiceFleetMgmtClient. - - 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. Required. - :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :keyword api_version: Api Version. Default value is "2022-09-02-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2022-09-02-preview") - - if credential is None: - raise ValueError("Parameter 'credential' must not be None.") - if subscription_id is None: - raise ValueError("Parameter 'subscription_id' must not be None.") - - self.credential = credential - self.subscription_id = subscription_id - self.api_version = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-containerservicefleet/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - 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.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") - if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_06_02_preview/aio/_container_service_fleet_mgmt_client.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_06_02_preview/aio/_container_service_fleet_mgmt_client.py deleted file mode 100644 index afd23b7f01e3a..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_06_02_preview/aio/_container_service_fleet_mgmt_client.py +++ /dev/null @@ -1,129 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING -from typing_extensions import Self - -from azure.core.pipeline import policies -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.mgmt.core import AsyncARMPipelineClient -from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy - -from .. import models as _models -from ..._serialization import Deserializer, Serializer -from ._configuration import ContainerServiceFleetMgmtClientConfiguration -from .operations import FleetMembersOperations, FleetsOperations, Operations - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential - - -class ContainerServiceFleetMgmtClient: # pylint: disable=client-accepts-api-version-keyword - """Azure Kubernetes Fleet Manager api client. - - :ivar operations: Operations operations - :vartype operations: - azure.mgmt.containerservicefleet.v2022_06_02_preview.aio.operations.Operations - :ivar fleets: FleetsOperations operations - :vartype fleets: - azure.mgmt.containerservicefleet.v2022_06_02_preview.aio.operations.FleetsOperations - :ivar fleet_members: FleetMembersOperations operations - :vartype fleet_members: - azure.mgmt.containerservicefleet.v2022_06_02_preview.aio.operations.FleetMembersOperations - :param credential: Credential needed for the client to connect to Azure. Required. - :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". - :type base_url: str - :keyword api_version: Api Version. Default value is "2022-09-02-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - """ - - def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any - ) -> None: - self._config = ContainerServiceFleetMgmtClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs - ) - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - AsyncARMAutoResourceProviderRegistrationPolicy(), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) - - client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer(client_models) - self._deserialize = Deserializer(client_models) - self._serialize.client_side_validation = False - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize, "2022-09-02-preview" - ) - self.fleets = FleetsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-09-02-preview" - ) - self.fleet_members = FleetMembersOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-09-02-preview" - ) - - def _send_request( - self, request: HttpRequest, *, stream: bool = False, **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = await client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.AsyncHttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore - - async def close(self) -> None: - await self._client.close() - - async def __aenter__(self) -> Self: - await self._client.__aenter__() - return self - - async def __aexit__(self, *exc_details: Any) -> None: - await self._client.__aexit__(*exc_details) diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_06_02_preview/aio/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_06_02_preview/aio/operations/__init__.py deleted file mode 100644 index a2f694539aa69..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_06_02_preview/aio/operations/__init__.py +++ /dev/null @@ -1,23 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._operations import Operations -from ._fleets_operations import FleetsOperations -from ._fleet_members_operations import FleetMembersOperations - -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "Operations", - "FleetsOperations", - "FleetMembersOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_06_02_preview/aio/operations/_fleet_members_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_06_02_preview/aio/operations/_fleet_members_operations.py deleted file mode 100644 index fffc21ea2446a..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_06_02_preview/aio/operations/_fleet_members_operations.py +++ /dev/null @@ -1,604 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._fleet_members_operations import ( - build_create_request, - build_delete_request, - build_get_request, - build_list_by_fleet_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class FleetMembersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.containerservicefleet.v2022_06_02_preview.aio.ContainerServiceFleetMgmtClient`'s - :attr:`fleet_members` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_by_fleet( - self, resource_group_name: str, fleet_name: str, **kwargs: Any - ) -> AsyncIterable["_models.FleetMember"]: - """List FleetMember resources by Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :return: An iterator like instance of either FleetMember or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservicefleet.v2022_06_02_preview.models.FleetMember] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-02-preview") - ) - cls: ClsType[_models.FleetMemberListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_fleet_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("FleetMemberListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get( - self, resource_group_name: str, fleet_name: str, fleet_member_name: str, **kwargs: Any - ) -> _models.FleetMember: - """Get a FleetMember. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :return: FleetMember or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2022_06_02_preview.models.FleetMember - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-02-preview") - ) - cls: ClsType[_models.FleetMember] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - fleet_member_name=fleet_member_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("FleetMember", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_initial( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - resource: Union[_models.FleetMember, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-02-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "FleetMember") - - _request = build_create_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - fleet_member_name=fleet_member_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - resource: _models.FleetMember, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.FleetMember]: - """Create a FleetMember. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :param resource: Resource create parameters. Required. - :type resource: ~azure.mgmt.containerservicefleet.v2022_06_02_preview.models.FleetMember - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either FleetMember or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2022_06_02_preview.models.FleetMember] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - resource: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.FleetMember]: - """Create a FleetMember. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :param resource: Resource create parameters. Required. - :type resource: IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either FleetMember or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2022_06_02_preview.models.FleetMember] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - resource: Union[_models.FleetMember, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.FleetMember]: - """Create a FleetMember. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :param resource: Resource create parameters. Is either a FleetMember type or a IO[bytes] type. - Required. - :type resource: ~azure.mgmt.containerservicefleet.v2022_06_02_preview.models.FleetMember or - IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :return: An instance of AsyncLROPoller that returns either FleetMember or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2022_06_02_preview.models.FleetMember] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-02-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FleetMember] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - fleet_member_name=fleet_member_name, - resource=resource, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FleetMember", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.FleetMember].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.FleetMember]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-02-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - fleet_member_name=fleet_member_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Delete a FleetMember. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-02-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - fleet_member_name=fleet_member_name, - if_match=if_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_06_02_preview/aio/operations/_fleets_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_06_02_preview/aio/operations/_fleets_operations.py deleted file mode 100644 index b7feb5dbd9474..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_06_02_preview/aio/operations/_fleets_operations.py +++ /dev/null @@ -1,852 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._fleets_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_by_resource_group_request, - build_list_by_subscription_request, - build_list_credentials_request, - build_update_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class FleetsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.containerservicefleet.v2022_06_02_preview.aio.ContainerServiceFleetMgmtClient`'s - :attr:`fleets` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.Fleet"]: - """Lists fleets in the specified subscription. - - :return: An iterator like instance of either Fleet or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservicefleet.v2022_06_02_preview.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-02-preview") - ) - cls: ClsType[_models.FleetListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("FleetListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace - def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.Fleet"]: - """Lists fleets in the specified subscription and resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :return: An iterator like instance of either Fleet or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservicefleet.v2022_06_02_preview.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-02-preview") - ) - cls: ClsType[_models.FleetListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("FleetListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get(self, resource_group_name: str, fleet_name: str, **kwargs: Any) -> _models.Fleet: - """Gets a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :return: Fleet or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2022_06_02_preview.models.Fleet - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-02-preview") - ) - cls: ClsType[_models.Fleet] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Fleet", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - fleet_name: str, - resource: Union[_models.Fleet, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-02-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "Fleet") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - resource: _models.Fleet, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.Fleet]: - """Creates or updates a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param resource: Resource create parameters. Required. - :type resource: ~azure.mgmt.containerservicefleet.v2022_06_02_preview.models.Fleet - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either Fleet or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2022_06_02_preview.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - resource: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.Fleet]: - """Creates or updates a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param resource: Resource create parameters. Required. - :type resource: IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either Fleet or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2022_06_02_preview.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - resource: Union[_models.Fleet, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.Fleet]: - """Creates or updates a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param resource: Resource create parameters. Is either a Fleet type or a IO[bytes] type. - Required. - :type resource: ~azure.mgmt.containerservicefleet.v2022_06_02_preview.models.Fleet or IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :return: An instance of AsyncLROPoller that returns either Fleet or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2022_06_02_preview.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-02-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Fleet] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - resource=resource, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Fleet", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.Fleet].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.Fleet]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @overload - async def update( - self, - resource_group_name: str, - fleet_name: str, - properties: _models.FleetPatch, - if_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Fleet: - """Update a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param properties: The resource properties to be updated. Required. - :type properties: ~azure.mgmt.containerservicefleet.v2022_06_02_preview.models.FleetPatch - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Fleet or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2022_06_02_preview.models.Fleet - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - resource_group_name: str, - fleet_name: str, - properties: IO[bytes], - if_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Fleet: - """Update a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param properties: The resource properties to be updated. Required. - :type properties: IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: Fleet or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2022_06_02_preview.models.Fleet - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update( - self, - resource_group_name: str, - fleet_name: str, - properties: Union[_models.FleetPatch, IO[bytes]], - if_match: Optional[str] = None, - **kwargs: Any - ) -> _models.Fleet: - """Update a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param properties: The resource properties to be updated. Is either a FleetPatch type or a - IO[bytes] type. Required. - :type properties: ~azure.mgmt.containerservicefleet.v2022_06_02_preview.models.FleetPatch or - IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :return: Fleet or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2022_06_02_preview.models.Fleet - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-02-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Fleet] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties - else: - _json = self._serialize.body(properties, "FleetPatch") - - _request = build_update_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Fleet", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _delete_initial( - self, resource_group_name: str, fleet_name: str, if_match: Optional[str] = None, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-02-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, fleet_name: str, if_match: Optional[str] = None, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Delete a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-02-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - if_match=if_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace_async - async def list_credentials( - self, resource_group_name: str, fleet_name: str, **kwargs: Any - ) -> _models.FleetCredentialResults: - """Lists the user credentials of a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :return: FleetCredentialResults or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2022_06_02_preview.models.FleetCredentialResults - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-02-preview") - ) - cls: ClsType[_models.FleetCredentialResults] = kwargs.pop("cls", None) - - _request = build_list_credentials_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("FleetCredentialResults", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_06_02_preview/aio/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_06_02_preview/aio/operations/_operations.py deleted file mode 100644 index ad06b3c944a65..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_06_02_preview/aio/operations/_operations.py +++ /dev/null @@ -1,134 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ...operations._operations import build_list_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class Operations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.containerservicefleet.v2022_06_02_preview.aio.ContainerServiceFleetMgmtClient`'s - :attr:`operations` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: - """List the operations for the provider. - - :return: An iterator like instance of either Operation or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservicefleet.v2022_06_02_preview.models.Operation] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-02-preview") - ) - cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("OperationListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_06_02_preview/models/__init__.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_06_02_preview/models/__init__.py deleted file mode 100644 index a6279d514074b..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_06_02_preview/models/__init__.py +++ /dev/null @@ -1,63 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._models_py3 import ErrorAdditionalInfo -from ._models_py3 import ErrorDetail -from ._models_py3 import ErrorResponse -from ._models_py3 import Fleet -from ._models_py3 import FleetCredentialResult -from ._models_py3 import FleetCredentialResults -from ._models_py3 import FleetHubProfile -from ._models_py3 import FleetListResult -from ._models_py3 import FleetMember -from ._models_py3 import FleetMemberListResult -from ._models_py3 import FleetPatch -from ._models_py3 import Operation -from ._models_py3 import OperationDisplay -from ._models_py3 import OperationListResult -from ._models_py3 import ProxyResource -from ._models_py3 import Resource -from ._models_py3 import SystemData -from ._models_py3 import TrackedResource - -from ._container_service_fleet_mgmt_client_enums import ActionType -from ._container_service_fleet_mgmt_client_enums import CreatedByType -from ._container_service_fleet_mgmt_client_enums import FleetMemberProvisioningState -from ._container_service_fleet_mgmt_client_enums import FleetProvisioningState -from ._container_service_fleet_mgmt_client_enums import Origin -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ErrorAdditionalInfo", - "ErrorDetail", - "ErrorResponse", - "Fleet", - "FleetCredentialResult", - "FleetCredentialResults", - "FleetHubProfile", - "FleetListResult", - "FleetMember", - "FleetMemberListResult", - "FleetPatch", - "Operation", - "OperationDisplay", - "OperationListResult", - "ProxyResource", - "Resource", - "SystemData", - "TrackedResource", - "ActionType", - "CreatedByType", - "FleetMemberProvisioningState", - "FleetProvisioningState", - "Origin", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_06_02_preview/models/_container_service_fleet_mgmt_client_enums.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_06_02_preview/models/_container_service_fleet_mgmt_client_enums.py deleted file mode 100644 index 8a81ffa68d433..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_06_02_preview/models/_container_service_fleet_mgmt_client_enums.py +++ /dev/null @@ -1,69 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from enum import Enum -from azure.core import CaseInsensitiveEnumMeta - - -class ActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs.""" - - INTERNAL = "Internal" - - -class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of identity that created the resource.""" - - USER = "User" - APPLICATION = "Application" - MANAGED_IDENTITY = "ManagedIdentity" - KEY = "Key" - - -class FleetMemberProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The provisioning state of the last accepted operation.""" - - SUCCEEDED = "Succeeded" - """Resource has been created.""" - FAILED = "Failed" - """Resource creation failed.""" - CANCELED = "Canceled" - """Resource creation was canceled.""" - JOINING = "Joining" - """The provisioning state of a member joining a fleet.""" - LEAVING = "Leaving" - """The provisioning state of a member leaving a fleet.""" - UPDATING = "Updating" - """The provisioning state of a member being updated.""" - - -class FleetProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The provisioning state of the last accepted operation.""" - - SUCCEEDED = "Succeeded" - """Resource has been created.""" - FAILED = "Failed" - """Resource creation failed.""" - CANCELED = "Canceled" - """Resource creation was canceled.""" - CREATING = "Creating" - """The provisioning state of a fleet being created.""" - UPDATING = "Updating" - """The provisioning state of a fleet being updated.""" - DELETING = "Deleting" - """The provisioning state of a fleet being deleted.""" - - -class Origin(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit - logs UX. Default value is "user,system". - """ - - USER = "user" - SYSTEM = "system" - USER_SYSTEM = "user,system" diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_06_02_preview/models/_models_py3.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_06_02_preview/models/_models_py3.py deleted file mode 100644 index e7d934c0dc7fb..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_06_02_preview/models/_models_py3.py +++ /dev/null @@ -1,738 +0,0 @@ -# coding=utf-8 -# pylint: disable=too-many-lines -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights 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 Any, Dict, List, Optional, TYPE_CHECKING, Union - -from ... import _serialization - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from .. import models as _models - - -class ErrorAdditionalInfo(_serialization.Model): - """The resource management error additional info. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar type: The additional info type. - :vartype type: str - :ivar info: The additional info. - :vartype info: JSON - """ - - _validation = { - "type": {"readonly": True}, - "info": {"readonly": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "info": {"key": "info", "type": "object"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.type = None - self.info = None - - -class ErrorDetail(_serialization.Model): - """The error detail. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar code: The error code. - :vartype code: str - :ivar message: The error message. - :vartype message: str - :ivar target: The error target. - :vartype target: str - :ivar details: The error details. - :vartype details: - list[~azure.mgmt.containerservicefleet.v2022_06_02_preview.models.ErrorDetail] - :ivar additional_info: The error additional info. - :vartype additional_info: - list[~azure.mgmt.containerservicefleet.v2022_06_02_preview.models.ErrorAdditionalInfo] - """ - - _validation = { - "code": {"readonly": True}, - "message": {"readonly": True}, - "target": {"readonly": True}, - "details": {"readonly": True}, - "additional_info": {"readonly": True}, - } - - _attribute_map = { - "code": {"key": "code", "type": "str"}, - "message": {"key": "message", "type": "str"}, - "target": {"key": "target", "type": "str"}, - "details": {"key": "details", "type": "[ErrorDetail]"}, - "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.code = None - self.message = None - self.target = None - self.details = None - self.additional_info = None - - -class ErrorResponse(_serialization.Model): - """Common error response for all Azure Resource Manager APIs to return error details for failed - operations. (This also follows the OData error response format.). - - :ivar error: The error object. - :vartype error: ~azure.mgmt.containerservicefleet.v2022_06_02_preview.models.ErrorDetail - """ - - _attribute_map = { - "error": {"key": "error", "type": "ErrorDetail"}, - } - - def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: Any) -> None: - """ - :keyword error: The error object. - :paramtype error: ~azure.mgmt.containerservicefleet.v2022_06_02_preview.models.ErrorDetail - """ - super().__init__(**kwargs) - self.error = error - - -class Resource(_serialization.Model): - """Common fields that are returned in the response for all Azure Resource Manager resources. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.containerservicefleet.v2022_06_02_preview.models.SystemData - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.system_data = None - - -class TrackedResource(Resource): - """The resource model definition for an Azure Resource Manager tracked top level resource which - has 'tags' and a 'location'. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.containerservicefleet.v2022_06_02_preview.models.SystemData - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "location": {"required": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - } - - def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - """ - super().__init__(**kwargs) - self.tags = tags - self.location = location - - -class Fleet(TrackedResource): - """The Fleet 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 server. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.containerservicefleet.v2022_06_02_preview.models.SystemData - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - :ivar e_tag: If eTag is provided in the response body, it may also be provided as a header per - the normal etag convention. Entity tags are used for comparing two or more entities from the - same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match - (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. - :vartype e_tag: str - :ivar provisioning_state: The status of the last operation. Known values are: "Succeeded", - "Failed", "Canceled", "Creating", "Updating", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.containerservicefleet.v2022_06_02_preview.models.FleetProvisioningState - :ivar hub_profile: The FleetHubProfile configures the Fleet's hub. - :vartype hub_profile: - ~azure.mgmt.containerservicefleet.v2022_06_02_preview.models.FleetHubProfile - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "location": {"required": True}, - "e_tag": {"readonly": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - "e_tag": {"key": "eTag", "type": "str"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "hub_profile": {"key": "properties.hubProfile", "type": "FleetHubProfile"}, - } - - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - hub_profile: Optional["_models.FleetHubProfile"] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - :keyword hub_profile: The FleetHubProfile configures the Fleet's hub. - :paramtype hub_profile: - ~azure.mgmt.containerservicefleet.v2022_06_02_preview.models.FleetHubProfile - """ - super().__init__(tags=tags, location=location, **kwargs) - self.e_tag = None - self.provisioning_state = None - self.hub_profile = hub_profile - - -class FleetCredentialResult(_serialization.Model): - """One credential result item. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: The name of the credential. - :vartype name: str - :ivar value: Base64-encoded Kubernetes configuration file. - :vartype value: bytes - """ - - _validation = { - "name": {"readonly": True}, - "value": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "value": {"key": "value", "type": "bytearray"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.value = None - - -class FleetCredentialResults(_serialization.Model): - """The Credential results response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar kubeconfigs: Array of base64-encoded Kubernetes configuration files. - :vartype kubeconfigs: - list[~azure.mgmt.containerservicefleet.v2022_06_02_preview.models.FleetCredentialResult] - """ - - _validation = { - "kubeconfigs": {"readonly": True}, - } - - _attribute_map = { - "kubeconfigs": {"key": "kubeconfigs", "type": "[FleetCredentialResult]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.kubeconfigs = None - - -class FleetHubProfile(_serialization.Model): - """The FleetHubProfile configures the fleet hub. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar dns_prefix: DNS prefix used to create the FQDN for the Fleet hub. - :vartype dns_prefix: str - :ivar fqdn: The FQDN of the Fleet hub. - :vartype fqdn: str - :ivar kubernetes_version: The Kubernetes version of the Fleet hub. - :vartype kubernetes_version: str - """ - - _validation = { - "dns_prefix": { - "max_length": 54, - "min_length": 1, - "pattern": r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][a-zA-Z0-9-]{0,52}[a-zA-Z0-9]$", - }, - "fqdn": {"readonly": True}, - "kubernetes_version": {"readonly": True}, - } - - _attribute_map = { - "dns_prefix": {"key": "dnsPrefix", "type": "str"}, - "fqdn": {"key": "fqdn", "type": "str"}, - "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, - } - - def __init__(self, *, dns_prefix: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword dns_prefix: DNS prefix used to create the FQDN for the Fleet hub. - :paramtype dns_prefix: str - """ - super().__init__(**kwargs) - self.dns_prefix = dns_prefix - self.fqdn = None - self.kubernetes_version = None - - -class FleetListResult(_serialization.Model): - """The response of a Fleet list operation. - - All required parameters must be populated in order to send to server. - - :ivar value: The Fleet items on this page. Required. - :vartype value: list[~azure.mgmt.containerservicefleet.v2022_06_02_preview.models.Fleet] - :ivar next_link: The link to the next page of items. - :vartype next_link: str - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[Fleet]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, *, value: List["_models.Fleet"], next_link: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword value: The Fleet items on this page. Required. - :paramtype value: list[~azure.mgmt.containerservicefleet.v2022_06_02_preview.models.Fleet] - :keyword next_link: The link to the next page of items. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ProxyResource(Resource): - """The resource model definition for a Azure Resource Manager proxy resource. It will not have - tags and a location. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.containerservicefleet.v2022_06_02_preview.models.SystemData - """ - - -class FleetMember(ProxyResource): - """A member of the Fleet. It contains a reference to an existing Kubernetes cluster on Azure. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.containerservicefleet.v2022_06_02_preview.models.SystemData - :ivar e_tag: If eTag is provided in the response body, it may also be provided as a header per - the normal etag convention. Entity tags are used for comparing two or more entities from the - same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match - (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. - :vartype e_tag: str - :ivar cluster_resource_id: The ARM resource id of the cluster that joins the Fleet. Must be a - valid Azure resource id. e.g.: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{clusterName}'. # pylint: disable=line-too-long - :vartype cluster_resource_id: str - :ivar provisioning_state: The status of the last operation. Known values are: "Succeeded", - "Failed", "Canceled", "Joining", "Leaving", and "Updating". - :vartype provisioning_state: str or - ~azure.mgmt.containerservicefleet.v2022_06_02_preview.models.FleetMemberProvisioningState - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "e_tag": {"readonly": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "e_tag": {"key": "eTag", "type": "str"}, - "cluster_resource_id": {"key": "properties.clusterResourceId", "type": "str"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - } - - def __init__(self, *, cluster_resource_id: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword cluster_resource_id: The ARM resource id of the cluster that joins the Fleet. Must be - a valid Azure resource id. e.g.: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{clusterName}'. # pylint: disable=line-too-long - :paramtype cluster_resource_id: str - """ - super().__init__(**kwargs) - self.e_tag = None - self.cluster_resource_id = cluster_resource_id - self.provisioning_state = None - - -class FleetMemberListResult(_serialization.Model): - """The response of a FleetMember list operation. - - All required parameters must be populated in order to send to server. - - :ivar value: The FleetMember items on this page. Required. - :vartype value: list[~azure.mgmt.containerservicefleet.v2022_06_02_preview.models.FleetMember] - :ivar next_link: The link to the next page of items. - :vartype next_link: str - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[FleetMember]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, *, value: List["_models.FleetMember"], next_link: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword value: The FleetMember items on this page. Required. - :paramtype value: - list[~azure.mgmt.containerservicefleet.v2022_06_02_preview.models.FleetMember] - :keyword next_link: The link to the next page of items. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class FleetPatch(_serialization.Model): - """Properties of a Fleet that can be patched. - - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - """ - - _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - } - - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - """ - super().__init__(**kwargs) - self.tags = tags - - -class Operation(_serialization.Model): - """Details of a REST API operation, returned from the Resource Provider Operations API. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: - "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". - :vartype name: str - :ivar is_data_action: Whether the operation applies to data-plane. This is "true" for - data-plane operations and "false" for ARM/control-plane operations. - :vartype is_data_action: bool - :ivar display: Localized display information for this particular operation. - :vartype display: ~azure.mgmt.containerservicefleet.v2022_06_02_preview.models.OperationDisplay - :ivar origin: The intended executor of the operation; as in Resource Based Access Control - (RBAC) and audit logs UX. Default value is "user,system". Known values are: "user", "system", - and "user,system". - :vartype origin: str or ~azure.mgmt.containerservicefleet.v2022_06_02_preview.models.Origin - :ivar action_type: Enum. Indicates the action type. "Internal" refers to actions that are for - internal only APIs. "Internal" - :vartype action_type: str or - ~azure.mgmt.containerservicefleet.v2022_06_02_preview.models.ActionType - """ - - _validation = { - "name": {"readonly": True}, - "is_data_action": {"readonly": True}, - "origin": {"readonly": True}, - "action_type": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "is_data_action": {"key": "isDataAction", "type": "bool"}, - "display": {"key": "display", "type": "OperationDisplay"}, - "origin": {"key": "origin", "type": "str"}, - "action_type": {"key": "actionType", "type": "str"}, - } - - def __init__(self, *, display: Optional["_models.OperationDisplay"] = None, **kwargs: Any) -> None: - """ - :keyword display: Localized display information for this particular operation. - :paramtype display: - ~azure.mgmt.containerservicefleet.v2022_06_02_preview.models.OperationDisplay - """ - super().__init__(**kwargs) - self.name = None - self.is_data_action = None - self.display = display - self.origin = None - self.action_type = None - - -class OperationDisplay(_serialization.Model): - """Localized display information for this particular operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provider: The localized friendly form of the resource provider name, e.g. "Microsoft - Monitoring Insights" or "Microsoft Compute". - :vartype provider: str - :ivar resource: The localized friendly name of the resource type related to this operation. - E.g. "Virtual Machines" or "Job Schedule Collections". - :vartype resource: str - :ivar operation: The concise, localized friendly name for the operation; suitable for - dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual Machine". - :vartype operation: str - :ivar description: The short, localized friendly description of the operation; suitable for - tool tips and detailed views. - :vartype description: str - """ - - _validation = { - "provider": {"readonly": True}, - "resource": {"readonly": True}, - "operation": {"readonly": True}, - "description": {"readonly": True}, - } - - _attribute_map = { - "provider": {"key": "provider", "type": "str"}, - "resource": {"key": "resource", "type": "str"}, - "operation": {"key": "operation", "type": "str"}, - "description": {"key": "description", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.provider = None - self.resource = None - self.operation = None - self.description = None - - -class OperationListResult(_serialization.Model): - """A list of REST API operations supported by an Azure Resource Provider. It contains an URL link - to get the next set of results. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of operations supported by the resource provider. - :vartype value: list[~azure.mgmt.containerservicefleet.v2022_06_02_preview.models.Operation] - :ivar next_link: URL to get the next set of operation list results (if there are any). - :vartype next_link: str - """ - - _validation = { - "value": {"readonly": True}, - "next_link": {"readonly": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[Operation]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.value = None - self.next_link = None - - -class SystemData(_serialization.Model): - """Metadata pertaining to creation and last modification of the resource. - - :ivar created_by: The identity that created the resource. - :vartype created_by: str - :ivar created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", and "Key". - :vartype created_by_type: str or - ~azure.mgmt.containerservicefleet.v2022_06_02_preview.models.CreatedByType - :ivar created_at: The timestamp of resource creation (UTC). - :vartype created_at: ~datetime.datetime - :ivar last_modified_by: The identity that last modified the resource. - :vartype last_modified_by: str - :ivar last_modified_by_type: The type of identity that last modified the resource. Known values - are: "User", "Application", "ManagedIdentity", and "Key". - :vartype last_modified_by_type: str or - ~azure.mgmt.containerservicefleet.v2022_06_02_preview.models.CreatedByType - :ivar last_modified_at: The timestamp of resource last modification (UTC). - :vartype last_modified_at: ~datetime.datetime - """ - - _attribute_map = { - "created_by": {"key": "createdBy", "type": "str"}, - "created_by_type": {"key": "createdByType", "type": "str"}, - "created_at": {"key": "createdAt", "type": "iso-8601"}, - "last_modified_by": {"key": "lastModifiedBy", "type": "str"}, - "last_modified_by_type": {"key": "lastModifiedByType", "type": "str"}, - "last_modified_at": {"key": "lastModifiedAt", "type": "iso-8601"}, - } - - def __init__( - self, - *, - created_by: Optional[str] = None, - created_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, - created_at: Optional[datetime.datetime] = None, - last_modified_by: Optional[str] = None, - last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, - last_modified_at: Optional[datetime.datetime] = None, - **kwargs: Any - ) -> None: - """ - :keyword created_by: The identity that created the resource. - :paramtype created_by: str - :keyword created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", and "Key". - :paramtype created_by_type: str or - ~azure.mgmt.containerservicefleet.v2022_06_02_preview.models.CreatedByType - :keyword created_at: The timestamp of resource creation (UTC). - :paramtype created_at: ~datetime.datetime - :keyword last_modified_by: The identity that last modified the resource. - :paramtype last_modified_by: str - :keyword last_modified_by_type: The type of identity that last modified the resource. Known - values are: "User", "Application", "ManagedIdentity", and "Key". - :paramtype last_modified_by_type: str or - ~azure.mgmt.containerservicefleet.v2022_06_02_preview.models.CreatedByType - :keyword last_modified_at: The timestamp of resource last modification (UTC). - :paramtype last_modified_at: ~datetime.datetime - """ - super().__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 diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_06_02_preview/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_06_02_preview/operations/__init__.py deleted file mode 100644 index a2f694539aa69..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_06_02_preview/operations/__init__.py +++ /dev/null @@ -1,23 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._operations import Operations -from ._fleets_operations import FleetsOperations -from ._fleet_members_operations import FleetMembersOperations - -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "Operations", - "FleetsOperations", - "FleetMembersOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_06_02_preview/operations/_fleet_members_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_06_02_preview/operations/_fleet_members_operations.py deleted file mode 100644 index 2208c082050d9..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_06_02_preview/operations/_fleet_members_operations.py +++ /dev/null @@ -1,786 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_fleet_request( - resource_group_name: str, fleet_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-02-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, fleet_name: str, fleet_member_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-02-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - "fleetMemberName": _SERIALIZER.url( - "fleet_member_name", - fleet_member_name, - "str", - max_length=50, - min_length=1, - pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_request( - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-02-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - "fleetMemberName": _SERIALIZER.url( - "fleet_member_name", - fleet_member_name, - "str", - max_length=50, - min_length=1, - pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if if_none_match is not None: - _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-02-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - "fleetMemberName": _SERIALIZER.url( - "fleet_member_name", - fleet_member_name, - "str", - max_length=50, - min_length=1, - pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -class FleetMembersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.containerservicefleet.v2022_06_02_preview.ContainerServiceFleetMgmtClient`'s - :attr:`fleet_members` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_by_fleet( - self, resource_group_name: str, fleet_name: str, **kwargs: Any - ) -> Iterable["_models.FleetMember"]: - """List FleetMember resources by Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :return: An iterator like instance of either FleetMember or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservicefleet.v2022_06_02_preview.models.FleetMember] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-02-preview") - ) - cls: ClsType[_models.FleetMemberListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_fleet_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("FleetMemberListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get( - self, resource_group_name: str, fleet_name: str, fleet_member_name: str, **kwargs: Any - ) -> _models.FleetMember: - """Get a FleetMember. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :return: FleetMember or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2022_06_02_preview.models.FleetMember - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-02-preview") - ) - cls: ClsType[_models.FleetMember] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - fleet_member_name=fleet_member_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("FleetMember", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_initial( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - resource: Union[_models.FleetMember, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-02-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "FleetMember") - - _request = build_create_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - fleet_member_name=fleet_member_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - resource: _models.FleetMember, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.FleetMember]: - """Create a FleetMember. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :param resource: Resource create parameters. Required. - :type resource: ~azure.mgmt.containerservicefleet.v2022_06_02_preview.models.FleetMember - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either FleetMember or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2022_06_02_preview.models.FleetMember] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - resource: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.FleetMember]: - """Create a FleetMember. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :param resource: Resource create parameters. Required. - :type resource: IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either FleetMember or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2022_06_02_preview.models.FleetMember] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - resource: Union[_models.FleetMember, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[_models.FleetMember]: - """Create a FleetMember. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :param resource: Resource create parameters. Is either a FleetMember type or a IO[bytes] type. - Required. - :type resource: ~azure.mgmt.containerservicefleet.v2022_06_02_preview.models.FleetMember or - IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :return: An instance of LROPoller that returns either FleetMember or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2022_06_02_preview.models.FleetMember] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-02-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FleetMember] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - fleet_member_name=fleet_member_name, - resource=resource, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FleetMember", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.FleetMember].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.FleetMember]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-02-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - fleet_member_name=fleet_member_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[None]: - """Delete a FleetMember. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-02-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - fleet_member_name=fleet_member_name, - if_match=if_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_06_02_preview/operations/_fleets_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_06_02_preview/operations/_fleets_operations.py deleted file mode 100644 index 6466a8e97e2eb..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_06_02_preview/operations/_fleets_operations.py +++ /dev/null @@ -1,1092 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-02-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/fleets") - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-02-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request(resource_group_name: str, fleet_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-02-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - fleet_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-02-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if if_none_match is not None: - _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, fleet_name: str, subscription_id: str, *, if_match: Optional[str] = None, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-02-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, fleet_name: str, subscription_id: str, *, if_match: Optional[str] = None, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-02-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_credentials_request( - resource_group_name: str, fleet_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-02-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/listCredentials", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class FleetsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.containerservicefleet.v2022_06_02_preview.ContainerServiceFleetMgmtClient`'s - :attr:`fleets` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.Fleet"]: - """Lists fleets in the specified subscription. - - :return: An iterator like instance of either Fleet or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservicefleet.v2022_06_02_preview.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-02-preview") - ) - cls: ClsType[_models.FleetListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("FleetListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Fleet"]: - """Lists fleets in the specified subscription and resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :return: An iterator like instance of either Fleet or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservicefleet.v2022_06_02_preview.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-02-preview") - ) - cls: ClsType[_models.FleetListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("FleetListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get(self, resource_group_name: str, fleet_name: str, **kwargs: Any) -> _models.Fleet: - """Gets a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :return: Fleet or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2022_06_02_preview.models.Fleet - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-02-preview") - ) - cls: ClsType[_models.Fleet] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Fleet", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - fleet_name: str, - resource: Union[_models.Fleet, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-02-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "Fleet") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - resource: _models.Fleet, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Fleet]: - """Creates or updates a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param resource: Resource create parameters. Required. - :type resource: ~azure.mgmt.containerservicefleet.v2022_06_02_preview.models.Fleet - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either Fleet or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2022_06_02_preview.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - resource: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Fleet]: - """Creates or updates a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param resource: Resource create parameters. Required. - :type resource: IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either Fleet or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2022_06_02_preview.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - resource: Union[_models.Fleet, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[_models.Fleet]: - """Creates or updates a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param resource: Resource create parameters. Is either a Fleet type or a IO[bytes] type. - Required. - :type resource: ~azure.mgmt.containerservicefleet.v2022_06_02_preview.models.Fleet or IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :return: An instance of LROPoller that returns either Fleet or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2022_06_02_preview.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-02-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Fleet] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - resource=resource, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Fleet", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.Fleet].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.Fleet]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @overload - def update( - self, - resource_group_name: str, - fleet_name: str, - properties: _models.FleetPatch, - if_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Fleet: - """Update a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param properties: The resource properties to be updated. Required. - :type properties: ~azure.mgmt.containerservicefleet.v2022_06_02_preview.models.FleetPatch - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Fleet or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2022_06_02_preview.models.Fleet - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( - self, - resource_group_name: str, - fleet_name: str, - properties: IO[bytes], - if_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Fleet: - """Update a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param properties: The resource properties to be updated. Required. - :type properties: IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: Fleet or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2022_06_02_preview.models.Fleet - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update( - self, - resource_group_name: str, - fleet_name: str, - properties: Union[_models.FleetPatch, IO[bytes]], - if_match: Optional[str] = None, - **kwargs: Any - ) -> _models.Fleet: - """Update a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param properties: The resource properties to be updated. Is either a FleetPatch type or a - IO[bytes] type. Required. - :type properties: ~azure.mgmt.containerservicefleet.v2022_06_02_preview.models.FleetPatch or - IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :return: Fleet or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2022_06_02_preview.models.Fleet - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-02-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Fleet] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties - else: - _json = self._serialize.body(properties, "FleetPatch") - - _request = build_update_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Fleet", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _delete_initial( - self, resource_group_name: str, fleet_name: str, if_match: Optional[str] = None, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-02-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, resource_group_name: str, fleet_name: str, if_match: Optional[str] = None, **kwargs: Any - ) -> LROPoller[None]: - """Delete a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-02-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - if_match=if_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list_credentials( - self, resource_group_name: str, fleet_name: str, **kwargs: Any - ) -> _models.FleetCredentialResults: - """Lists the user credentials of a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :return: FleetCredentialResults or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2022_06_02_preview.models.FleetCredentialResults - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-02-preview") - ) - cls: ClsType[_models.FleetCredentialResults] = kwargs.pop("cls", None) - - _request = build_list_credentials_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("FleetCredentialResults", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_06_02_preview/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_06_02_preview/operations/_operations.py deleted file mode 100644 index d6bfe32d7368b..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_06_02_preview/operations/_operations.py +++ /dev/null @@ -1,156 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-09-02-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.ContainerService/operations") - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class Operations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.containerservicefleet.v2022_06_02_preview.ContainerServiceFleetMgmtClient`'s - :attr:`operations` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: - """List the operations for the provider. - - :return: An iterator like instance of either Operation or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservicefleet.v2022_06_02_preview.models.Operation] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-09-02-preview") - ) - cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - 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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_06_02_preview/py.typed b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_06_02_preview/py.typed deleted file mode 100644 index e5aff4f83af86..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_06_02_preview/py.typed +++ /dev/null @@ -1 +0,0 @@ -# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_07_02_preview/__init__.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_07_02_preview/__init__.py deleted file mode 100644 index 78b8b4b91a49e..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_07_02_preview/__init__.py +++ /dev/null @@ -1,26 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._container_service_fleet_mgmt_client import ContainerServiceFleetMgmtClient -from ._version import VERSION - -__version__ = VERSION - -try: - from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ContainerServiceFleetMgmtClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) - -_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_07_02_preview/_configuration.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_07_02_preview/_configuration.py deleted file mode 100644 index 52e04984a75f3..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_07_02_preview/_configuration.py +++ /dev/null @@ -1,65 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any, TYPE_CHECKING - -from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy - -from ._version import VERSION - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials import TokenCredential - - -class ContainerServiceFleetMgmtClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long - """Configuration for ContainerServiceFleetMgmtClient. - - 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. Required. - :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :keyword api_version: Api Version. Default value is "2022-07-02-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2022-07-02-preview") - - if credential is None: - raise ValueError("Parameter 'credential' must not be None.") - if subscription_id is None: - raise ValueError("Parameter 'subscription_id' must not be None.") - - self.credential = credential - self.subscription_id = subscription_id - self.api_version = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-containerservicefleet/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - 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.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") - if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_07_02_preview/_container_service_fleet_mgmt_client.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_07_02_preview/_container_service_fleet_mgmt_client.py deleted file mode 100644 index 925f27a0f9cd0..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_07_02_preview/_container_service_fleet_mgmt_client.py +++ /dev/null @@ -1,121 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, TYPE_CHECKING -from typing_extensions import Self - -from azure.core.pipeline import policies -from azure.core.rest import HttpRequest, HttpResponse -from azure.mgmt.core import ARMPipelineClient -from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy - -from . import models as _models -from .._serialization import Deserializer, Serializer -from ._configuration import ContainerServiceFleetMgmtClientConfiguration -from .operations import FleetMembersOperations, FleetsOperations - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials import TokenCredential - - -class ContainerServiceFleetMgmtClient: # pylint: disable=client-accepts-api-version-keyword - """The Container Service Client. - - :ivar fleets: FleetsOperations operations - :vartype fleets: - azure.mgmt.containerservicefleet.v2022_07_02_preview.operations.FleetsOperations - :ivar fleet_members: FleetMembersOperations operations - :vartype fleet_members: - azure.mgmt.containerservicefleet.v2022_07_02_preview.operations.FleetMembersOperations - :param credential: Credential needed for the client to connect to Azure. Required. - :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". - :type base_url: str - :keyword api_version: Api Version. Default value is "2022-07-02-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - """ - - def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any - ) -> None: - self._config = ContainerServiceFleetMgmtClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs - ) - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - ARMAutoResourceProviderRegistrationPolicy(), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) - - client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer(client_models) - self._deserialize = Deserializer(client_models) - self._serialize.client_side_validation = False - self.fleets = FleetsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-07-02-preview" - ) - self.fleet_members = FleetMembersOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-07-02-preview" - ) - - def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.HttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore - - def close(self) -> None: - self._client.close() - - def __enter__(self) -> Self: - self._client.__enter__() - return self - - def __exit__(self, *exc_details: Any) -> None: - self._client.__exit__(*exc_details) diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_07_02_preview/_metadata.json b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_07_02_preview/_metadata.json deleted file mode 100644 index 8ad9174f215c9..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_07_02_preview/_metadata.json +++ /dev/null @@ -1,111 +0,0 @@ -{ - "chosen_version": "2022-07-02-preview", - "total_api_version_list": ["2022-07-02-preview"], - "client": { - "name": "ContainerServiceFleetMgmtClient", - "filename": "_container_service_fleet_mgmt_client", - "description": "The Container Service Client.", - "host_value": "\"https://management.azure.com\"", - "parameterized_host_template": null, - "azure_arm": true, - "has_public_lro_operations": true, - "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ContainerServiceFleetMgmtClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ContainerServiceFleetMgmtClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" - }, - "global_parameters": { - "sync": { - "credential": { - "signature": "credential: \"TokenCredential\",", - "description": "Credential needed for the client to connect to Azure. Required.", - "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true, - "method_location": "positional" - }, - "subscription_id": { - "signature": "subscription_id: str,", - "description": "The ID of the target subscription. Required.", - "docstring_type": "str", - "required": true, - "method_location": "positional" - } - }, - "async": { - "credential": { - "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure. Required.", - "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", - "required": true - }, - "subscription_id": { - "signature": "subscription_id: str,", - "description": "The ID of the target subscription. Required.", - "docstring_type": "str", - "required": true - } - }, - "constant": { - }, - "call": "credential, subscription_id", - "service_client_specific": { - "sync": { - "api_version": { - "signature": "api_version: Optional[str]=None,", - "description": "API version to use if no profile is provided, or if missing in profile.", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", - "description": "Service URL", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "profile": { - "signature": "profile: KnownProfiles=KnownProfiles.default,", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false, - "method_location": "positional" - } - }, - "async": { - "api_version": { - "signature": "api_version: Optional[str] = None,", - "description": "API version to use if no profile is provided, or if missing in profile.", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", - "description": "Service URL", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "profile": { - "signature": "profile: KnownProfiles = KnownProfiles.default,", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false, - "method_location": "positional" - } - } - } - }, - "config": { - "credential": true, - "credential_scopes": ["https://management.azure.com/.default"], - "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", - "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", - "sync_imports": "{\"regular\": {\"sdkcore\": {\"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"sdkcore\": {\"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" - }, - "operation_groups": { - "fleets": "FleetsOperations", - "fleet_members": "FleetMembersOperations" - } -} diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_07_02_preview/_patch.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_07_02_preview/_patch.py deleted file mode 100644 index f7dd32510333d..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_07_02_preview/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_07_02_preview/_version.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_07_02_preview/_version.py deleted file mode 100644 index 83f24ab509461..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_07_02_preview/_version.py +++ /dev/null @@ -1,9 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -VERSION = "2.1.0" diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_07_02_preview/aio/__init__.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_07_02_preview/aio/__init__.py deleted file mode 100644 index af1d7b0b47fe9..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_07_02_preview/aio/__init__.py +++ /dev/null @@ -1,23 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._container_service_fleet_mgmt_client import ContainerServiceFleetMgmtClient - -try: - from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ContainerServiceFleetMgmtClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) - -_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_07_02_preview/aio/_configuration.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_07_02_preview/aio/_configuration.py deleted file mode 100644 index d3bd0c57672c7..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_07_02_preview/aio/_configuration.py +++ /dev/null @@ -1,65 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any, TYPE_CHECKING - -from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy - -from .._version import VERSION - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential - - -class ContainerServiceFleetMgmtClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long - """Configuration for ContainerServiceFleetMgmtClient. - - 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. Required. - :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :keyword api_version: Api Version. Default value is "2022-07-02-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2022-07-02-preview") - - if credential is None: - raise ValueError("Parameter 'credential' must not be None.") - if subscription_id is None: - raise ValueError("Parameter 'subscription_id' must not be None.") - - self.credential = credential - self.subscription_id = subscription_id - self.api_version = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-containerservicefleet/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - 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.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") - if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_07_02_preview/aio/_container_service_fleet_mgmt_client.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_07_02_preview/aio/_container_service_fleet_mgmt_client.py deleted file mode 100644 index 5fe77cc4b6478..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_07_02_preview/aio/_container_service_fleet_mgmt_client.py +++ /dev/null @@ -1,123 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING -from typing_extensions import Self - -from azure.core.pipeline import policies -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.mgmt.core import AsyncARMPipelineClient -from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy - -from .. import models as _models -from ..._serialization import Deserializer, Serializer -from ._configuration import ContainerServiceFleetMgmtClientConfiguration -from .operations import FleetMembersOperations, FleetsOperations - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential - - -class ContainerServiceFleetMgmtClient: # pylint: disable=client-accepts-api-version-keyword - """The Container Service Client. - - :ivar fleets: FleetsOperations operations - :vartype fleets: - azure.mgmt.containerservicefleet.v2022_07_02_preview.aio.operations.FleetsOperations - :ivar fleet_members: FleetMembersOperations operations - :vartype fleet_members: - azure.mgmt.containerservicefleet.v2022_07_02_preview.aio.operations.FleetMembersOperations - :param credential: Credential needed for the client to connect to Azure. Required. - :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". - :type base_url: str - :keyword api_version: Api Version. Default value is "2022-07-02-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - """ - - def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any - ) -> None: - self._config = ContainerServiceFleetMgmtClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs - ) - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - AsyncARMAutoResourceProviderRegistrationPolicy(), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) - - client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer(client_models) - self._deserialize = Deserializer(client_models) - self._serialize.client_side_validation = False - self.fleets = FleetsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-07-02-preview" - ) - self.fleet_members = FleetMembersOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-07-02-preview" - ) - - def _send_request( - self, request: HttpRequest, *, stream: bool = False, **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = await client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.AsyncHttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore - - async def close(self) -> None: - await self._client.close() - - async def __aenter__(self) -> Self: - await self._client.__aenter__() - return self - - async def __aexit__(self, *exc_details: Any) -> None: - await self._client.__aexit__(*exc_details) diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_07_02_preview/aio/_patch.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_07_02_preview/aio/_patch.py deleted file mode 100644 index f7dd32510333d..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_07_02_preview/aio/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_07_02_preview/aio/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_07_02_preview/aio/operations/__init__.py deleted file mode 100644 index 46d49389d790f..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_07_02_preview/aio/operations/__init__.py +++ /dev/null @@ -1,21 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._fleets_operations import FleetsOperations -from ._fleet_members_operations import FleetMembersOperations - -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "FleetsOperations", - "FleetMembersOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_07_02_preview/aio/operations/_fleet_members_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_07_02_preview/aio/operations/_fleet_members_operations.py deleted file mode 100644 index fa695876585cb..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_07_02_preview/aio/operations/_fleet_members_operations.py +++ /dev/null @@ -1,615 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._fleet_members_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_by_fleet_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class FleetMembersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.containerservicefleet.v2022_07_02_preview.aio.ContainerServiceFleetMgmtClient`'s - :attr:`fleet_members` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - async def _create_or_update_initial( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - parameters: Union[_models.FleetMember, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-07-02-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "FleetMember") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - fleet_member_name=fleet_member_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - parameters: _models.FleetMember, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.FleetMember]: - """Creates or updates a fleet member. - - A member contains a reference to an existing Kubernetes cluster. Creating a member makes the - referenced cluster join the Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :param parameters: The Fleet member to create or update. Required. - :type parameters: ~azure.mgmt.containerservicefleet.v2022_07_02_preview.models.FleetMember - :param if_match: Omit this value to always overwrite the current resource. Specify the - last-seen ETag value to prevent accidentally overwriting concurrent changes. Default value is - None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new resource to be created and prevent updating an - existing resource. Other values will result in a 412 Pre-condition Failed response. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either FleetMember or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2022_07_02_preview.models.FleetMember] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - parameters: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.FleetMember]: - """Creates or updates a fleet member. - - A member contains a reference to an existing Kubernetes cluster. Creating a member makes the - referenced cluster join the Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :param parameters: The Fleet member to create or update. Required. - :type parameters: IO[bytes] - :param if_match: Omit this value to always overwrite the current resource. Specify the - last-seen ETag value to prevent accidentally overwriting concurrent changes. Default value is - None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new resource to be created and prevent updating an - existing resource. Other values will result in a 412 Pre-condition Failed response. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either FleetMember or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2022_07_02_preview.models.FleetMember] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - parameters: Union[_models.FleetMember, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.FleetMember]: - """Creates or updates a fleet member. - - A member contains a reference to an existing Kubernetes cluster. Creating a member makes the - referenced cluster join the Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :param parameters: The Fleet member to create or update. Is either a FleetMember type or a - IO[bytes] type. Required. - :type parameters: ~azure.mgmt.containerservicefleet.v2022_07_02_preview.models.FleetMember or - IO[bytes] - :param if_match: Omit this value to always overwrite the current resource. Specify the - last-seen ETag value to prevent accidentally overwriting concurrent changes. Default value is - None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new resource to be created and prevent updating an - existing resource. Other values will result in a 412 Pre-condition Failed response. Default - value is None. - :type if_none_match: str - :return: An instance of AsyncLROPoller that returns either FleetMember or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2022_07_02_preview.models.FleetMember] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-07-02-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FleetMember] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - fleet_member_name=fleet_member_name, - parameters=parameters, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FleetMember", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.FleetMember].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.FleetMember]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace_async - async def get( - self, resource_group_name: str, fleet_name: str, fleet_member_name: str, **kwargs: Any - ) -> _models.FleetMember: - """Gets a Fleet member. - - Gets a Fleet member. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :return: FleetMember or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2022_07_02_preview.models.FleetMember - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-07-02-preview") - ) - cls: ClsType[_models.FleetMember] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - fleet_member_name=fleet_member_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("FleetMember", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _delete_initial( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-07-02-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - fleet_member_name=fleet_member_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Deletes a fleet member. - - Deleting a Fleet member results in the member cluster leaving fleet. The Member azure resource - is deleted upon success. The underlying cluster is not deleted. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :param if_match: Omit this value to always overwrite the current resource. Specify the - last-seen ETag value to prevent accidentally overwriting concurrent changes. Default value is - None. - :type if_match: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-07-02-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - fleet_member_name=fleet_member_name, - if_match=if_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list_by_fleet( - self, resource_group_name: str, fleet_name: str, **kwargs: Any - ) -> AsyncIterable["_models.FleetMember"]: - """Lists the members of a fleet. - - Lists the members of a fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :return: An iterator like instance of either FleetMember or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservicefleet.v2022_07_02_preview.models.FleetMember] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-07-02-preview") - ) - cls: ClsType[_models.FleetMembersListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_fleet_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("FleetMembersListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_07_02_preview/aio/operations/_fleets_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_07_02_preview/aio/operations/_fleets_operations.py deleted file mode 100644 index 0cba1e5f47871..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_07_02_preview/aio/operations/_fleets_operations.py +++ /dev/null @@ -1,876 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._fleets_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_by_resource_group_request, - build_list_credentials_request, - build_list_request, - build_update_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class FleetsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.containerservicefleet.v2022_07_02_preview.aio.ContainerServiceFleetMgmtClient`'s - :attr:`fleets` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - async def _create_or_update_initial( - self, - resource_group_name: str, - fleet_name: str, - parameters: Union[_models.Fleet, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-07-02-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "Fleet") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - parameters: _models.Fleet, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.Fleet]: - """Creates or updates a Fleet. - - Creates or updates a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param parameters: The Fleet to create or update. Required. - :type parameters: ~azure.mgmt.containerservicefleet.v2022_07_02_preview.models.Fleet - :param if_match: Omit this value to always overwrite the current resource. Specify the - last-seen ETag value to prevent accidentally overwriting concurrent changes. Default value is - None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new resource to be created and prevent updating an - existing resource. Other values will result in a 412 Pre-condition Failed response. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either Fleet or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2022_07_02_preview.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - parameters: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.Fleet]: - """Creates or updates a Fleet. - - Creates or updates a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param parameters: The Fleet to create or update. Required. - :type parameters: IO[bytes] - :param if_match: Omit this value to always overwrite the current resource. Specify the - last-seen ETag value to prevent accidentally overwriting concurrent changes. Default value is - None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new resource to be created and prevent updating an - existing resource. Other values will result in a 412 Pre-condition Failed response. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either Fleet or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2022_07_02_preview.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - parameters: Union[_models.Fleet, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.Fleet]: - """Creates or updates a Fleet. - - Creates or updates a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param parameters: The Fleet to create or update. Is either a Fleet type or a IO[bytes] type. - Required. - :type parameters: ~azure.mgmt.containerservicefleet.v2022_07_02_preview.models.Fleet or - IO[bytes] - :param if_match: Omit this value to always overwrite the current resource. Specify the - last-seen ETag value to prevent accidentally overwriting concurrent changes. Default value is - None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new resource to be created and prevent updating an - existing resource. Other values will result in a 412 Pre-condition Failed response. Default - value is None. - :type if_none_match: str - :return: An instance of AsyncLROPoller that returns either Fleet or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2022_07_02_preview.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-07-02-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Fleet] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - parameters=parameters, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Fleet", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.Fleet].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.Fleet]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @overload - async def update( - self, - resource_group_name: str, - fleet_name: str, - if_match: Optional[str] = None, - parameters: Optional[_models.FleetPatch] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Fleet: - """Patches a fleet resource. - - Patches a fleet resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param if_match: Omit this value to always overwrite the current resource. Specify the - last-seen ETag value to prevent accidentally overwriting concurrent changes. Default value is - None. - :type if_match: str - :param parameters: The properties of a Fleet to update. Default value is None. - :type parameters: ~azure.mgmt.containerservicefleet.v2022_07_02_preview.models.FleetPatch - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Fleet or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2022_07_02_preview.models.Fleet - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - resource_group_name: str, - fleet_name: str, - if_match: Optional[str] = None, - parameters: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Fleet: - """Patches a fleet resource. - - Patches a fleet resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param if_match: Omit this value to always overwrite the current resource. Specify the - last-seen ETag value to prevent accidentally overwriting concurrent changes. Default value is - None. - :type if_match: str - :param parameters: The properties of a Fleet to update. Default value is None. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: Fleet or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2022_07_02_preview.models.Fleet - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update( - self, - resource_group_name: str, - fleet_name: str, - if_match: Optional[str] = None, - parameters: Optional[Union[_models.FleetPatch, IO[bytes]]] = None, - **kwargs: Any - ) -> _models.Fleet: - """Patches a fleet resource. - - Patches a fleet resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param if_match: Omit this value to always overwrite the current resource. Specify the - last-seen ETag value to prevent accidentally overwriting concurrent changes. Default value is - None. - :type if_match: str - :param parameters: The properties of a Fleet to update. Is either a FleetPatch type or a - IO[bytes] type. Default value is None. - :type parameters: ~azure.mgmt.containerservicefleet.v2022_07_02_preview.models.FleetPatch or - IO[bytes] - :return: Fleet or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2022_07_02_preview.models.Fleet - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-07-02-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Fleet] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - if parameters is not None: - _json = self._serialize.body(parameters, "FleetPatch") - else: - _json = None - - _request = build_update_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Fleet", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def get(self, resource_group_name: str, fleet_name: str, **kwargs: Any) -> _models.Fleet: - """Gets a Fleet. - - Gets a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :return: Fleet or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2022_07_02_preview.models.Fleet - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-07-02-preview") - ) - cls: ClsType[_models.Fleet] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Fleet", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _delete_initial( - self, resource_group_name: str, fleet_name: str, if_match: Optional[str] = None, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-07-02-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, fleet_name: str, if_match: Optional[str] = None, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Deletes a Fleet. - - Deletes a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param if_match: Omit this value to always overwrite the current resource. Specify the - last-seen ETag value to prevent accidentally overwriting concurrent changes. Default value is - None. - :type if_match: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-07-02-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - if_match=if_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.Fleet"]: - """Lists fleets in the specified subscription and resource group. - - Lists fleets in the specified subscription and resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :return: An iterator like instance of either Fleet or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservicefleet.v2022_07_02_preview.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-07-02-preview") - ) - cls: ClsType[_models.FleetListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("FleetListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace - def list(self, **kwargs: Any) -> AsyncIterable["_models.Fleet"]: - """Lists fleets in the specified subscription. - - Lists fleets in the specified subscription. - - :return: An iterator like instance of either Fleet or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservicefleet.v2022_07_02_preview.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-07-02-preview") - ) - cls: ClsType[_models.FleetListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("FleetListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def list_credentials( - self, resource_group_name: str, fleet_name: str, **kwargs: Any - ) -> _models.FleetCredentialResults: - """Lists the user credentials of a Fleet. - - Lists the user credentials of a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :return: FleetCredentialResults or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2022_07_02_preview.models.FleetCredentialResults - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-07-02-preview") - ) - cls: ClsType[_models.FleetCredentialResults] = kwargs.pop("cls", None) - - _request = build_list_credentials_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("FleetCredentialResults", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_07_02_preview/aio/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_07_02_preview/aio/operations/_patch.py deleted file mode 100644 index f7dd32510333d..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_07_02_preview/aio/operations/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_07_02_preview/models/__init__.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_07_02_preview/models/__init__.py deleted file mode 100644 index 437bdbe8870e1..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_07_02_preview/models/__init__.py +++ /dev/null @@ -1,53 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._models_py3 import AzureEntityResource -from ._models_py3 import ErrorAdditionalInfo -from ._models_py3 import ErrorDetail -from ._models_py3 import ErrorResponse -from ._models_py3 import Fleet -from ._models_py3 import FleetCredentialResult -from ._models_py3 import FleetCredentialResults -from ._models_py3 import FleetHubProfile -from ._models_py3 import FleetListResult -from ._models_py3 import FleetMember -from ._models_py3 import FleetMembersListResult -from ._models_py3 import FleetPatch -from ._models_py3 import Resource -from ._models_py3 import SystemData -from ._models_py3 import TrackedResource - -from ._container_service_fleet_mgmt_client_enums import CreatedByType -from ._container_service_fleet_mgmt_client_enums import FleetMemberProvisioningState -from ._container_service_fleet_mgmt_client_enums import FleetProvisioningState -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "AzureEntityResource", - "ErrorAdditionalInfo", - "ErrorDetail", - "ErrorResponse", - "Fleet", - "FleetCredentialResult", - "FleetCredentialResults", - "FleetHubProfile", - "FleetListResult", - "FleetMember", - "FleetMembersListResult", - "FleetPatch", - "Resource", - "SystemData", - "TrackedResource", - "CreatedByType", - "FleetMemberProvisioningState", - "FleetProvisioningState", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_07_02_preview/models/_container_service_fleet_mgmt_client_enums.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_07_02_preview/models/_container_service_fleet_mgmt_client_enums.py deleted file mode 100644 index c402a954fa545..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_07_02_preview/models/_container_service_fleet_mgmt_client_enums.py +++ /dev/null @@ -1,41 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from enum import Enum -from azure.core import CaseInsensitiveEnumMeta - - -class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of identity that created the resource.""" - - USER = "User" - APPLICATION = "Application" - MANAGED_IDENTITY = "ManagedIdentity" - KEY = "Key" - - -class FleetMemberProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The provisioning state of the last accepted operation.""" - - SUCCEEDED = "Succeeded" - FAILED = "Failed" - CANCELED = "Canceled" - JOINING = "Joining" - LEAVING = "Leaving" - UPDATING = "Updating" - - -class FleetProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The provisioning state of the last accepted operation.""" - - SUCCEEDED = "Succeeded" - FAILED = "Failed" - CANCELED = "Canceled" - CREATING = "Creating" - DELETING = "Deleting" - UPDATING = "Updating" diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_07_02_preview/models/_models_py3.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_07_02_preview/models/_models_py3.py deleted file mode 100644 index 3a12606cf18ca..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_07_02_preview/models/_models_py3.py +++ /dev/null @@ -1,621 +0,0 @@ -# coding=utf-8 -# pylint: disable=too-many-lines -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights 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 Any, Dict, List, Optional, TYPE_CHECKING, Union - -from ... import _serialization - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from .. import models as _models - - -class Resource(_serialization.Model): - """Common fields that are returned in the response for all Azure Resource Manager resources. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.containerservicefleet.v2022_07_02_preview.models.SystemData - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.system_data = None - - -class AzureEntityResource(Resource): - """The resource model definition for an Azure Resource Manager resource with an etag. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.containerservicefleet.v2022_07_02_preview.models.SystemData - :ivar etag: Resource Etag. - :vartype etag: str - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "etag": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "etag": {"key": "etag", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.etag = None - - -class ErrorAdditionalInfo(_serialization.Model): - """The resource management error additional info. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar type: The additional info type. - :vartype type: str - :ivar info: The additional info. - :vartype info: JSON - """ - - _validation = { - "type": {"readonly": True}, - "info": {"readonly": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "info": {"key": "info", "type": "object"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.type = None - self.info = None - - -class ErrorDetail(_serialization.Model): - """The error detail. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar code: The error code. - :vartype code: str - :ivar message: The error message. - :vartype message: str - :ivar target: The error target. - :vartype target: str - :ivar details: The error details. - :vartype details: - list[~azure.mgmt.containerservicefleet.v2022_07_02_preview.models.ErrorDetail] - :ivar additional_info: The error additional info. - :vartype additional_info: - list[~azure.mgmt.containerservicefleet.v2022_07_02_preview.models.ErrorAdditionalInfo] - """ - - _validation = { - "code": {"readonly": True}, - "message": {"readonly": True}, - "target": {"readonly": True}, - "details": {"readonly": True}, - "additional_info": {"readonly": True}, - } - - _attribute_map = { - "code": {"key": "code", "type": "str"}, - "message": {"key": "message", "type": "str"}, - "target": {"key": "target", "type": "str"}, - "details": {"key": "details", "type": "[ErrorDetail]"}, - "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.code = None - self.message = None - self.target = None - self.details = None - self.additional_info = None - - -class ErrorResponse(_serialization.Model): - """Common error response for all Azure Resource Manager APIs to return error details for failed - operations. (This also follows the OData error response format.). - - :ivar error: The error object. - :vartype error: ~azure.mgmt.containerservicefleet.v2022_07_02_preview.models.ErrorDetail - """ - - _attribute_map = { - "error": {"key": "error", "type": "ErrorDetail"}, - } - - def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: Any) -> None: - """ - :keyword error: The error object. - :paramtype error: ~azure.mgmt.containerservicefleet.v2022_07_02_preview.models.ErrorDetail - """ - super().__init__(**kwargs) - self.error = error - - -class TrackedResource(Resource): - """The resource model definition for an Azure Resource Manager tracked top level resource which - has 'tags' and a 'location'. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.containerservicefleet.v2022_07_02_preview.models.SystemData - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "location": {"required": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - } - - def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - """ - super().__init__(**kwargs) - self.tags = tags - self.location = location - - -class Fleet(TrackedResource): - """The Fleet resource which contains multiple Kubernetes clusters as its members. - - 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 server. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.containerservicefleet.v2022_07_02_preview.models.SystemData - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - :ivar etag: Resource Etag. - :vartype etag: str - :ivar hub_profile: The FleetHubProfile configures the Fleet's hub. - :vartype hub_profile: - ~azure.mgmt.containerservicefleet.v2022_07_02_preview.models.FleetHubProfile - :ivar provisioning_state: The provisioning state of the last accepted operation. Known values - are: "Succeeded", "Failed", "Canceled", "Creating", "Deleting", and "Updating". - :vartype provisioning_state: str or - ~azure.mgmt.containerservicefleet.v2022_07_02_preview.models.FleetProvisioningState - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "location": {"required": True}, - "etag": {"readonly": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - "etag": {"key": "etag", "type": "str"}, - "hub_profile": {"key": "properties.hubProfile", "type": "FleetHubProfile"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - } - - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - hub_profile: Optional["_models.FleetHubProfile"] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - :keyword hub_profile: The FleetHubProfile configures the Fleet's hub. - :paramtype hub_profile: - ~azure.mgmt.containerservicefleet.v2022_07_02_preview.models.FleetHubProfile - """ - super().__init__(tags=tags, location=location, **kwargs) - self.etag = None - self.hub_profile = hub_profile - self.provisioning_state = None - - -class FleetCredentialResult(_serialization.Model): - """The credential result response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: The name of the credential. - :vartype name: str - :ivar value: Base64-encoded Kubernetes configuration file. - :vartype value: bytes - """ - - _validation = { - "name": {"readonly": True}, - "value": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "value": {"key": "value", "type": "bytearray"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.value = None - - -class FleetCredentialResults(_serialization.Model): - """The list credential result response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar kubeconfigs: Base64-encoded Kubernetes configuration file. - :vartype kubeconfigs: - list[~azure.mgmt.containerservicefleet.v2022_07_02_preview.models.FleetCredentialResult] - """ - - _validation = { - "kubeconfigs": {"readonly": True}, - } - - _attribute_map = { - "kubeconfigs": {"key": "kubeconfigs", "type": "[FleetCredentialResult]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.kubeconfigs = None - - -class FleetHubProfile(_serialization.Model): - """The FleetHubProfile configures the fleet hub. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar dns_prefix: DNS prefix used to create the FQDN for the Fleet hub. - :vartype dns_prefix: str - :ivar fqdn: The FQDN of the Fleet hub. - :vartype fqdn: str - :ivar kubernetes_version: The Kubernetes version of the Fleet hub. - :vartype kubernetes_version: str - """ - - _validation = { - "fqdn": {"readonly": True}, - "kubernetes_version": {"readonly": True}, - } - - _attribute_map = { - "dns_prefix": {"key": "dnsPrefix", "type": "str"}, - "fqdn": {"key": "fqdn", "type": "str"}, - "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, - } - - def __init__(self, *, dns_prefix: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword dns_prefix: DNS prefix used to create the FQDN for the Fleet hub. - :paramtype dns_prefix: str - """ - super().__init__(**kwargs) - self.dns_prefix = dns_prefix - self.fqdn = None - self.kubernetes_version = None - - -class FleetListResult(_serialization.Model): - """The response from the List Fleets operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The list of Fleets. - :vartype value: list[~azure.mgmt.containerservicefleet.v2022_07_02_preview.models.Fleet] - :ivar next_link: The URL to get the next page of Fleets. - :vartype next_link: str - """ - - _validation = { - "next_link": {"readonly": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[Fleet]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, *, value: Optional[List["_models.Fleet"]] = None, **kwargs: Any) -> None: - """ - :keyword value: The list of Fleets. - :paramtype value: list[~azure.mgmt.containerservicefleet.v2022_07_02_preview.models.Fleet] - """ - super().__init__(**kwargs) - self.value = value - self.next_link = None - - -class FleetMember(AzureEntityResource): - """A member of the Fleet. It contains a reference to an existing Kubernetes cluster on Azure. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.containerservicefleet.v2022_07_02_preview.models.SystemData - :ivar etag: Resource Etag. - :vartype etag: str - :ivar cluster_resource_id: The ARM resource id of the cluster that joins the Fleet. Must be a - valid Azure resource id. e.g.: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{clusterName}'. # pylint: disable=line-too-long - :vartype cluster_resource_id: str - :ivar provisioning_state: The provisioning state of the last accepted operation. Known values - are: "Succeeded", "Failed", "Canceled", "Joining", "Leaving", and "Updating". - :vartype provisioning_state: str or - ~azure.mgmt.containerservicefleet.v2022_07_02_preview.models.FleetMemberProvisioningState - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "etag": {"readonly": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "etag": {"key": "etag", "type": "str"}, - "cluster_resource_id": {"key": "properties.clusterResourceId", "type": "str"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - } - - def __init__(self, *, cluster_resource_id: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword cluster_resource_id: The ARM resource id of the cluster that joins the Fleet. Must be - a valid Azure resource id. e.g.: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{clusterName}'. # pylint: disable=line-too-long - :paramtype cluster_resource_id: str - """ - super().__init__(**kwargs) - self.cluster_resource_id = cluster_resource_id - self.provisioning_state = None - - -class FleetMembersListResult(_serialization.Model): - """The response from the List FleetMembers operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The list of members in a given Fleet. - :vartype value: list[~azure.mgmt.containerservicefleet.v2022_07_02_preview.models.FleetMember] - :ivar next_link: The URL to get the next page of Fleet members. - :vartype next_link: str - """ - - _validation = { - "next_link": {"readonly": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[FleetMember]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, *, value: Optional[List["_models.FleetMember"]] = None, **kwargs: Any) -> None: - """ - :keyword value: The list of members in a given Fleet. - :paramtype value: - list[~azure.mgmt.containerservicefleet.v2022_07_02_preview.models.FleetMember] - """ - super().__init__(**kwargs) - self.value = value - self.next_link = None - - -class FleetPatch(_serialization.Model): - """Properties of a Fleet that can be patched. - - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - """ - - _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - } - - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - """ - super().__init__(**kwargs) - self.tags = tags - - -class SystemData(_serialization.Model): - """Metadata pertaining to creation and last modification of the resource. - - :ivar created_by: The identity that created the resource. - :vartype created_by: str - :ivar created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", and "Key". - :vartype created_by_type: str or - ~azure.mgmt.containerservicefleet.v2022_07_02_preview.models.CreatedByType - :ivar created_at: The timestamp of resource creation (UTC). - :vartype created_at: ~datetime.datetime - :ivar last_modified_by: The identity that last modified the resource. - :vartype last_modified_by: str - :ivar last_modified_by_type: The type of identity that last modified the resource. Known values - are: "User", "Application", "ManagedIdentity", and "Key". - :vartype last_modified_by_type: str or - ~azure.mgmt.containerservicefleet.v2022_07_02_preview.models.CreatedByType - :ivar last_modified_at: The timestamp of resource last modification (UTC). - :vartype last_modified_at: ~datetime.datetime - """ - - _attribute_map = { - "created_by": {"key": "createdBy", "type": "str"}, - "created_by_type": {"key": "createdByType", "type": "str"}, - "created_at": {"key": "createdAt", "type": "iso-8601"}, - "last_modified_by": {"key": "lastModifiedBy", "type": "str"}, - "last_modified_by_type": {"key": "lastModifiedByType", "type": "str"}, - "last_modified_at": {"key": "lastModifiedAt", "type": "iso-8601"}, - } - - def __init__( - self, - *, - created_by: Optional[str] = None, - created_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, - created_at: Optional[datetime.datetime] = None, - last_modified_by: Optional[str] = None, - last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, - last_modified_at: Optional[datetime.datetime] = None, - **kwargs: Any - ) -> None: - """ - :keyword created_by: The identity that created the resource. - :paramtype created_by: str - :keyword created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", and "Key". - :paramtype created_by_type: str or - ~azure.mgmt.containerservicefleet.v2022_07_02_preview.models.CreatedByType - :keyword created_at: The timestamp of resource creation (UTC). - :paramtype created_at: ~datetime.datetime - :keyword last_modified_by: The identity that last modified the resource. - :paramtype last_modified_by: str - :keyword last_modified_by_type: The type of identity that last modified the resource. Known - values are: "User", "Application", "ManagedIdentity", and "Key". - :paramtype last_modified_by_type: str or - ~azure.mgmt.containerservicefleet.v2022_07_02_preview.models.CreatedByType - :keyword last_modified_at: The timestamp of resource last modification (UTC). - :paramtype last_modified_at: ~datetime.datetime - """ - super().__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 diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_07_02_preview/models/_patch.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_07_02_preview/models/_patch.py deleted file mode 100644 index f7dd32510333d..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_07_02_preview/models/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_07_02_preview/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_07_02_preview/operations/__init__.py deleted file mode 100644 index 46d49389d790f..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_07_02_preview/operations/__init__.py +++ /dev/null @@ -1,21 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._fleets_operations import FleetsOperations -from ._fleet_members_operations import FleetMembersOperations - -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "FleetsOperations", - "FleetMembersOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_07_02_preview/operations/_fleet_members_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_07_02_preview/operations/_fleet_members_operations.py deleted file mode 100644 index 0ae29f36c613e..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_07_02_preview/operations/_fleet_members_operations.py +++ /dev/null @@ -1,798 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_create_or_update_request( - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-07-02-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - "fleetMemberName": _SERIALIZER.url( - "fleet_member_name", - fleet_member_name, - "str", - max_length=50, - min_length=1, - pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if if_none_match is not None: - _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, fleet_name: str, fleet_member_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-07-02-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - "fleetMemberName": _SERIALIZER.url( - "fleet_member_name", - fleet_member_name, - "str", - max_length=50, - min_length=1, - pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-07-02-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - "fleetMemberName": _SERIALIZER.url( - "fleet_member_name", - fleet_member_name, - "str", - max_length=50, - min_length=1, - pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_fleet_request( - resource_group_name: str, fleet_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-07-02-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class FleetMembersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.containerservicefleet.v2022_07_02_preview.ContainerServiceFleetMgmtClient`'s - :attr:`fleet_members` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - def _create_or_update_initial( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - parameters: Union[_models.FleetMember, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-07-02-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "FleetMember") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - fleet_member_name=fleet_member_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - parameters: _models.FleetMember, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.FleetMember]: - """Creates or updates a fleet member. - - A member contains a reference to an existing Kubernetes cluster. Creating a member makes the - referenced cluster join the Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :param parameters: The Fleet member to create or update. Required. - :type parameters: ~azure.mgmt.containerservicefleet.v2022_07_02_preview.models.FleetMember - :param if_match: Omit this value to always overwrite the current resource. Specify the - last-seen ETag value to prevent accidentally overwriting concurrent changes. Default value is - None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new resource to be created and prevent updating an - existing resource. Other values will result in a 412 Pre-condition Failed response. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either FleetMember or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2022_07_02_preview.models.FleetMember] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - parameters: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.FleetMember]: - """Creates or updates a fleet member. - - A member contains a reference to an existing Kubernetes cluster. Creating a member makes the - referenced cluster join the Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :param parameters: The Fleet member to create or update. Required. - :type parameters: IO[bytes] - :param if_match: Omit this value to always overwrite the current resource. Specify the - last-seen ETag value to prevent accidentally overwriting concurrent changes. Default value is - None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new resource to be created and prevent updating an - existing resource. Other values will result in a 412 Pre-condition Failed response. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either FleetMember or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2022_07_02_preview.models.FleetMember] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - parameters: Union[_models.FleetMember, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[_models.FleetMember]: - """Creates or updates a fleet member. - - A member contains a reference to an existing Kubernetes cluster. Creating a member makes the - referenced cluster join the Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :param parameters: The Fleet member to create or update. Is either a FleetMember type or a - IO[bytes] type. Required. - :type parameters: ~azure.mgmt.containerservicefleet.v2022_07_02_preview.models.FleetMember or - IO[bytes] - :param if_match: Omit this value to always overwrite the current resource. Specify the - last-seen ETag value to prevent accidentally overwriting concurrent changes. Default value is - None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new resource to be created and prevent updating an - existing resource. Other values will result in a 412 Pre-condition Failed response. Default - value is None. - :type if_none_match: str - :return: An instance of LROPoller that returns either FleetMember or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2022_07_02_preview.models.FleetMember] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-07-02-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FleetMember] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - fleet_member_name=fleet_member_name, - parameters=parameters, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FleetMember", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.FleetMember].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.FleetMember]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def get( - self, resource_group_name: str, fleet_name: str, fleet_member_name: str, **kwargs: Any - ) -> _models.FleetMember: - """Gets a Fleet member. - - Gets a Fleet member. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :return: FleetMember or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2022_07_02_preview.models.FleetMember - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-07-02-preview") - ) - cls: ClsType[_models.FleetMember] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - fleet_member_name=fleet_member_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("FleetMember", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _delete_initial( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-07-02-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - fleet_member_name=fleet_member_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[None]: - """Deletes a fleet member. - - Deleting a Fleet member results in the member cluster leaving fleet. The Member azure resource - is deleted upon success. The underlying cluster is not deleted. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :param if_match: Omit this value to always overwrite the current resource. Specify the - last-seen ETag value to prevent accidentally overwriting concurrent changes. Default value is - None. - :type if_match: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-07-02-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - fleet_member_name=fleet_member_name, - if_match=if_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list_by_fleet( - self, resource_group_name: str, fleet_name: str, **kwargs: Any - ) -> Iterable["_models.FleetMember"]: - """Lists the members of a fleet. - - Lists the members of a fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :return: An iterator like instance of either FleetMember or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservicefleet.v2022_07_02_preview.models.FleetMember] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-07-02-preview") - ) - cls: ClsType[_models.FleetMembersListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_fleet_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("FleetMembersListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_07_02_preview/operations/_fleets_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_07_02_preview/operations/_fleets_operations.py deleted file mode 100644 index d0e49050fb4bc..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_07_02_preview/operations/_fleets_operations.py +++ /dev/null @@ -1,1117 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_create_or_update_request( - resource_group_name: str, - fleet_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-07-02-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if if_none_match is not None: - _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, fleet_name: str, subscription_id: str, *, if_match: Optional[str] = None, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-07-02-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request(resource_group_name: str, fleet_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-07-02-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, fleet_name: str, subscription_id: str, *, if_match: Optional[str] = None, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-07-02-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-07-02-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-07-02-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/fleets") - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_credentials_request( - resource_group_name: str, fleet_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-07-02-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/listCredentials", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class FleetsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.containerservicefleet.v2022_07_02_preview.ContainerServiceFleetMgmtClient`'s - :attr:`fleets` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - def _create_or_update_initial( - self, - resource_group_name: str, - fleet_name: str, - parameters: Union[_models.Fleet, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-07-02-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "Fleet") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - parameters: _models.Fleet, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Fleet]: - """Creates or updates a Fleet. - - Creates or updates a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param parameters: The Fleet to create or update. Required. - :type parameters: ~azure.mgmt.containerservicefleet.v2022_07_02_preview.models.Fleet - :param if_match: Omit this value to always overwrite the current resource. Specify the - last-seen ETag value to prevent accidentally overwriting concurrent changes. Default value is - None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new resource to be created and prevent updating an - existing resource. Other values will result in a 412 Pre-condition Failed response. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either Fleet or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2022_07_02_preview.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - parameters: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Fleet]: - """Creates or updates a Fleet. - - Creates or updates a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param parameters: The Fleet to create or update. Required. - :type parameters: IO[bytes] - :param if_match: Omit this value to always overwrite the current resource. Specify the - last-seen ETag value to prevent accidentally overwriting concurrent changes. Default value is - None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new resource to be created and prevent updating an - existing resource. Other values will result in a 412 Pre-condition Failed response. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either Fleet or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2022_07_02_preview.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - parameters: Union[_models.Fleet, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[_models.Fleet]: - """Creates or updates a Fleet. - - Creates or updates a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param parameters: The Fleet to create or update. Is either a Fleet type or a IO[bytes] type. - Required. - :type parameters: ~azure.mgmt.containerservicefleet.v2022_07_02_preview.models.Fleet or - IO[bytes] - :param if_match: Omit this value to always overwrite the current resource. Specify the - last-seen ETag value to prevent accidentally overwriting concurrent changes. Default value is - None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new resource to be created and prevent updating an - existing resource. Other values will result in a 412 Pre-condition Failed response. Default - value is None. - :type if_none_match: str - :return: An instance of LROPoller that returns either Fleet or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2022_07_02_preview.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-07-02-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Fleet] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - parameters=parameters, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Fleet", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.Fleet].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.Fleet]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @overload - def update( - self, - resource_group_name: str, - fleet_name: str, - if_match: Optional[str] = None, - parameters: Optional[_models.FleetPatch] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Fleet: - """Patches a fleet resource. - - Patches a fleet resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param if_match: Omit this value to always overwrite the current resource. Specify the - last-seen ETag value to prevent accidentally overwriting concurrent changes. Default value is - None. - :type if_match: str - :param parameters: The properties of a Fleet to update. Default value is None. - :type parameters: ~azure.mgmt.containerservicefleet.v2022_07_02_preview.models.FleetPatch - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Fleet or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2022_07_02_preview.models.Fleet - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( - self, - resource_group_name: str, - fleet_name: str, - if_match: Optional[str] = None, - parameters: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Fleet: - """Patches a fleet resource. - - Patches a fleet resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param if_match: Omit this value to always overwrite the current resource. Specify the - last-seen ETag value to prevent accidentally overwriting concurrent changes. Default value is - None. - :type if_match: str - :param parameters: The properties of a Fleet to update. Default value is None. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: Fleet or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2022_07_02_preview.models.Fleet - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update( - self, - resource_group_name: str, - fleet_name: str, - if_match: Optional[str] = None, - parameters: Optional[Union[_models.FleetPatch, IO[bytes]]] = None, - **kwargs: Any - ) -> _models.Fleet: - """Patches a fleet resource. - - Patches a fleet resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param if_match: Omit this value to always overwrite the current resource. Specify the - last-seen ETag value to prevent accidentally overwriting concurrent changes. Default value is - None. - :type if_match: str - :param parameters: The properties of a Fleet to update. Is either a FleetPatch type or a - IO[bytes] type. Default value is None. - :type parameters: ~azure.mgmt.containerservicefleet.v2022_07_02_preview.models.FleetPatch or - IO[bytes] - :return: Fleet or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2022_07_02_preview.models.Fleet - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-07-02-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Fleet] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - if parameters is not None: - _json = self._serialize.body(parameters, "FleetPatch") - else: - _json = None - - _request = build_update_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Fleet", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def get(self, resource_group_name: str, fleet_name: str, **kwargs: Any) -> _models.Fleet: - """Gets a Fleet. - - Gets a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :return: Fleet or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2022_07_02_preview.models.Fleet - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-07-02-preview") - ) - cls: ClsType[_models.Fleet] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Fleet", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _delete_initial( - self, resource_group_name: str, fleet_name: str, if_match: Optional[str] = None, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-07-02-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, resource_group_name: str, fleet_name: str, if_match: Optional[str] = None, **kwargs: Any - ) -> LROPoller[None]: - """Deletes a Fleet. - - Deletes a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param if_match: Omit this value to always overwrite the current resource. Specify the - last-seen ETag value to prevent accidentally overwriting concurrent changes. Default value is - None. - :type if_match: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-07-02-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - if_match=if_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Fleet"]: - """Lists fleets in the specified subscription and resource group. - - Lists fleets in the specified subscription and resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :return: An iterator like instance of either Fleet or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservicefleet.v2022_07_02_preview.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-07-02-preview") - ) - cls: ClsType[_models.FleetListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("FleetListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def list(self, **kwargs: Any) -> Iterable["_models.Fleet"]: - """Lists fleets in the specified subscription. - - Lists fleets in the specified subscription. - - :return: An iterator like instance of either Fleet or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservicefleet.v2022_07_02_preview.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-07-02-preview") - ) - cls: ClsType[_models.FleetListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("FleetListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def list_credentials( - self, resource_group_name: str, fleet_name: str, **kwargs: Any - ) -> _models.FleetCredentialResults: - """Lists the user credentials of a Fleet. - - Lists the user credentials of a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :return: FleetCredentialResults or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2022_07_02_preview.models.FleetCredentialResults - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-07-02-preview") - ) - cls: ClsType[_models.FleetCredentialResults] = kwargs.pop("cls", None) - - _request = build_list_credentials_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("FleetCredentialResults", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_07_02_preview/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_07_02_preview/operations/_patch.py deleted file mode 100644 index f7dd32510333d..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_07_02_preview/operations/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_07_02_preview/py.typed b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_07_02_preview/py.typed deleted file mode 100644 index e5aff4f83af86..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_07_02_preview/py.typed +++ /dev/null @@ -1 +0,0 @@ -# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_09_02_preview/__init__.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_09_02_preview/__init__.py deleted file mode 100644 index 78b8b4b91a49e..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_09_02_preview/__init__.py +++ /dev/null @@ -1,26 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._container_service_fleet_mgmt_client import ContainerServiceFleetMgmtClient -from ._version import VERSION - -__version__ = VERSION - -try: - from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ContainerServiceFleetMgmtClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) - -_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_09_02_preview/_configuration.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_09_02_preview/_configuration.py deleted file mode 100644 index 2d8d427cf3b11..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_09_02_preview/_configuration.py +++ /dev/null @@ -1,65 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any, TYPE_CHECKING - -from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy - -from ._version import VERSION - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials import TokenCredential - - -class ContainerServiceFleetMgmtClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long - """Configuration for ContainerServiceFleetMgmtClient. - - 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. Required. - :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :keyword api_version: Api Version. Default value is "2022-06-02-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2022-06-02-preview") - - if credential is None: - raise ValueError("Parameter 'credential' must not be None.") - if subscription_id is None: - raise ValueError("Parameter 'subscription_id' must not be None.") - - self.credential = credential - self.subscription_id = subscription_id - self.api_version = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-containerservicefleet/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - 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.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") - if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_09_02_preview/_container_service_fleet_mgmt_client.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_09_02_preview/_container_service_fleet_mgmt_client.py deleted file mode 100644 index 0b561efcc67f5..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_09_02_preview/_container_service_fleet_mgmt_client.py +++ /dev/null @@ -1,121 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, TYPE_CHECKING -from typing_extensions import Self - -from azure.core.pipeline import policies -from azure.core.rest import HttpRequest, HttpResponse -from azure.mgmt.core import ARMPipelineClient -from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy - -from . import models as _models -from .._serialization import Deserializer, Serializer -from ._configuration import ContainerServiceFleetMgmtClientConfiguration -from .operations import FleetMembersOperations, FleetsOperations - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials import TokenCredential - - -class ContainerServiceFleetMgmtClient: # pylint: disable=client-accepts-api-version-keyword - """The Container Service Client. - - :ivar fleets: FleetsOperations operations - :vartype fleets: - azure.mgmt.containerservicefleet.v2022_09_02_preview.operations.FleetsOperations - :ivar fleet_members: FleetMembersOperations operations - :vartype fleet_members: - azure.mgmt.containerservicefleet.v2022_09_02_preview.operations.FleetMembersOperations - :param credential: Credential needed for the client to connect to Azure. Required. - :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". - :type base_url: str - :keyword api_version: Api Version. Default value is "2022-06-02-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - """ - - def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any - ) -> None: - self._config = ContainerServiceFleetMgmtClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs - ) - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - ARMAutoResourceProviderRegistrationPolicy(), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) - - client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer(client_models) - self._deserialize = Deserializer(client_models) - self._serialize.client_side_validation = False - self.fleets = FleetsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-06-02-preview" - ) - self.fleet_members = FleetMembersOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-06-02-preview" - ) - - def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.HttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore - - def close(self) -> None: - self._client.close() - - def __enter__(self) -> Self: - self._client.__enter__() - return self - - def __exit__(self, *exc_details: Any) -> None: - self._client.__exit__(*exc_details) diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_09_02_preview/_metadata.json b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_09_02_preview/_metadata.json deleted file mode 100644 index 09ce1c0446b0b..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_09_02_preview/_metadata.json +++ /dev/null @@ -1,111 +0,0 @@ -{ - "chosen_version": "2022-06-02-preview", - "total_api_version_list": ["2022-06-02-preview"], - "client": { - "name": "ContainerServiceFleetMgmtClient", - "filename": "_container_service_fleet_mgmt_client", - "description": "The Container Service Client.", - "host_value": "\"https://management.azure.com\"", - "parameterized_host_template": null, - "azure_arm": true, - "has_public_lro_operations": true, - "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ContainerServiceFleetMgmtClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ContainerServiceFleetMgmtClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" - }, - "global_parameters": { - "sync": { - "credential": { - "signature": "credential: \"TokenCredential\",", - "description": "Credential needed for the client to connect to Azure. Required.", - "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true, - "method_location": "positional" - }, - "subscription_id": { - "signature": "subscription_id: str,", - "description": "The ID of the target subscription. Required.", - "docstring_type": "str", - "required": true, - "method_location": "positional" - } - }, - "async": { - "credential": { - "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure. Required.", - "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", - "required": true - }, - "subscription_id": { - "signature": "subscription_id: str,", - "description": "The ID of the target subscription. Required.", - "docstring_type": "str", - "required": true - } - }, - "constant": { - }, - "call": "credential, subscription_id", - "service_client_specific": { - "sync": { - "api_version": { - "signature": "api_version: Optional[str]=None,", - "description": "API version to use if no profile is provided, or if missing in profile.", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", - "description": "Service URL", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "profile": { - "signature": "profile: KnownProfiles=KnownProfiles.default,", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false, - "method_location": "positional" - } - }, - "async": { - "api_version": { - "signature": "api_version: Optional[str] = None,", - "description": "API version to use if no profile is provided, or if missing in profile.", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", - "description": "Service URL", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "profile": { - "signature": "profile: KnownProfiles = KnownProfiles.default,", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false, - "method_location": "positional" - } - } - } - }, - "config": { - "credential": true, - "credential_scopes": ["https://management.azure.com/.default"], - "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", - "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", - "sync_imports": "{\"regular\": {\"sdkcore\": {\"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"sdkcore\": {\"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" - }, - "operation_groups": { - "fleets": "FleetsOperations", - "fleet_members": "FleetMembersOperations" - } -} diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_09_02_preview/_patch.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_09_02_preview/_patch.py deleted file mode 100644 index f7dd32510333d..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_09_02_preview/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_09_02_preview/_version.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_09_02_preview/_version.py deleted file mode 100644 index 83f24ab509461..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_09_02_preview/_version.py +++ /dev/null @@ -1,9 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -VERSION = "2.1.0" diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_09_02_preview/aio/__init__.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_09_02_preview/aio/__init__.py deleted file mode 100644 index af1d7b0b47fe9..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_09_02_preview/aio/__init__.py +++ /dev/null @@ -1,23 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._container_service_fleet_mgmt_client import ContainerServiceFleetMgmtClient - -try: - from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ContainerServiceFleetMgmtClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) - -_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_09_02_preview/aio/_configuration.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_09_02_preview/aio/_configuration.py deleted file mode 100644 index 52e1933b98a56..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_09_02_preview/aio/_configuration.py +++ /dev/null @@ -1,65 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any, TYPE_CHECKING - -from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy - -from .._version import VERSION - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential - - -class ContainerServiceFleetMgmtClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long - """Configuration for ContainerServiceFleetMgmtClient. - - 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. Required. - :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :keyword api_version: Api Version. Default value is "2022-06-02-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2022-06-02-preview") - - if credential is None: - raise ValueError("Parameter 'credential' must not be None.") - if subscription_id is None: - raise ValueError("Parameter 'subscription_id' must not be None.") - - self.credential = credential - self.subscription_id = subscription_id - self.api_version = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-containerservicefleet/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - 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.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") - if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_09_02_preview/aio/_container_service_fleet_mgmt_client.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_09_02_preview/aio/_container_service_fleet_mgmt_client.py deleted file mode 100644 index 2d7b65d1c3184..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_09_02_preview/aio/_container_service_fleet_mgmt_client.py +++ /dev/null @@ -1,123 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING -from typing_extensions import Self - -from azure.core.pipeline import policies -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.mgmt.core import AsyncARMPipelineClient -from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy - -from .. import models as _models -from ..._serialization import Deserializer, Serializer -from ._configuration import ContainerServiceFleetMgmtClientConfiguration -from .operations import FleetMembersOperations, FleetsOperations - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential - - -class ContainerServiceFleetMgmtClient: # pylint: disable=client-accepts-api-version-keyword - """The Container Service Client. - - :ivar fleets: FleetsOperations operations - :vartype fleets: - azure.mgmt.containerservicefleet.v2022_09_02_preview.aio.operations.FleetsOperations - :ivar fleet_members: FleetMembersOperations operations - :vartype fleet_members: - azure.mgmt.containerservicefleet.v2022_09_02_preview.aio.operations.FleetMembersOperations - :param credential: Credential needed for the client to connect to Azure. Required. - :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". - :type base_url: str - :keyword api_version: Api Version. Default value is "2022-06-02-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - """ - - def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any - ) -> None: - self._config = ContainerServiceFleetMgmtClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs - ) - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - AsyncARMAutoResourceProviderRegistrationPolicy(), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) - - client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer(client_models) - self._deserialize = Deserializer(client_models) - self._serialize.client_side_validation = False - self.fleets = FleetsOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-06-02-preview" - ) - self.fleet_members = FleetMembersOperations( - self._client, self._config, self._serialize, self._deserialize, "2022-06-02-preview" - ) - - def _send_request( - self, request: HttpRequest, *, stream: bool = False, **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = await client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.AsyncHttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore - - async def close(self) -> None: - await self._client.close() - - async def __aenter__(self) -> Self: - await self._client.__aenter__() - return self - - async def __aexit__(self, *exc_details: Any) -> None: - await self._client.__aexit__(*exc_details) diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_09_02_preview/aio/_patch.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_09_02_preview/aio/_patch.py deleted file mode 100644 index f7dd32510333d..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_09_02_preview/aio/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_09_02_preview/aio/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_09_02_preview/aio/operations/__init__.py deleted file mode 100644 index 46d49389d790f..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_09_02_preview/aio/operations/__init__.py +++ /dev/null @@ -1,21 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._fleets_operations import FleetsOperations -from ._fleet_members_operations import FleetMembersOperations - -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "FleetsOperations", - "FleetMembersOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_09_02_preview/aio/operations/_fleet_members_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_09_02_preview/aio/operations/_fleet_members_operations.py deleted file mode 100644 index 5b733704af1aa..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_09_02_preview/aio/operations/_fleet_members_operations.py +++ /dev/null @@ -1,615 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._fleet_members_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_by_fleet_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class FleetMembersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.containerservicefleet.v2022_09_02_preview.aio.ContainerServiceFleetMgmtClient`'s - :attr:`fleet_members` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - async def _create_or_update_initial( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - parameters: Union[_models.FleetMember, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-06-02-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "FleetMember") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - fleet_member_name=fleet_member_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - parameters: _models.FleetMember, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.FleetMember]: - """Creates or updates a fleet member. - - A member contains a reference to an existing Kubernetes cluster. Creating a member makes the - referenced cluster join the Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :param parameters: The Fleet member to create or update. Required. - :type parameters: ~azure.mgmt.containerservicefleet.v2022_09_02_preview.models.FleetMember - :param if_match: Omit this value to always overwrite the current resource. Specify the - last-seen ETag value to prevent accidentally overwriting concurrent changes. Default value is - None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new resource to be created and prevent updating an - existing resource. Other values will result in a 412 Pre-condition Failed response. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either FleetMember or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2022_09_02_preview.models.FleetMember] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - parameters: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.FleetMember]: - """Creates or updates a fleet member. - - A member contains a reference to an existing Kubernetes cluster. Creating a member makes the - referenced cluster join the Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :param parameters: The Fleet member to create or update. Required. - :type parameters: IO[bytes] - :param if_match: Omit this value to always overwrite the current resource. Specify the - last-seen ETag value to prevent accidentally overwriting concurrent changes. Default value is - None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new resource to be created and prevent updating an - existing resource. Other values will result in a 412 Pre-condition Failed response. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either FleetMember or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2022_09_02_preview.models.FleetMember] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - parameters: Union[_models.FleetMember, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.FleetMember]: - """Creates or updates a fleet member. - - A member contains a reference to an existing Kubernetes cluster. Creating a member makes the - referenced cluster join the Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :param parameters: The Fleet member to create or update. Is either a FleetMember type or a - IO[bytes] type. Required. - :type parameters: ~azure.mgmt.containerservicefleet.v2022_09_02_preview.models.FleetMember or - IO[bytes] - :param if_match: Omit this value to always overwrite the current resource. Specify the - last-seen ETag value to prevent accidentally overwriting concurrent changes. Default value is - None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new resource to be created and prevent updating an - existing resource. Other values will result in a 412 Pre-condition Failed response. Default - value is None. - :type if_none_match: str - :return: An instance of AsyncLROPoller that returns either FleetMember or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2022_09_02_preview.models.FleetMember] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-06-02-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FleetMember] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - fleet_member_name=fleet_member_name, - parameters=parameters, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FleetMember", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.FleetMember].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.FleetMember]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace_async - async def get( - self, resource_group_name: str, fleet_name: str, fleet_member_name: str, **kwargs: Any - ) -> _models.FleetMember: - """Gets a Fleet member. - - Gets a Fleet member. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :return: FleetMember or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2022_09_02_preview.models.FleetMember - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-06-02-preview") - ) - cls: ClsType[_models.FleetMember] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - fleet_member_name=fleet_member_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("FleetMember", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _delete_initial( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-06-02-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - fleet_member_name=fleet_member_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Deletes a fleet member. - - Deleting a Fleet member results in the member cluster leaving fleet. The Member azure resource - is deleted upon success. The underlying cluster is not deleted. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :param if_match: Omit this value to always overwrite the current resource. Specify the - last-seen ETag value to prevent accidentally overwriting concurrent changes. Default value is - None. - :type if_match: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-06-02-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - fleet_member_name=fleet_member_name, - if_match=if_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list_by_fleet( - self, resource_group_name: str, fleet_name: str, **kwargs: Any - ) -> AsyncIterable["_models.FleetMember"]: - """Lists the members of a fleet. - - Lists the members of a fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :return: An iterator like instance of either FleetMember or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservicefleet.v2022_09_02_preview.models.FleetMember] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-06-02-preview") - ) - cls: ClsType[_models.FleetMembersListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_fleet_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("FleetMembersListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_09_02_preview/aio/operations/_fleets_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_09_02_preview/aio/operations/_fleets_operations.py deleted file mode 100644 index 13e23ff9e1144..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_09_02_preview/aio/operations/_fleets_operations.py +++ /dev/null @@ -1,876 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._fleets_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_by_resource_group_request, - build_list_credentials_request, - build_list_request, - build_update_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class FleetsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.containerservicefleet.v2022_09_02_preview.aio.ContainerServiceFleetMgmtClient`'s - :attr:`fleets` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - async def _create_or_update_initial( - self, - resource_group_name: str, - fleet_name: str, - parameters: Union[_models.Fleet, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-06-02-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "Fleet") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - parameters: _models.Fleet, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.Fleet]: - """Creates or updates a Fleet. - - Creates or updates a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param parameters: The Fleet to create or update. Required. - :type parameters: ~azure.mgmt.containerservicefleet.v2022_09_02_preview.models.Fleet - :param if_match: Omit this value to always overwrite the current resource. Specify the - last-seen ETag value to prevent accidentally overwriting concurrent changes. Default value is - None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new resource to be created and prevent updating an - existing resource. Other values will result in a 412 Pre-condition Failed response. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either Fleet or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2022_09_02_preview.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - parameters: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.Fleet]: - """Creates or updates a Fleet. - - Creates or updates a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param parameters: The Fleet to create or update. Required. - :type parameters: IO[bytes] - :param if_match: Omit this value to always overwrite the current resource. Specify the - last-seen ETag value to prevent accidentally overwriting concurrent changes. Default value is - None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new resource to be created and prevent updating an - existing resource. Other values will result in a 412 Pre-condition Failed response. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either Fleet or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2022_09_02_preview.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - parameters: Union[_models.Fleet, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.Fleet]: - """Creates or updates a Fleet. - - Creates or updates a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param parameters: The Fleet to create or update. Is either a Fleet type or a IO[bytes] type. - Required. - :type parameters: ~azure.mgmt.containerservicefleet.v2022_09_02_preview.models.Fleet or - IO[bytes] - :param if_match: Omit this value to always overwrite the current resource. Specify the - last-seen ETag value to prevent accidentally overwriting concurrent changes. Default value is - None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new resource to be created and prevent updating an - existing resource. Other values will result in a 412 Pre-condition Failed response. Default - value is None. - :type if_none_match: str - :return: An instance of AsyncLROPoller that returns either Fleet or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2022_09_02_preview.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-06-02-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Fleet] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - parameters=parameters, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Fleet", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.Fleet].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.Fleet]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @overload - async def update( - self, - resource_group_name: str, - fleet_name: str, - if_match: Optional[str] = None, - parameters: Optional[_models.FleetPatch] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Fleet: - """Patches a fleet resource. - - Patches a fleet resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param if_match: Omit this value to always overwrite the current resource. Specify the - last-seen ETag value to prevent accidentally overwriting concurrent changes. Default value is - None. - :type if_match: str - :param parameters: The properties of a Fleet to update. Default value is None. - :type parameters: ~azure.mgmt.containerservicefleet.v2022_09_02_preview.models.FleetPatch - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Fleet or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2022_09_02_preview.models.Fleet - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - resource_group_name: str, - fleet_name: str, - if_match: Optional[str] = None, - parameters: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Fleet: - """Patches a fleet resource. - - Patches a fleet resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param if_match: Omit this value to always overwrite the current resource. Specify the - last-seen ETag value to prevent accidentally overwriting concurrent changes. Default value is - None. - :type if_match: str - :param parameters: The properties of a Fleet to update. Default value is None. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: Fleet or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2022_09_02_preview.models.Fleet - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update( - self, - resource_group_name: str, - fleet_name: str, - if_match: Optional[str] = None, - parameters: Optional[Union[_models.FleetPatch, IO[bytes]]] = None, - **kwargs: Any - ) -> _models.Fleet: - """Patches a fleet resource. - - Patches a fleet resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param if_match: Omit this value to always overwrite the current resource. Specify the - last-seen ETag value to prevent accidentally overwriting concurrent changes. Default value is - None. - :type if_match: str - :param parameters: The properties of a Fleet to update. Is either a FleetPatch type or a - IO[bytes] type. Default value is None. - :type parameters: ~azure.mgmt.containerservicefleet.v2022_09_02_preview.models.FleetPatch or - IO[bytes] - :return: Fleet or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2022_09_02_preview.models.Fleet - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-06-02-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Fleet] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - if parameters is not None: - _json = self._serialize.body(parameters, "FleetPatch") - else: - _json = None - - _request = build_update_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Fleet", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def get(self, resource_group_name: str, fleet_name: str, **kwargs: Any) -> _models.Fleet: - """Gets a Fleet. - - Gets a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :return: Fleet or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2022_09_02_preview.models.Fleet - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-06-02-preview") - ) - cls: ClsType[_models.Fleet] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Fleet", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _delete_initial( - self, resource_group_name: str, fleet_name: str, if_match: Optional[str] = None, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-06-02-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, fleet_name: str, if_match: Optional[str] = None, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Deletes a Fleet. - - Deletes a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param if_match: Omit this value to always overwrite the current resource. Specify the - last-seen ETag value to prevent accidentally overwriting concurrent changes. Default value is - None. - :type if_match: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-06-02-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - if_match=if_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.Fleet"]: - """Lists fleets in the specified subscription and resource group. - - Lists fleets in the specified subscription and resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :return: An iterator like instance of either Fleet or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservicefleet.v2022_09_02_preview.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-06-02-preview") - ) - cls: ClsType[_models.FleetListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("FleetListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace - def list(self, **kwargs: Any) -> AsyncIterable["_models.Fleet"]: - """Lists fleets in the specified subscription. - - Lists fleets in the specified subscription. - - :return: An iterator like instance of either Fleet or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservicefleet.v2022_09_02_preview.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-06-02-preview") - ) - cls: ClsType[_models.FleetListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("FleetListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def list_credentials( - self, resource_group_name: str, fleet_name: str, **kwargs: Any - ) -> _models.FleetCredentialResults: - """Lists the user credentials of a Fleet. - - Lists the user credentials of a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :return: FleetCredentialResults or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2022_09_02_preview.models.FleetCredentialResults - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-06-02-preview") - ) - cls: ClsType[_models.FleetCredentialResults] = kwargs.pop("cls", None) - - _request = build_list_credentials_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("FleetCredentialResults", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_09_02_preview/aio/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_09_02_preview/aio/operations/_patch.py deleted file mode 100644 index f7dd32510333d..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_09_02_preview/aio/operations/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_09_02_preview/models/__init__.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_09_02_preview/models/__init__.py deleted file mode 100644 index 437bdbe8870e1..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_09_02_preview/models/__init__.py +++ /dev/null @@ -1,53 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._models_py3 import AzureEntityResource -from ._models_py3 import ErrorAdditionalInfo -from ._models_py3 import ErrorDetail -from ._models_py3 import ErrorResponse -from ._models_py3 import Fleet -from ._models_py3 import FleetCredentialResult -from ._models_py3 import FleetCredentialResults -from ._models_py3 import FleetHubProfile -from ._models_py3 import FleetListResult -from ._models_py3 import FleetMember -from ._models_py3 import FleetMembersListResult -from ._models_py3 import FleetPatch -from ._models_py3 import Resource -from ._models_py3 import SystemData -from ._models_py3 import TrackedResource - -from ._container_service_fleet_mgmt_client_enums import CreatedByType -from ._container_service_fleet_mgmt_client_enums import FleetMemberProvisioningState -from ._container_service_fleet_mgmt_client_enums import FleetProvisioningState -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "AzureEntityResource", - "ErrorAdditionalInfo", - "ErrorDetail", - "ErrorResponse", - "Fleet", - "FleetCredentialResult", - "FleetCredentialResults", - "FleetHubProfile", - "FleetListResult", - "FleetMember", - "FleetMembersListResult", - "FleetPatch", - "Resource", - "SystemData", - "TrackedResource", - "CreatedByType", - "FleetMemberProvisioningState", - "FleetProvisioningState", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_09_02_preview/models/_container_service_fleet_mgmt_client_enums.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_09_02_preview/models/_container_service_fleet_mgmt_client_enums.py deleted file mode 100644 index c402a954fa545..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_09_02_preview/models/_container_service_fleet_mgmt_client_enums.py +++ /dev/null @@ -1,41 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from enum import Enum -from azure.core import CaseInsensitiveEnumMeta - - -class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of identity that created the resource.""" - - USER = "User" - APPLICATION = "Application" - MANAGED_IDENTITY = "ManagedIdentity" - KEY = "Key" - - -class FleetMemberProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The provisioning state of the last accepted operation.""" - - SUCCEEDED = "Succeeded" - FAILED = "Failed" - CANCELED = "Canceled" - JOINING = "Joining" - LEAVING = "Leaving" - UPDATING = "Updating" - - -class FleetProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The provisioning state of the last accepted operation.""" - - SUCCEEDED = "Succeeded" - FAILED = "Failed" - CANCELED = "Canceled" - CREATING = "Creating" - DELETING = "Deleting" - UPDATING = "Updating" diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_09_02_preview/models/_models_py3.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_09_02_preview/models/_models_py3.py deleted file mode 100644 index 1a0bc3cb629a7..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_09_02_preview/models/_models_py3.py +++ /dev/null @@ -1,621 +0,0 @@ -# coding=utf-8 -# pylint: disable=too-many-lines -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights 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 Any, Dict, List, Optional, TYPE_CHECKING, Union - -from ... import _serialization - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from .. import models as _models - - -class Resource(_serialization.Model): - """Common fields that are returned in the response for all Azure Resource Manager resources. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.containerservicefleet.v2022_09_02_preview.models.SystemData - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.system_data = None - - -class AzureEntityResource(Resource): - """The resource model definition for an Azure Resource Manager resource with an etag. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.containerservicefleet.v2022_09_02_preview.models.SystemData - :ivar etag: Resource Etag. - :vartype etag: str - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "etag": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "etag": {"key": "etag", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.etag = None - - -class ErrorAdditionalInfo(_serialization.Model): - """The resource management error additional info. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar type: The additional info type. - :vartype type: str - :ivar info: The additional info. - :vartype info: JSON - """ - - _validation = { - "type": {"readonly": True}, - "info": {"readonly": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "info": {"key": "info", "type": "object"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.type = None - self.info = None - - -class ErrorDetail(_serialization.Model): - """The error detail. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar code: The error code. - :vartype code: str - :ivar message: The error message. - :vartype message: str - :ivar target: The error target. - :vartype target: str - :ivar details: The error details. - :vartype details: - list[~azure.mgmt.containerservicefleet.v2022_09_02_preview.models.ErrorDetail] - :ivar additional_info: The error additional info. - :vartype additional_info: - list[~azure.mgmt.containerservicefleet.v2022_09_02_preview.models.ErrorAdditionalInfo] - """ - - _validation = { - "code": {"readonly": True}, - "message": {"readonly": True}, - "target": {"readonly": True}, - "details": {"readonly": True}, - "additional_info": {"readonly": True}, - } - - _attribute_map = { - "code": {"key": "code", "type": "str"}, - "message": {"key": "message", "type": "str"}, - "target": {"key": "target", "type": "str"}, - "details": {"key": "details", "type": "[ErrorDetail]"}, - "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.code = None - self.message = None - self.target = None - self.details = None - self.additional_info = None - - -class ErrorResponse(_serialization.Model): - """Common error response for all Azure Resource Manager APIs to return error details for failed - operations. (This also follows the OData error response format.). - - :ivar error: The error object. - :vartype error: ~azure.mgmt.containerservicefleet.v2022_09_02_preview.models.ErrorDetail - """ - - _attribute_map = { - "error": {"key": "error", "type": "ErrorDetail"}, - } - - def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: Any) -> None: - """ - :keyword error: The error object. - :paramtype error: ~azure.mgmt.containerservicefleet.v2022_09_02_preview.models.ErrorDetail - """ - super().__init__(**kwargs) - self.error = error - - -class TrackedResource(Resource): - """The resource model definition for an Azure Resource Manager tracked top level resource which - has 'tags' and a 'location'. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.containerservicefleet.v2022_09_02_preview.models.SystemData - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "location": {"required": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - } - - def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - """ - super().__init__(**kwargs) - self.tags = tags - self.location = location - - -class Fleet(TrackedResource): - """The Fleet resource which contains multiple Kubernetes clusters as its members. - - 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 server. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.containerservicefleet.v2022_09_02_preview.models.SystemData - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - :ivar etag: Resource Etag. - :vartype etag: str - :ivar hub_profile: The FleetHubProfile configures the Fleet's hub. - :vartype hub_profile: - ~azure.mgmt.containerservicefleet.v2022_09_02_preview.models.FleetHubProfile - :ivar provisioning_state: The provisioning state of the last accepted operation. Known values - are: "Succeeded", "Failed", "Canceled", "Creating", "Deleting", and "Updating". - :vartype provisioning_state: str or - ~azure.mgmt.containerservicefleet.v2022_09_02_preview.models.FleetProvisioningState - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "location": {"required": True}, - "etag": {"readonly": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - "etag": {"key": "etag", "type": "str"}, - "hub_profile": {"key": "properties.hubProfile", "type": "FleetHubProfile"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - } - - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - hub_profile: Optional["_models.FleetHubProfile"] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - :keyword hub_profile: The FleetHubProfile configures the Fleet's hub. - :paramtype hub_profile: - ~azure.mgmt.containerservicefleet.v2022_09_02_preview.models.FleetHubProfile - """ - super().__init__(tags=tags, location=location, **kwargs) - self.etag = None - self.hub_profile = hub_profile - self.provisioning_state = None - - -class FleetCredentialResult(_serialization.Model): - """The credential result response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: The name of the credential. - :vartype name: str - :ivar value: Base64-encoded Kubernetes configuration file. - :vartype value: bytes - """ - - _validation = { - "name": {"readonly": True}, - "value": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "value": {"key": "value", "type": "bytearray"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.value = None - - -class FleetCredentialResults(_serialization.Model): - """The list credential result response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar kubeconfigs: Base64-encoded Kubernetes configuration file. - :vartype kubeconfigs: - list[~azure.mgmt.containerservicefleet.v2022_09_02_preview.models.FleetCredentialResult] - """ - - _validation = { - "kubeconfigs": {"readonly": True}, - } - - _attribute_map = { - "kubeconfigs": {"key": "kubeconfigs", "type": "[FleetCredentialResult]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.kubeconfigs = None - - -class FleetHubProfile(_serialization.Model): - """The FleetHubProfile configures the fleet hub. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar dns_prefix: DNS prefix used to create the FQDN for the Fleet hub. - :vartype dns_prefix: str - :ivar fqdn: The FQDN of the Fleet hub. - :vartype fqdn: str - :ivar kubernetes_version: The Kubernetes version of the Fleet hub. - :vartype kubernetes_version: str - """ - - _validation = { - "fqdn": {"readonly": True}, - "kubernetes_version": {"readonly": True}, - } - - _attribute_map = { - "dns_prefix": {"key": "dnsPrefix", "type": "str"}, - "fqdn": {"key": "fqdn", "type": "str"}, - "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, - } - - def __init__(self, *, dns_prefix: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword dns_prefix: DNS prefix used to create the FQDN for the Fleet hub. - :paramtype dns_prefix: str - """ - super().__init__(**kwargs) - self.dns_prefix = dns_prefix - self.fqdn = None - self.kubernetes_version = None - - -class FleetListResult(_serialization.Model): - """The response from the List Fleets operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The list of Fleets. - :vartype value: list[~azure.mgmt.containerservicefleet.v2022_09_02_preview.models.Fleet] - :ivar next_link: The URL to get the next page of Fleets. - :vartype next_link: str - """ - - _validation = { - "next_link": {"readonly": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[Fleet]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, *, value: Optional[List["_models.Fleet"]] = None, **kwargs: Any) -> None: - """ - :keyword value: The list of Fleets. - :paramtype value: list[~azure.mgmt.containerservicefleet.v2022_09_02_preview.models.Fleet] - """ - super().__init__(**kwargs) - self.value = value - self.next_link = None - - -class FleetMember(AzureEntityResource): - """A member of the Fleet. It contains a reference to an existing Kubernetes cluster on Azure. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.containerservicefleet.v2022_09_02_preview.models.SystemData - :ivar etag: Resource Etag. - :vartype etag: str - :ivar cluster_resource_id: The ARM resource id of the cluster that joins the Fleet. Must be a - valid Azure resource id. e.g.: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{clusterName}'. # pylint: disable=line-too-long - :vartype cluster_resource_id: str - :ivar provisioning_state: The provisioning state of the last accepted operation. Known values - are: "Succeeded", "Failed", "Canceled", "Joining", "Leaving", and "Updating". - :vartype provisioning_state: str or - ~azure.mgmt.containerservicefleet.v2022_09_02_preview.models.FleetMemberProvisioningState - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "etag": {"readonly": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "etag": {"key": "etag", "type": "str"}, - "cluster_resource_id": {"key": "properties.clusterResourceId", "type": "str"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - } - - def __init__(self, *, cluster_resource_id: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword cluster_resource_id: The ARM resource id of the cluster that joins the Fleet. Must be - a valid Azure resource id. e.g.: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{clusterName}'. # pylint: disable=line-too-long - :paramtype cluster_resource_id: str - """ - super().__init__(**kwargs) - self.cluster_resource_id = cluster_resource_id - self.provisioning_state = None - - -class FleetMembersListResult(_serialization.Model): - """The response from the List FleetMembers operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: The list of members in a given Fleet. - :vartype value: list[~azure.mgmt.containerservicefleet.v2022_09_02_preview.models.FleetMember] - :ivar next_link: The URL to get the next page of Fleet members. - :vartype next_link: str - """ - - _validation = { - "next_link": {"readonly": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[FleetMember]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, *, value: Optional[List["_models.FleetMember"]] = None, **kwargs: Any) -> None: - """ - :keyword value: The list of members in a given Fleet. - :paramtype value: - list[~azure.mgmt.containerservicefleet.v2022_09_02_preview.models.FleetMember] - """ - super().__init__(**kwargs) - self.value = value - self.next_link = None - - -class FleetPatch(_serialization.Model): - """Properties of a Fleet that can be patched. - - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - """ - - _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - } - - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - """ - super().__init__(**kwargs) - self.tags = tags - - -class SystemData(_serialization.Model): - """Metadata pertaining to creation and last modification of the resource. - - :ivar created_by: The identity that created the resource. - :vartype created_by: str - :ivar created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", and "Key". - :vartype created_by_type: str or - ~azure.mgmt.containerservicefleet.v2022_09_02_preview.models.CreatedByType - :ivar created_at: The timestamp of resource creation (UTC). - :vartype created_at: ~datetime.datetime - :ivar last_modified_by: The identity that last modified the resource. - :vartype last_modified_by: str - :ivar last_modified_by_type: The type of identity that last modified the resource. Known values - are: "User", "Application", "ManagedIdentity", and "Key". - :vartype last_modified_by_type: str or - ~azure.mgmt.containerservicefleet.v2022_09_02_preview.models.CreatedByType - :ivar last_modified_at: The timestamp of resource last modification (UTC). - :vartype last_modified_at: ~datetime.datetime - """ - - _attribute_map = { - "created_by": {"key": "createdBy", "type": "str"}, - "created_by_type": {"key": "createdByType", "type": "str"}, - "created_at": {"key": "createdAt", "type": "iso-8601"}, - "last_modified_by": {"key": "lastModifiedBy", "type": "str"}, - "last_modified_by_type": {"key": "lastModifiedByType", "type": "str"}, - "last_modified_at": {"key": "lastModifiedAt", "type": "iso-8601"}, - } - - def __init__( - self, - *, - created_by: Optional[str] = None, - created_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, - created_at: Optional[datetime.datetime] = None, - last_modified_by: Optional[str] = None, - last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, - last_modified_at: Optional[datetime.datetime] = None, - **kwargs: Any - ) -> None: - """ - :keyword created_by: The identity that created the resource. - :paramtype created_by: str - :keyword created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", and "Key". - :paramtype created_by_type: str or - ~azure.mgmt.containerservicefleet.v2022_09_02_preview.models.CreatedByType - :keyword created_at: The timestamp of resource creation (UTC). - :paramtype created_at: ~datetime.datetime - :keyword last_modified_by: The identity that last modified the resource. - :paramtype last_modified_by: str - :keyword last_modified_by_type: The type of identity that last modified the resource. Known - values are: "User", "Application", "ManagedIdentity", and "Key". - :paramtype last_modified_by_type: str or - ~azure.mgmt.containerservicefleet.v2022_09_02_preview.models.CreatedByType - :keyword last_modified_at: The timestamp of resource last modification (UTC). - :paramtype last_modified_at: ~datetime.datetime - """ - super().__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 diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_09_02_preview/models/_patch.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_09_02_preview/models/_patch.py deleted file mode 100644 index f7dd32510333d..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_09_02_preview/models/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_09_02_preview/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_09_02_preview/operations/__init__.py deleted file mode 100644 index 46d49389d790f..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_09_02_preview/operations/__init__.py +++ /dev/null @@ -1,21 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._fleets_operations import FleetsOperations -from ._fleet_members_operations import FleetMembersOperations - -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "FleetsOperations", - "FleetMembersOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_09_02_preview/operations/_fleet_members_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_09_02_preview/operations/_fleet_members_operations.py deleted file mode 100644 index 6632431ea7e0a..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_09_02_preview/operations/_fleet_members_operations.py +++ /dev/null @@ -1,798 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_create_or_update_request( - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - "fleetMemberName": _SERIALIZER.url( - "fleet_member_name", - fleet_member_name, - "str", - max_length=50, - min_length=1, - pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if if_none_match is not None: - _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, fleet_name: str, fleet_member_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - "fleetMemberName": _SERIALIZER.url( - "fleet_member_name", - fleet_member_name, - "str", - max_length=50, - min_length=1, - pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - "fleetMemberName": _SERIALIZER.url( - "fleet_member_name", - fleet_member_name, - "str", - max_length=50, - min_length=1, - pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_fleet_request( - resource_group_name: str, fleet_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class FleetMembersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.containerservicefleet.v2022_09_02_preview.ContainerServiceFleetMgmtClient`'s - :attr:`fleet_members` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - def _create_or_update_initial( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - parameters: Union[_models.FleetMember, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-06-02-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "FleetMember") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - fleet_member_name=fleet_member_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - parameters: _models.FleetMember, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.FleetMember]: - """Creates or updates a fleet member. - - A member contains a reference to an existing Kubernetes cluster. Creating a member makes the - referenced cluster join the Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :param parameters: The Fleet member to create or update. Required. - :type parameters: ~azure.mgmt.containerservicefleet.v2022_09_02_preview.models.FleetMember - :param if_match: Omit this value to always overwrite the current resource. Specify the - last-seen ETag value to prevent accidentally overwriting concurrent changes. Default value is - None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new resource to be created and prevent updating an - existing resource. Other values will result in a 412 Pre-condition Failed response. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either FleetMember or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2022_09_02_preview.models.FleetMember] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - parameters: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.FleetMember]: - """Creates or updates a fleet member. - - A member contains a reference to an existing Kubernetes cluster. Creating a member makes the - referenced cluster join the Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :param parameters: The Fleet member to create or update. Required. - :type parameters: IO[bytes] - :param if_match: Omit this value to always overwrite the current resource. Specify the - last-seen ETag value to prevent accidentally overwriting concurrent changes. Default value is - None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new resource to be created and prevent updating an - existing resource. Other values will result in a 412 Pre-condition Failed response. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either FleetMember or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2022_09_02_preview.models.FleetMember] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - parameters: Union[_models.FleetMember, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[_models.FleetMember]: - """Creates or updates a fleet member. - - A member contains a reference to an existing Kubernetes cluster. Creating a member makes the - referenced cluster join the Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :param parameters: The Fleet member to create or update. Is either a FleetMember type or a - IO[bytes] type. Required. - :type parameters: ~azure.mgmt.containerservicefleet.v2022_09_02_preview.models.FleetMember or - IO[bytes] - :param if_match: Omit this value to always overwrite the current resource. Specify the - last-seen ETag value to prevent accidentally overwriting concurrent changes. Default value is - None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new resource to be created and prevent updating an - existing resource. Other values will result in a 412 Pre-condition Failed response. Default - value is None. - :type if_none_match: str - :return: An instance of LROPoller that returns either FleetMember or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2022_09_02_preview.models.FleetMember] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-06-02-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FleetMember] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - fleet_member_name=fleet_member_name, - parameters=parameters, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FleetMember", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.FleetMember].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.FleetMember]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @distributed_trace - def get( - self, resource_group_name: str, fleet_name: str, fleet_member_name: str, **kwargs: Any - ) -> _models.FleetMember: - """Gets a Fleet member. - - Gets a Fleet member. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :return: FleetMember or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2022_09_02_preview.models.FleetMember - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-06-02-preview") - ) - cls: ClsType[_models.FleetMember] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - fleet_member_name=fleet_member_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("FleetMember", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _delete_initial( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-06-02-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - fleet_member_name=fleet_member_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[None]: - """Deletes a fleet member. - - Deleting a Fleet member results in the member cluster leaving fleet. The Member azure resource - is deleted upon success. The underlying cluster is not deleted. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :param if_match: Omit this value to always overwrite the current resource. Specify the - last-seen ETag value to prevent accidentally overwriting concurrent changes. Default value is - None. - :type if_match: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-06-02-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - fleet_member_name=fleet_member_name, - if_match=if_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list_by_fleet( - self, resource_group_name: str, fleet_name: str, **kwargs: Any - ) -> Iterable["_models.FleetMember"]: - """Lists the members of a fleet. - - Lists the members of a fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :return: An iterator like instance of either FleetMember or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservicefleet.v2022_09_02_preview.models.FleetMember] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-06-02-preview") - ) - cls: ClsType[_models.FleetMembersListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_fleet_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("FleetMembersListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_09_02_preview/operations/_fleets_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_09_02_preview/operations/_fleets_operations.py deleted file mode 100644 index f4467c3b5c6d1..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_09_02_preview/operations/_fleets_operations.py +++ /dev/null @@ -1,1117 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_create_or_update_request( - resource_group_name: str, - fleet_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if if_none_match is not None: - _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, fleet_name: str, subscription_id: str, *, if_match: Optional[str] = None, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request(resource_group_name: str, fleet_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, fleet_name: str, subscription_id: str, *, if_match: Optional[str] = None, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_request(subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/fleets") - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_credentials_request( - resource_group_name: str, fleet_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2022-06-02-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/listCredentials", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class FleetsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.containerservicefleet.v2022_09_02_preview.ContainerServiceFleetMgmtClient`'s - :attr:`fleets` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - def _create_or_update_initial( - self, - resource_group_name: str, - fleet_name: str, - parameters: Union[_models.Fleet, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-06-02-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - _json = self._serialize.body(parameters, "Fleet") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - parameters: _models.Fleet, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Fleet]: - """Creates or updates a Fleet. - - Creates or updates a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param parameters: The Fleet to create or update. Required. - :type parameters: ~azure.mgmt.containerservicefleet.v2022_09_02_preview.models.Fleet - :param if_match: Omit this value to always overwrite the current resource. Specify the - last-seen ETag value to prevent accidentally overwriting concurrent changes. Default value is - None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new resource to be created and prevent updating an - existing resource. Other values will result in a 412 Pre-condition Failed response. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either Fleet or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2022_09_02_preview.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - parameters: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Fleet]: - """Creates or updates a Fleet. - - Creates or updates a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param parameters: The Fleet to create or update. Required. - :type parameters: IO[bytes] - :param if_match: Omit this value to always overwrite the current resource. Specify the - last-seen ETag value to prevent accidentally overwriting concurrent changes. Default value is - None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new resource to be created and prevent updating an - existing resource. Other values will result in a 412 Pre-condition Failed response. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either Fleet or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2022_09_02_preview.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - parameters: Union[_models.Fleet, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[_models.Fleet]: - """Creates or updates a Fleet. - - Creates or updates a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param parameters: The Fleet to create or update. Is either a Fleet type or a IO[bytes] type. - Required. - :type parameters: ~azure.mgmt.containerservicefleet.v2022_09_02_preview.models.Fleet or - IO[bytes] - :param if_match: Omit this value to always overwrite the current resource. Specify the - last-seen ETag value to prevent accidentally overwriting concurrent changes. Default value is - None. - :type if_match: str - :param if_none_match: Set to '*' to allow a new resource to be created and prevent updating an - existing resource. Other values will result in a 412 Pre-condition Failed response. Default - value is None. - :type if_none_match: str - :return: An instance of LROPoller that returns either Fleet or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2022_09_02_preview.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-06-02-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Fleet] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - parameters=parameters, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Fleet", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast(PollingMethod, ARMPolling(lro_delay, **kwargs)) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.Fleet].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.Fleet]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @overload - def update( - self, - resource_group_name: str, - fleet_name: str, - if_match: Optional[str] = None, - parameters: Optional[_models.FleetPatch] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Fleet: - """Patches a fleet resource. - - Patches a fleet resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param if_match: Omit this value to always overwrite the current resource. Specify the - last-seen ETag value to prevent accidentally overwriting concurrent changes. Default value is - None. - :type if_match: str - :param parameters: The properties of a Fleet to update. Default value is None. - :type parameters: ~azure.mgmt.containerservicefleet.v2022_09_02_preview.models.FleetPatch - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Fleet or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2022_09_02_preview.models.Fleet - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( - self, - resource_group_name: str, - fleet_name: str, - if_match: Optional[str] = None, - parameters: Optional[IO[bytes]] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Fleet: - """Patches a fleet resource. - - Patches a fleet resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param if_match: Omit this value to always overwrite the current resource. Specify the - last-seen ETag value to prevent accidentally overwriting concurrent changes. Default value is - None. - :type if_match: str - :param parameters: The properties of a Fleet to update. Default value is None. - :type parameters: IO[bytes] - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: Fleet or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2022_09_02_preview.models.Fleet - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update( - self, - resource_group_name: str, - fleet_name: str, - if_match: Optional[str] = None, - parameters: Optional[Union[_models.FleetPatch, IO[bytes]]] = None, - **kwargs: Any - ) -> _models.Fleet: - """Patches a fleet resource. - - Patches a fleet resource. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param if_match: Omit this value to always overwrite the current resource. Specify the - last-seen ETag value to prevent accidentally overwriting concurrent changes. Default value is - None. - :type if_match: str - :param parameters: The properties of a Fleet to update. Is either a FleetPatch type or a - IO[bytes] type. Default value is None. - :type parameters: ~azure.mgmt.containerservicefleet.v2022_09_02_preview.models.FleetPatch or - IO[bytes] - :return: Fleet or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2022_09_02_preview.models.Fleet - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-06-02-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Fleet] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(parameters, (IOBase, bytes)): - _content = parameters - else: - if parameters is not None: - _json = self._serialize.body(parameters, "FleetPatch") - else: - _json = None - - _request = build_update_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Fleet", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def get(self, resource_group_name: str, fleet_name: str, **kwargs: Any) -> _models.Fleet: - """Gets a Fleet. - - Gets a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :return: Fleet or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2022_09_02_preview.models.Fleet - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-06-02-preview") - ) - cls: ClsType[_models.Fleet] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Fleet", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _delete_initial( - self, resource_group_name: str, fleet_name: str, if_match: Optional[str] = None, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-06-02-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, resource_group_name: str, fleet_name: str, if_match: Optional[str] = None, **kwargs: Any - ) -> LROPoller[None]: - """Deletes a Fleet. - - Deletes a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param if_match: Omit this value to always overwrite the current resource. Specify the - last-seen ETag value to prevent accidentally overwriting concurrent changes. Default value is - None. - :type if_match: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-06-02-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - if_match=if_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Fleet"]: - """Lists fleets in the specified subscription and resource group. - - Lists fleets in the specified subscription and resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :return: An iterator like instance of either Fleet or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservicefleet.v2022_09_02_preview.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-06-02-preview") - ) - cls: ClsType[_models.FleetListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("FleetListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def list(self, **kwargs: Any) -> Iterable["_models.Fleet"]: - """Lists fleets in the specified subscription. - - Lists fleets in the specified subscription. - - :return: An iterator like instance of either Fleet or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservicefleet.v2022_09_02_preview.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-06-02-preview") - ) - cls: ClsType[_models.FleetListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("FleetListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def list_credentials( - self, resource_group_name: str, fleet_name: str, **kwargs: Any - ) -> _models.FleetCredentialResults: - """Lists the user credentials of a Fleet. - - Lists the user credentials of a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :return: FleetCredentialResults or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2022_09_02_preview.models.FleetCredentialResults - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2022-06-02-preview") - ) - cls: ClsType[_models.FleetCredentialResults] = kwargs.pop("cls", None) - - _request = build_list_credentials_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("FleetCredentialResults", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_09_02_preview/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_09_02_preview/operations/_patch.py deleted file mode 100644 index f7dd32510333d..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_09_02_preview/operations/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_09_02_preview/py.typed b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_09_02_preview/py.typed deleted file mode 100644 index e5aff4f83af86..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2022_09_02_preview/py.typed +++ /dev/null @@ -1 +0,0 @@ -# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_03_15_preview/__init__.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_03_15_preview/__init__.py deleted file mode 100644 index 78b8b4b91a49e..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_03_15_preview/__init__.py +++ /dev/null @@ -1,26 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._container_service_fleet_mgmt_client import ContainerServiceFleetMgmtClient -from ._version import VERSION - -__version__ = VERSION - -try: - from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ContainerServiceFleetMgmtClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) - -_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_03_15_preview/_configuration.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_03_15_preview/_configuration.py deleted file mode 100644 index 4adbf8e51f0d3..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_03_15_preview/_configuration.py +++ /dev/null @@ -1,65 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any, TYPE_CHECKING - -from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy - -from ._version import VERSION - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials import TokenCredential - - -class ContainerServiceFleetMgmtClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long - """Configuration for ContainerServiceFleetMgmtClient. - - 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. Required. - :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :keyword api_version: Api Version. Default value is "2023-03-15-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2023-03-15-preview") - - if credential is None: - raise ValueError("Parameter 'credential' must not be None.") - if subscription_id is None: - raise ValueError("Parameter 'subscription_id' must not be None.") - - self.credential = credential - self.subscription_id = subscription_id - self.api_version = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-containerservicefleet/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - 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.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") - if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_03_15_preview/_container_service_fleet_mgmt_client.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_03_15_preview/_container_service_fleet_mgmt_client.py deleted file mode 100644 index 2cac72531a2ba..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_03_15_preview/_container_service_fleet_mgmt_client.py +++ /dev/null @@ -1,132 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, TYPE_CHECKING -from typing_extensions import Self - -from azure.core.pipeline import policies -from azure.core.rest import HttpRequest, HttpResponse -from azure.mgmt.core import ARMPipelineClient -from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy - -from . import models as _models -from .._serialization import Deserializer, Serializer -from ._configuration import ContainerServiceFleetMgmtClientConfiguration -from .operations import FleetMembersOperations, FleetsOperations, Operations, UpdateRunsOperations - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials import TokenCredential - - -class ContainerServiceFleetMgmtClient: # pylint: disable=client-accepts-api-version-keyword - """Azure Kubernetes Fleet Manager api client. - - :ivar operations: Operations operations - :vartype operations: azure.mgmt.containerservicefleet.v2023_03_15_preview.operations.Operations - :ivar fleets: FleetsOperations operations - :vartype fleets: - azure.mgmt.containerservicefleet.v2023_03_15_preview.operations.FleetsOperations - :ivar fleet_members: FleetMembersOperations operations - :vartype fleet_members: - azure.mgmt.containerservicefleet.v2023_03_15_preview.operations.FleetMembersOperations - :ivar update_runs: UpdateRunsOperations operations - :vartype update_runs: - azure.mgmt.containerservicefleet.v2023_03_15_preview.operations.UpdateRunsOperations - :param credential: Credential needed for the client to connect to Azure. Required. - :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". - :type base_url: str - :keyword api_version: Api Version. Default value is "2023-03-15-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - """ - - def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any - ) -> None: - self._config = ContainerServiceFleetMgmtClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs - ) - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - ARMAutoResourceProviderRegistrationPolicy(), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) - - client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer(client_models) - self._deserialize = Deserializer(client_models) - self._serialize.client_side_validation = False - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize, "2023-03-15-preview" - ) - self.fleets = FleetsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-03-15-preview" - ) - self.fleet_members = FleetMembersOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-03-15-preview" - ) - self.update_runs = UpdateRunsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-03-15-preview" - ) - - def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.HttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore - - def close(self) -> None: - self._client.close() - - def __enter__(self) -> Self: - self._client.__enter__() - return self - - def __exit__(self, *exc_details: Any) -> None: - self._client.__exit__(*exc_details) diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_03_15_preview/_metadata.json b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_03_15_preview/_metadata.json deleted file mode 100644 index 55d1ef7d23fe4..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_03_15_preview/_metadata.json +++ /dev/null @@ -1,113 +0,0 @@ -{ - "chosen_version": "2023-03-15-preview", - "total_api_version_list": ["2023-03-15-preview"], - "client": { - "name": "ContainerServiceFleetMgmtClient", - "filename": "_container_service_fleet_mgmt_client", - "description": "Azure Kubernetes Fleet Manager api client.", - "host_value": "\"https://management.azure.com\"", - "parameterized_host_template": null, - "azure_arm": true, - "has_public_lro_operations": true, - "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ContainerServiceFleetMgmtClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ContainerServiceFleetMgmtClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" - }, - "global_parameters": { - "sync": { - "credential": { - "signature": "credential: \"TokenCredential\",", - "description": "Credential needed for the client to connect to Azure. Required.", - "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true, - "method_location": "positional" - }, - "subscription_id": { - "signature": "subscription_id: str,", - "description": "The ID of the target subscription. Required.", - "docstring_type": "str", - "required": true, - "method_location": "positional" - } - }, - "async": { - "credential": { - "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure. Required.", - "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", - "required": true - }, - "subscription_id": { - "signature": "subscription_id: str,", - "description": "The ID of the target subscription. Required.", - "docstring_type": "str", - "required": true - } - }, - "constant": { - }, - "call": "credential, subscription_id", - "service_client_specific": { - "sync": { - "api_version": { - "signature": "api_version: Optional[str]=None,", - "description": "API version to use if no profile is provided, or if missing in profile.", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", - "description": "Service URL", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "profile": { - "signature": "profile: KnownProfiles=KnownProfiles.default,", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false, - "method_location": "positional" - } - }, - "async": { - "api_version": { - "signature": "api_version: Optional[str] = None,", - "description": "API version to use if no profile is provided, or if missing in profile.", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", - "description": "Service URL", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "profile": { - "signature": "profile: KnownProfiles = KnownProfiles.default,", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false, - "method_location": "positional" - } - } - } - }, - "config": { - "credential": true, - "credential_scopes": ["https://management.azure.com/.default"], - "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", - "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", - "sync_imports": "{\"regular\": {\"sdkcore\": {\"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"sdkcore\": {\"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" - }, - "operation_groups": { - "operations": "Operations", - "fleets": "FleetsOperations", - "fleet_members": "FleetMembersOperations", - "update_runs": "UpdateRunsOperations" - } -} diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_03_15_preview/_patch.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_03_15_preview/_patch.py deleted file mode 100644 index f7dd32510333d..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_03_15_preview/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_03_15_preview/_version.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_03_15_preview/_version.py deleted file mode 100644 index 83f24ab509461..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_03_15_preview/_version.py +++ /dev/null @@ -1,9 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -VERSION = "2.1.0" diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_03_15_preview/aio/__init__.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_03_15_preview/aio/__init__.py deleted file mode 100644 index af1d7b0b47fe9..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_03_15_preview/aio/__init__.py +++ /dev/null @@ -1,23 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._container_service_fleet_mgmt_client import ContainerServiceFleetMgmtClient - -try: - from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ContainerServiceFleetMgmtClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) - -_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_03_15_preview/aio/_configuration.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_03_15_preview/aio/_configuration.py deleted file mode 100644 index 7394ed56ef594..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_03_15_preview/aio/_configuration.py +++ /dev/null @@ -1,65 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any, TYPE_CHECKING - -from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy - -from .._version import VERSION - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential - - -class ContainerServiceFleetMgmtClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long - """Configuration for ContainerServiceFleetMgmtClient. - - 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. Required. - :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :keyword api_version: Api Version. Default value is "2023-03-15-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2023-03-15-preview") - - if credential is None: - raise ValueError("Parameter 'credential' must not be None.") - if subscription_id is None: - raise ValueError("Parameter 'subscription_id' must not be None.") - - self.credential = credential - self.subscription_id = subscription_id - self.api_version = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-containerservicefleet/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - 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.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") - if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_03_15_preview/aio/_container_service_fleet_mgmt_client.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_03_15_preview/aio/_container_service_fleet_mgmt_client.py deleted file mode 100644 index 1aa6dd52349b8..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_03_15_preview/aio/_container_service_fleet_mgmt_client.py +++ /dev/null @@ -1,135 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING -from typing_extensions import Self - -from azure.core.pipeline import policies -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.mgmt.core import AsyncARMPipelineClient -from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy - -from .. import models as _models -from ..._serialization import Deserializer, Serializer -from ._configuration import ContainerServiceFleetMgmtClientConfiguration -from .operations import FleetMembersOperations, FleetsOperations, Operations, UpdateRunsOperations - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential - - -class ContainerServiceFleetMgmtClient: # pylint: disable=client-accepts-api-version-keyword - """Azure Kubernetes Fleet Manager api client. - - :ivar operations: Operations operations - :vartype operations: - azure.mgmt.containerservicefleet.v2023_03_15_preview.aio.operations.Operations - :ivar fleets: FleetsOperations operations - :vartype fleets: - azure.mgmt.containerservicefleet.v2023_03_15_preview.aio.operations.FleetsOperations - :ivar fleet_members: FleetMembersOperations operations - :vartype fleet_members: - azure.mgmt.containerservicefleet.v2023_03_15_preview.aio.operations.FleetMembersOperations - :ivar update_runs: UpdateRunsOperations operations - :vartype update_runs: - azure.mgmt.containerservicefleet.v2023_03_15_preview.aio.operations.UpdateRunsOperations - :param credential: Credential needed for the client to connect to Azure. Required. - :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". - :type base_url: str - :keyword api_version: Api Version. Default value is "2023-03-15-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - """ - - def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any - ) -> None: - self._config = ContainerServiceFleetMgmtClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs - ) - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - AsyncARMAutoResourceProviderRegistrationPolicy(), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) - - client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer(client_models) - self._deserialize = Deserializer(client_models) - self._serialize.client_side_validation = False - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize, "2023-03-15-preview" - ) - self.fleets = FleetsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-03-15-preview" - ) - self.fleet_members = FleetMembersOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-03-15-preview" - ) - self.update_runs = UpdateRunsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-03-15-preview" - ) - - def _send_request( - self, request: HttpRequest, *, stream: bool = False, **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = await client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.AsyncHttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore - - async def close(self) -> None: - await self._client.close() - - async def __aenter__(self) -> Self: - await self._client.__aenter__() - return self - - async def __aexit__(self, *exc_details: Any) -> None: - await self._client.__aexit__(*exc_details) diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_03_15_preview/aio/_patch.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_03_15_preview/aio/_patch.py deleted file mode 100644 index f7dd32510333d..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_03_15_preview/aio/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_03_15_preview/aio/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_03_15_preview/aio/operations/__init__.py deleted file mode 100644 index b2c1526f4d81e..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_03_15_preview/aio/operations/__init__.py +++ /dev/null @@ -1,25 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._operations import Operations -from ._fleets_operations import FleetsOperations -from ._fleet_members_operations import FleetMembersOperations -from ._update_runs_operations import UpdateRunsOperations - -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "Operations", - "FleetsOperations", - "FleetMembersOperations", - "UpdateRunsOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_03_15_preview/aio/operations/_fleet_members_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_03_15_preview/aio/operations/_fleet_members_operations.py deleted file mode 100644 index bd816ce595c27..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_03_15_preview/aio/operations/_fleet_members_operations.py +++ /dev/null @@ -1,763 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._fleet_members_operations import ( - build_create_request, - build_delete_request, - build_get_request, - build_list_by_fleet_request, - build_update_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class FleetMembersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.containerservicefleet.v2023_03_15_preview.aio.ContainerServiceFleetMgmtClient`'s - :attr:`fleet_members` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_by_fleet( - self, resource_group_name: str, fleet_name: str, **kwargs: Any - ) -> AsyncIterable["_models.FleetMember"]: - """List FleetMember resources by Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :return: An iterator like instance of either FleetMember or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.FleetMember] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-15-preview") - ) - cls: ClsType[_models.FleetMemberListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_fleet_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("FleetMemberListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get( - self, resource_group_name: str, fleet_name: str, fleet_member_name: str, **kwargs: Any - ) -> _models.FleetMember: - """Get a FleetMember. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :return: FleetMember or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.FleetMember - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-15-preview") - ) - cls: ClsType[_models.FleetMember] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - fleet_member_name=fleet_member_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("FleetMember", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_initial( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - resource: Union[_models.FleetMember, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-15-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "FleetMember") - - _request = build_create_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - fleet_member_name=fleet_member_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - resource: _models.FleetMember, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.FleetMember]: - """Create a FleetMember. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :param resource: Resource create parameters. Required. - :type resource: ~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.FleetMember - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either FleetMember or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.FleetMember] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - resource: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.FleetMember]: - """Create a FleetMember. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :param resource: Resource create parameters. Required. - :type resource: IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either FleetMember or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.FleetMember] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - resource: Union[_models.FleetMember, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.FleetMember]: - """Create a FleetMember. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :param resource: Resource create parameters. Is either a FleetMember type or a IO[bytes] type. - Required. - :type resource: ~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.FleetMember or - IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :return: An instance of AsyncLROPoller that returns either FleetMember or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.FleetMember] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-15-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FleetMember] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - fleet_member_name=fleet_member_name, - resource=resource, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FleetMember", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.FleetMember].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.FleetMember]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @overload - async def update( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - properties: _models.FleetMemberUpdate, - if_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.FleetMember: - """Update a FleetMember. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :param properties: The resource properties to be updated. Required. - :type properties: - ~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.FleetMemberUpdate - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: FleetMember or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.FleetMember - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - properties: IO[bytes], - if_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.FleetMember: - """Update a FleetMember. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :param properties: The resource properties to be updated. Required. - :type properties: IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: FleetMember or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.FleetMember - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - properties: Union[_models.FleetMemberUpdate, IO[bytes]], - if_match: Optional[str] = None, - **kwargs: Any - ) -> _models.FleetMember: - """Update a FleetMember. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :param properties: The resource properties to be updated. Is either a FleetMemberUpdate type or - a IO[bytes] type. Required. - :type properties: - ~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.FleetMemberUpdate or IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :return: FleetMember or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.FleetMember - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-15-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FleetMember] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties - else: - _json = self._serialize.body(properties, "FleetMemberUpdate") - - _request = build_update_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - fleet_member_name=fleet_member_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("FleetMember", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _delete_initial( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-15-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - fleet_member_name=fleet_member_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Delete a FleetMember. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-15-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - fleet_member_name=fleet_member_name, - if_match=if_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_03_15_preview/aio/operations/_fleets_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_03_15_preview/aio/operations/_fleets_operations.py deleted file mode 100644 index a170837ac5764..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_03_15_preview/aio/operations/_fleets_operations.py +++ /dev/null @@ -1,852 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._fleets_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_by_resource_group_request, - build_list_by_subscription_request, - build_list_credentials_request, - build_update_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class FleetsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.containerservicefleet.v2023_03_15_preview.aio.ContainerServiceFleetMgmtClient`'s - :attr:`fleets` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.Fleet"]: - """Lists fleets in the specified subscription. - - :return: An iterator like instance of either Fleet or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-15-preview") - ) - cls: ClsType[_models.FleetListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("FleetListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace - def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.Fleet"]: - """Lists fleets in the specified subscription and resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :return: An iterator like instance of either Fleet or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-15-preview") - ) - cls: ClsType[_models.FleetListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("FleetListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get(self, resource_group_name: str, fleet_name: str, **kwargs: Any) -> _models.Fleet: - """Gets a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :return: Fleet or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.Fleet - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-15-preview") - ) - cls: ClsType[_models.Fleet] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Fleet", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - fleet_name: str, - resource: Union[_models.Fleet, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-15-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "Fleet") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - resource: _models.Fleet, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.Fleet]: - """Creates or updates a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param resource: Resource create parameters. Required. - :type resource: ~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.Fleet - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either Fleet or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - resource: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.Fleet]: - """Creates or updates a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param resource: Resource create parameters. Required. - :type resource: IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either Fleet or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - resource: Union[_models.Fleet, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.Fleet]: - """Creates or updates a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param resource: Resource create parameters. Is either a Fleet type or a IO[bytes] type. - Required. - :type resource: ~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.Fleet or IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :return: An instance of AsyncLROPoller that returns either Fleet or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-15-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Fleet] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - resource=resource, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Fleet", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.Fleet].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.Fleet]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @overload - async def update( - self, - resource_group_name: str, - fleet_name: str, - properties: _models.FleetPatch, - if_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Fleet: - """Update a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param properties: The resource properties to be updated. Required. - :type properties: ~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.FleetPatch - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Fleet or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.Fleet - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def update( - self, - resource_group_name: str, - fleet_name: str, - properties: IO[bytes], - if_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Fleet: - """Update a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param properties: The resource properties to be updated. Required. - :type properties: IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: Fleet or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.Fleet - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def update( - self, - resource_group_name: str, - fleet_name: str, - properties: Union[_models.FleetPatch, IO[bytes]], - if_match: Optional[str] = None, - **kwargs: Any - ) -> _models.Fleet: - """Update a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param properties: The resource properties to be updated. Is either a FleetPatch type or a - IO[bytes] type. Required. - :type properties: ~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.FleetPatch or - IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :return: Fleet or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.Fleet - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-15-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Fleet] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties - else: - _json = self._serialize.body(properties, "FleetPatch") - - _request = build_update_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Fleet", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _delete_initial( - self, resource_group_name: str, fleet_name: str, if_match: Optional[str] = None, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-15-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, fleet_name: str, if_match: Optional[str] = None, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Delete a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-15-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - if_match=if_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace_async - async def list_credentials( - self, resource_group_name: str, fleet_name: str, **kwargs: Any - ) -> _models.FleetCredentialResults: - """Lists the user credentials of a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :return: FleetCredentialResults or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.FleetCredentialResults - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-15-preview") - ) - cls: ClsType[_models.FleetCredentialResults] = kwargs.pop("cls", None) - - _request = build_list_credentials_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("FleetCredentialResults", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_03_15_preview/aio/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_03_15_preview/aio/operations/_operations.py deleted file mode 100644 index c4ed8f7eada69..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_03_15_preview/aio/operations/_operations.py +++ /dev/null @@ -1,134 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ...operations._operations import build_list_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class Operations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.containerservicefleet.v2023_03_15_preview.aio.ContainerServiceFleetMgmtClient`'s - :attr:`operations` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: - """List the operations for the provider. - - :return: An iterator like instance of either Operation or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.Operation] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-15-preview") - ) - cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("OperationListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_03_15_preview/aio/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_03_15_preview/aio/operations/_patch.py deleted file mode 100644 index f7dd32510333d..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_03_15_preview/aio/operations/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_03_15_preview/aio/operations/_update_runs_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_03_15_preview/aio/operations/_update_runs_operations.py deleted file mode 100644 index d102926b9ce10..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_03_15_preview/aio/operations/_update_runs_operations.py +++ /dev/null @@ -1,890 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._update_runs_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_by_fleet_request, - build_start_request, - build_stop_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class UpdateRunsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.containerservicefleet.v2023_03_15_preview.aio.ContainerServiceFleetMgmtClient`'s - :attr:`update_runs` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_by_fleet( - self, resource_group_name: str, fleet_name: str, **kwargs: Any - ) -> AsyncIterable["_models.UpdateRun"]: - """List UpdateRun resources by Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :return: An iterator like instance of either UpdateRun or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.UpdateRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-15-preview") - ) - cls: ClsType[_models.UpdateRunListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_fleet_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("UpdateRunListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get( - self, resource_group_name: str, fleet_name: str, update_run_name: str, **kwargs: Any - ) -> _models.UpdateRun: - """Get a UpdateRun. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_run_name: The name of the UpdateRun resource. Required. - :type update_run_name: str - :return: UpdateRun or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.UpdateRun - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-15-preview") - ) - cls: ClsType[_models.UpdateRun] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("UpdateRun", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - resource: Union[_models.UpdateRun, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-15-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "UpdateRun") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - resource: _models.UpdateRun, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.UpdateRun]: - """Create a UpdateRun. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_run_name: The name of the UpdateRun resource. Required. - :type update_run_name: str - :param resource: Resource create parameters. Required. - :type resource: ~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.UpdateRun - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either UpdateRun or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.UpdateRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - resource: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.UpdateRun]: - """Create a UpdateRun. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_run_name: The name of the UpdateRun resource. Required. - :type update_run_name: str - :param resource: Resource create parameters. Required. - :type resource: IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either UpdateRun or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.UpdateRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - resource: Union[_models.UpdateRun, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.UpdateRun]: - """Create a UpdateRun. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_run_name: The name of the UpdateRun resource. Required. - :type update_run_name: str - :param resource: Resource create parameters. Is either a UpdateRun type or a IO[bytes] type. - Required. - :type resource: ~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.UpdateRun or - IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :return: An instance of AsyncLROPoller that returns either UpdateRun or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.UpdateRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-15-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.UpdateRun] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - resource=resource, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("UpdateRun", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.UpdateRun].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.UpdateRun]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-15-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Delete a UpdateRun. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_run_name: The name of the UpdateRun resource. Required. - :type update_run_name: str - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-15-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - if_match=if_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _start_initial( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-15-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_start_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_start( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.UpdateRun]: - """Starts an UpdateRun. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_run_name: The name of the UpdateRun resource. Required. - :type update_run_name: str - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :return: An instance of AsyncLROPoller that returns either UpdateRun or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.UpdateRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-15-preview") - ) - cls: ClsType[_models.UpdateRun] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._start_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - if_match=if_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("UpdateRun", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.UpdateRun].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.UpdateRun]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _stop_initial( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-15-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_stop_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_stop( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.UpdateRun]: - """Stops an UpdateRun. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_run_name: The name of the UpdateRun resource. Required. - :type update_run_name: str - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :return: An instance of AsyncLROPoller that returns either UpdateRun or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.UpdateRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-15-preview") - ) - cls: ClsType[_models.UpdateRun] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._stop_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - if_match=if_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("UpdateRun", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.UpdateRun].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.UpdateRun]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_03_15_preview/models/__init__.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_03_15_preview/models/__init__.py deleted file mode 100644 index c4299e6903cf9..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_03_15_preview/models/__init__.py +++ /dev/null @@ -1,97 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._models_py3 import ErrorAdditionalInfo -from ._models_py3 import ErrorDetail -from ._models_py3 import ErrorResponse -from ._models_py3 import Fleet -from ._models_py3 import FleetCredentialResult -from ._models_py3 import FleetCredentialResults -from ._models_py3 import FleetHubProfile -from ._models_py3 import FleetListResult -from ._models_py3 import FleetMember -from ._models_py3 import FleetMemberListResult -from ._models_py3 import FleetMemberUpdate -from ._models_py3 import FleetPatch -from ._models_py3 import ManagedClusterUpdate -from ._models_py3 import ManagedClusterUpgradeSpec -from ._models_py3 import MemberUpdateStatus -from ._models_py3 import Operation -from ._models_py3 import OperationDisplay -from ._models_py3 import OperationListResult -from ._models_py3 import ProxyResource -from ._models_py3 import Resource -from ._models_py3 import SystemData -from ._models_py3 import TrackedResource -from ._models_py3 import UpdateGroup -from ._models_py3 import UpdateGroupStatus -from ._models_py3 import UpdateRun -from ._models_py3 import UpdateRunListResult -from ._models_py3 import UpdateRunStatus -from ._models_py3 import UpdateRunStrategy -from ._models_py3 import UpdateStage -from ._models_py3 import UpdateStageStatus -from ._models_py3 import UpdateStatus -from ._models_py3 import WaitStatus - -from ._container_service_fleet_mgmt_client_enums import ActionType -from ._container_service_fleet_mgmt_client_enums import CreatedByType -from ._container_service_fleet_mgmt_client_enums import FleetMemberProvisioningState -from ._container_service_fleet_mgmt_client_enums import FleetProvisioningState -from ._container_service_fleet_mgmt_client_enums import ManagedClusterUpgradeType -from ._container_service_fleet_mgmt_client_enums import Origin -from ._container_service_fleet_mgmt_client_enums import UpdateRunProvisioningState -from ._container_service_fleet_mgmt_client_enums import UpdateState -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ErrorAdditionalInfo", - "ErrorDetail", - "ErrorResponse", - "Fleet", - "FleetCredentialResult", - "FleetCredentialResults", - "FleetHubProfile", - "FleetListResult", - "FleetMember", - "FleetMemberListResult", - "FleetMemberUpdate", - "FleetPatch", - "ManagedClusterUpdate", - "ManagedClusterUpgradeSpec", - "MemberUpdateStatus", - "Operation", - "OperationDisplay", - "OperationListResult", - "ProxyResource", - "Resource", - "SystemData", - "TrackedResource", - "UpdateGroup", - "UpdateGroupStatus", - "UpdateRun", - "UpdateRunListResult", - "UpdateRunStatus", - "UpdateRunStrategy", - "UpdateStage", - "UpdateStageStatus", - "UpdateStatus", - "WaitStatus", - "ActionType", - "CreatedByType", - "FleetMemberProvisioningState", - "FleetProvisioningState", - "ManagedClusterUpgradeType", - "Origin", - "UpdateRunProvisioningState", - "UpdateState", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_03_15_preview/models/_container_service_fleet_mgmt_client_enums.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_03_15_preview/models/_container_service_fleet_mgmt_client_enums.py deleted file mode 100644 index 366f82eb4a1ec..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_03_15_preview/models/_container_service_fleet_mgmt_client_enums.py +++ /dev/null @@ -1,108 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from enum import Enum -from azure.core import CaseInsensitiveEnumMeta - - -class ActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs.""" - - INTERNAL = "Internal" - - -class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of identity that created the resource.""" - - USER = "User" - APPLICATION = "Application" - MANAGED_IDENTITY = "ManagedIdentity" - KEY = "Key" - - -class FleetMemberProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The provisioning state of the last accepted operation.""" - - SUCCEEDED = "Succeeded" - """Resource has been created.""" - FAILED = "Failed" - """Resource creation failed.""" - CANCELED = "Canceled" - """Resource creation was canceled.""" - JOINING = "Joining" - """The provisioning state of a member joining a fleet.""" - LEAVING = "Leaving" - """The provisioning state of a member leaving a fleet.""" - UPDATING = "Updating" - """The provisioning state of a member being updated.""" - - -class FleetProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The provisioning state of the last accepted operation.""" - - SUCCEEDED = "Succeeded" - """Resource has been created.""" - FAILED = "Failed" - """Resource creation failed.""" - CANCELED = "Canceled" - """Resource creation was canceled.""" - CREATING = "Creating" - """The provisioning state of a fleet being created.""" - UPDATING = "Updating" - """The provisioning state of a fleet being updated.""" - DELETING = "Deleting" - """The provisioning state of a fleet being deleted.""" - - -class ManagedClusterUpgradeType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of upgrade to perform when targeting ManagedClusters.""" - - FULL = "Full" - """Full upgrades the control plane and all agent pools of the target ManagedClusters. Requires the - ManagedClusterUpgradeSpec.KubernetesVersion property to be set.""" - NODE_IMAGE_ONLY = "NodeImageOnly" - """NodeImageOnly upgrades only the node images of the target ManagedClusters. Requires the - ManagedClusterUpgradeSpec.KubernetesVersion property to NOT be set.""" - - -class Origin(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit - logs UX. Default value is "user,system". - """ - - USER = "user" - SYSTEM = "system" - USER_SYSTEM = "user,system" - - -class UpdateRunProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The provisioning state of the UpdateRun resource.""" - - SUCCEEDED = "Succeeded" - """Resource has been created.""" - FAILED = "Failed" - """Resource creation failed.""" - CANCELED = "Canceled" - """Resource creation was canceled.""" - - -class UpdateState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The state of the UpdateRun, UpdateStage, UpdateGroup, or MemberUpdate.""" - - NOT_STARTED = "NotStarted" - """The state of an UpdateRun/UpdateStage/UpdateGroup/MemberUpdate that has not been started.""" - RUNNING = "Running" - """The state of an UpdateRun/UpdateStage/UpdateGroup/MemberUpdate that is running.""" - STOPPING = "Stopping" - """The state of an UpdateRun/UpdateStage/UpdateGroup/MemberUpdate that is being stopped.""" - STOPPED = "Stopped" - """The state of an UpdateRun/UpdateStage/UpdateGroup/MemberUpdate that has stopped.""" - FAILED = "Failed" - """The state of an UpdateRun/UpdateStage/UpdateGroup/MemberUpdate that has failed.""" - COMPLETED = "Completed" - """The state of an UpdateRun/UpdateStage/UpdateGroup/MemberUpdate that has completed.""" diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_03_15_preview/models/_models_py3.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_03_15_preview/models/_models_py3.py deleted file mode 100644 index c68286913e172..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_03_15_preview/models/_models_py3.py +++ /dev/null @@ -1,1282 +0,0 @@ -# coding=utf-8 -# pylint: disable=too-many-lines -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights 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 Any, Dict, List, Optional, TYPE_CHECKING, Union - -from ... import _serialization - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from .. import models as _models - - -class ErrorAdditionalInfo(_serialization.Model): - """The resource management error additional info. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar type: The additional info type. - :vartype type: str - :ivar info: The additional info. - :vartype info: JSON - """ - - _validation = { - "type": {"readonly": True}, - "info": {"readonly": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "info": {"key": "info", "type": "object"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.type = None - self.info = None - - -class ErrorDetail(_serialization.Model): - """The error detail. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar code: The error code. - :vartype code: str - :ivar message: The error message. - :vartype message: str - :ivar target: The error target. - :vartype target: str - :ivar details: The error details. - :vartype details: - list[~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.ErrorDetail] - :ivar additional_info: The error additional info. - :vartype additional_info: - list[~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.ErrorAdditionalInfo] - """ - - _validation = { - "code": {"readonly": True}, - "message": {"readonly": True}, - "target": {"readonly": True}, - "details": {"readonly": True}, - "additional_info": {"readonly": True}, - } - - _attribute_map = { - "code": {"key": "code", "type": "str"}, - "message": {"key": "message", "type": "str"}, - "target": {"key": "target", "type": "str"}, - "details": {"key": "details", "type": "[ErrorDetail]"}, - "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.code = None - self.message = None - self.target = None - self.details = None - self.additional_info = None - - -class ErrorResponse(_serialization.Model): - """Common error response for all Azure Resource Manager APIs to return error details for failed - operations. (This also follows the OData error response format.). - - :ivar error: The error object. - :vartype error: ~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.ErrorDetail - """ - - _attribute_map = { - "error": {"key": "error", "type": "ErrorDetail"}, - } - - def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: Any) -> None: - """ - :keyword error: The error object. - :paramtype error: ~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.ErrorDetail - """ - super().__init__(**kwargs) - self.error = error - - -class Resource(_serialization.Model): - """Common fields that are returned in the response for all Azure Resource Manager resources. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.SystemData - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.system_data = None - - -class TrackedResource(Resource): - """The resource model definition for an Azure Resource Manager tracked top level resource which - has 'tags' and a 'location'. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.SystemData - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "location": {"required": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - } - - def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - """ - super().__init__(**kwargs) - self.tags = tags - self.location = location - - -class Fleet(TrackedResource): - """The Fleet 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 server. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.SystemData - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - :ivar e_tag: If eTag is provided in the response body, it may also be provided as a header per - the normal etag convention. Entity tags are used for comparing two or more entities from the - same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match - (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. - :vartype e_tag: str - :ivar provisioning_state: The status of the last operation. Known values are: "Succeeded", - "Failed", "Canceled", "Creating", "Updating", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.FleetProvisioningState - :ivar hub_profile: The FleetHubProfile configures the Fleet's hub. - :vartype hub_profile: - ~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.FleetHubProfile - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "location": {"required": True}, - "e_tag": {"readonly": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - "e_tag": {"key": "eTag", "type": "str"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "hub_profile": {"key": "properties.hubProfile", "type": "FleetHubProfile"}, - } - - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - hub_profile: Optional["_models.FleetHubProfile"] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - :keyword hub_profile: The FleetHubProfile configures the Fleet's hub. - :paramtype hub_profile: - ~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.FleetHubProfile - """ - super().__init__(tags=tags, location=location, **kwargs) - self.e_tag = None - self.provisioning_state = None - self.hub_profile = hub_profile - - -class FleetCredentialResult(_serialization.Model): - """One credential result item. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: The name of the credential. - :vartype name: str - :ivar value: Base64-encoded Kubernetes configuration file. - :vartype value: bytes - """ - - _validation = { - "name": {"readonly": True}, - "value": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "value": {"key": "value", "type": "bytearray"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.value = None - - -class FleetCredentialResults(_serialization.Model): - """The Credential results response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar kubeconfigs: Array of base64-encoded Kubernetes configuration files. - :vartype kubeconfigs: - list[~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.FleetCredentialResult] - """ - - _validation = { - "kubeconfigs": {"readonly": True}, - } - - _attribute_map = { - "kubeconfigs": {"key": "kubeconfigs", "type": "[FleetCredentialResult]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.kubeconfigs = None - - -class FleetHubProfile(_serialization.Model): - """The FleetHubProfile configures the fleet hub. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar dns_prefix: DNS prefix used to create the FQDN for the Fleet hub. - :vartype dns_prefix: str - :ivar fqdn: The FQDN of the Fleet hub. - :vartype fqdn: str - :ivar kubernetes_version: The Kubernetes version of the Fleet hub. - :vartype kubernetes_version: str - """ - - _validation = { - "dns_prefix": { - "max_length": 54, - "min_length": 1, - "pattern": r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][a-zA-Z0-9-]{0,52}[a-zA-Z0-9]$", - }, - "fqdn": {"readonly": True}, - "kubernetes_version": {"readonly": True}, - } - - _attribute_map = { - "dns_prefix": {"key": "dnsPrefix", "type": "str"}, - "fqdn": {"key": "fqdn", "type": "str"}, - "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, - } - - def __init__(self, *, dns_prefix: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword dns_prefix: DNS prefix used to create the FQDN for the Fleet hub. - :paramtype dns_prefix: str - """ - super().__init__(**kwargs) - self.dns_prefix = dns_prefix - self.fqdn = None - self.kubernetes_version = None - - -class FleetListResult(_serialization.Model): - """The response of a Fleet list operation. - - All required parameters must be populated in order to send to server. - - :ivar value: The Fleet items on this page. Required. - :vartype value: list[~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.Fleet] - :ivar next_link: The link to the next page of items. - :vartype next_link: str - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[Fleet]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, *, value: List["_models.Fleet"], next_link: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword value: The Fleet items on this page. Required. - :paramtype value: list[~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.Fleet] - :keyword next_link: The link to the next page of items. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ProxyResource(Resource): - """The resource model definition for a Azure Resource Manager proxy resource. It will not have - tags and a location. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.SystemData - """ - - -class FleetMember(ProxyResource): - """A member of the Fleet. It contains a reference to an existing Kubernetes cluster on Azure. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.SystemData - :ivar e_tag: If eTag is provided in the response body, it may also be provided as a header per - the normal etag convention. Entity tags are used for comparing two or more entities from the - same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match - (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. - :vartype e_tag: str - :ivar cluster_resource_id: The ARM resource id of the cluster that joins the Fleet. Must be a - valid Azure resource id. e.g.: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{clusterName}'. # pylint: disable=line-too-long - :vartype cluster_resource_id: str - :ivar group: The group this member belongs to for multi-cluster update management. - :vartype group: str - :ivar provisioning_state: The status of the last operation. Known values are: "Succeeded", - "Failed", "Canceled", "Joining", "Leaving", and "Updating". - :vartype provisioning_state: str or - ~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.FleetMemberProvisioningState - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "e_tag": {"readonly": True}, - "group": {"max_length": 50, "min_length": 1, "pattern": r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$"}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "e_tag": {"key": "eTag", "type": "str"}, - "cluster_resource_id": {"key": "properties.clusterResourceId", "type": "str"}, - "group": {"key": "properties.group", "type": "str"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - } - - def __init__( - self, *, cluster_resource_id: Optional[str] = None, group: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword cluster_resource_id: The ARM resource id of the cluster that joins the Fleet. Must be - a valid Azure resource id. e.g.: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{clusterName}'. # pylint: disable=line-too-long - :paramtype cluster_resource_id: str - :keyword group: The group this member belongs to for multi-cluster update management. - :paramtype group: str - """ - super().__init__(**kwargs) - self.e_tag = None - self.cluster_resource_id = cluster_resource_id - self.group = group - self.provisioning_state = None - - -class FleetMemberListResult(_serialization.Model): - """The response of a FleetMember list operation. - - All required parameters must be populated in order to send to server. - - :ivar value: The FleetMember items on this page. Required. - :vartype value: list[~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.FleetMember] - :ivar next_link: The link to the next page of items. - :vartype next_link: str - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[FleetMember]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, *, value: List["_models.FleetMember"], next_link: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword value: The FleetMember items on this page. Required. - :paramtype value: - list[~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.FleetMember] - :keyword next_link: The link to the next page of items. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class FleetMemberUpdate(_serialization.Model): - """The type used for update operations of the FleetMember. - - :ivar group: The group this member belongs to for multi-cluster update management. - :vartype group: str - """ - - _validation = { - "group": {"max_length": 50, "min_length": 1, "pattern": r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$"}, - } - - _attribute_map = { - "group": {"key": "properties.group", "type": "str"}, - } - - def __init__(self, *, group: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword group: The group this member belongs to for multi-cluster update management. - :paramtype group: str - """ - super().__init__(**kwargs) - self.group = group - - -class FleetPatch(_serialization.Model): - """Properties of a Fleet that can be patched. - - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - """ - - _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - } - - def __init__(self, *, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - """ - super().__init__(**kwargs) - self.tags = tags - - -class ManagedClusterUpdate(_serialization.Model): - """The update to be applied to the ManagedClusters. - - All required parameters must be populated in order to send to server. - - :ivar upgrade: The upgrade to apply to the ManagedClusters. Required. - :vartype upgrade: - ~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.ManagedClusterUpgradeSpec - """ - - _validation = { - "upgrade": {"required": True}, - } - - _attribute_map = { - "upgrade": {"key": "upgrade", "type": "ManagedClusterUpgradeSpec"}, - } - - def __init__(self, *, upgrade: "_models.ManagedClusterUpgradeSpec", **kwargs: Any) -> None: - """ - :keyword upgrade: The upgrade to apply to the ManagedClusters. Required. - :paramtype upgrade: - ~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.ManagedClusterUpgradeSpec - """ - super().__init__(**kwargs) - self.upgrade = upgrade - - -class ManagedClusterUpgradeSpec(_serialization.Model): - """The upgrade to apply to a ManagedCluster. - - All required parameters must be populated in order to send to server. - - :ivar type: ManagedClusterUpgradeType is the type of upgrade to be applied. Required. Known - values are: "Full" and "NodeImageOnly". - :vartype type: str or - ~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.ManagedClusterUpgradeType - :ivar kubernetes_version: The Kubernetes version to upgrade the member clusters to. - :vartype kubernetes_version: str - """ - - _validation = { - "type": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, - } - - def __init__( - self, - *, - type: Union[str, "_models.ManagedClusterUpgradeType"], - kubernetes_version: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword type: ManagedClusterUpgradeType is the type of upgrade to be applied. Required. Known - values are: "Full" and "NodeImageOnly". - :paramtype type: str or - ~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.ManagedClusterUpgradeType - :keyword kubernetes_version: The Kubernetes version to upgrade the member clusters to. - :paramtype kubernetes_version: str - """ - super().__init__(**kwargs) - self.type = type - self.kubernetes_version = kubernetes_version - - -class MemberUpdateStatus(_serialization.Model): - """The status of a member update operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar status: The status of the MemberUpdate operation. - :vartype status: ~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.UpdateStatus - :ivar name: The name of the FleetMember. - :vartype name: str - :ivar cluster_resource_id: The Azure resource id of the target Kubernetes cluster. - :vartype cluster_resource_id: str - :ivar operation_id: The operation resource id of the latest attempt to perform the operation. - :vartype operation_id: str - """ - - _validation = { - "status": {"readonly": True}, - "name": {"readonly": True}, - "cluster_resource_id": {"readonly": True}, - "operation_id": {"readonly": True}, - } - - _attribute_map = { - "status": {"key": "status", "type": "UpdateStatus"}, - "name": {"key": "name", "type": "str"}, - "cluster_resource_id": {"key": "clusterResourceId", "type": "str"}, - "operation_id": {"key": "operationId", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.status = None - self.name = None - self.cluster_resource_id = None - self.operation_id = None - - -class Operation(_serialization.Model): - """Details of a REST API operation, returned from the Resource Provider Operations API. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: - "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". - :vartype name: str - :ivar is_data_action: Whether the operation applies to data-plane. This is "true" for - data-plane operations and "false" for ARM/control-plane operations. - :vartype is_data_action: bool - :ivar display: Localized display information for this particular operation. - :vartype display: ~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.OperationDisplay - :ivar origin: The intended executor of the operation; as in Resource Based Access Control - (RBAC) and audit logs UX. Default value is "user,system". Known values are: "user", "system", - and "user,system". - :vartype origin: str or ~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.Origin - :ivar action_type: Enum. Indicates the action type. "Internal" refers to actions that are for - internal only APIs. "Internal" - :vartype action_type: str or - ~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.ActionType - """ - - _validation = { - "name": {"readonly": True}, - "is_data_action": {"readonly": True}, - "origin": {"readonly": True}, - "action_type": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "is_data_action": {"key": "isDataAction", "type": "bool"}, - "display": {"key": "display", "type": "OperationDisplay"}, - "origin": {"key": "origin", "type": "str"}, - "action_type": {"key": "actionType", "type": "str"}, - } - - def __init__(self, *, display: Optional["_models.OperationDisplay"] = None, **kwargs: Any) -> None: - """ - :keyword display: Localized display information for this particular operation. - :paramtype display: - ~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.OperationDisplay - """ - super().__init__(**kwargs) - self.name = None - self.is_data_action = None - self.display = display - self.origin = None - self.action_type = None - - -class OperationDisplay(_serialization.Model): - """Localized display information for this particular operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provider: The localized friendly form of the resource provider name, e.g. "Microsoft - Monitoring Insights" or "Microsoft Compute". - :vartype provider: str - :ivar resource: The localized friendly name of the resource type related to this operation. - E.g. "Virtual Machines" or "Job Schedule Collections". - :vartype resource: str - :ivar operation: The concise, localized friendly name for the operation; suitable for - dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual Machine". - :vartype operation: str - :ivar description: The short, localized friendly description of the operation; suitable for - tool tips and detailed views. - :vartype description: str - """ - - _validation = { - "provider": {"readonly": True}, - "resource": {"readonly": True}, - "operation": {"readonly": True}, - "description": {"readonly": True}, - } - - _attribute_map = { - "provider": {"key": "provider", "type": "str"}, - "resource": {"key": "resource", "type": "str"}, - "operation": {"key": "operation", "type": "str"}, - "description": {"key": "description", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.provider = None - self.resource = None - self.operation = None - self.description = None - - -class OperationListResult(_serialization.Model): - """A list of REST API operations supported by an Azure Resource Provider. It contains an URL link - to get the next set of results. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of operations supported by the resource provider. - :vartype value: list[~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.Operation] - :ivar next_link: URL to get the next set of operation list results (if there are any). - :vartype next_link: str - """ - - _validation = { - "value": {"readonly": True}, - "next_link": {"readonly": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[Operation]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.value = None - self.next_link = None - - -class SystemData(_serialization.Model): - """Metadata pertaining to creation and last modification of the resource. - - :ivar created_by: The identity that created the resource. - :vartype created_by: str - :ivar created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", and "Key". - :vartype created_by_type: str or - ~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.CreatedByType - :ivar created_at: The timestamp of resource creation (UTC). - :vartype created_at: ~datetime.datetime - :ivar last_modified_by: The identity that last modified the resource. - :vartype last_modified_by: str - :ivar last_modified_by_type: The type of identity that last modified the resource. Known values - are: "User", "Application", "ManagedIdentity", and "Key". - :vartype last_modified_by_type: str or - ~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.CreatedByType - :ivar last_modified_at: The timestamp of resource last modification (UTC). - :vartype last_modified_at: ~datetime.datetime - """ - - _attribute_map = { - "created_by": {"key": "createdBy", "type": "str"}, - "created_by_type": {"key": "createdByType", "type": "str"}, - "created_at": {"key": "createdAt", "type": "iso-8601"}, - "last_modified_by": {"key": "lastModifiedBy", "type": "str"}, - "last_modified_by_type": {"key": "lastModifiedByType", "type": "str"}, - "last_modified_at": {"key": "lastModifiedAt", "type": "iso-8601"}, - } - - def __init__( - self, - *, - created_by: Optional[str] = None, - created_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, - created_at: Optional[datetime.datetime] = None, - last_modified_by: Optional[str] = None, - last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, - last_modified_at: Optional[datetime.datetime] = None, - **kwargs: Any - ) -> None: - """ - :keyword created_by: The identity that created the resource. - :paramtype created_by: str - :keyword created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", and "Key". - :paramtype created_by_type: str or - ~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.CreatedByType - :keyword created_at: The timestamp of resource creation (UTC). - :paramtype created_at: ~datetime.datetime - :keyword last_modified_by: The identity that last modified the resource. - :paramtype last_modified_by: str - :keyword last_modified_by_type: The type of identity that last modified the resource. Known - values are: "User", "Application", "ManagedIdentity", and "Key". - :paramtype last_modified_by_type: str or - ~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.CreatedByType - :keyword last_modified_at: The timestamp of resource last modification (UTC). - :paramtype last_modified_at: ~datetime.datetime - """ - super().__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 UpdateGroup(_serialization.Model): - """A group to be updated. - - All required parameters must be populated in order to send to server. - - :ivar name: Name of the group. - It must match a group name of an existing fleet member. Required. - :vartype name: str - """ - - _validation = { - "name": {"required": True, "max_length": 50, "min_length": 1, "pattern": r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$"}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - } - - def __init__(self, *, name: str, **kwargs: Any) -> None: - """ - :keyword name: Name of the group. - It must match a group name of an existing fleet member. Required. - :paramtype name: str - """ - super().__init__(**kwargs) - self.name = name - - -class UpdateGroupStatus(_serialization.Model): - """The status of a UpdateGroup. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar status: The status of the UpdateGroup. - :vartype status: ~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.UpdateStatus - :ivar name: The name of the UpdateGroup. - :vartype name: str - :ivar members: The list of member this UpdateGroup updates. - :vartype members: - list[~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.MemberUpdateStatus] - """ - - _validation = { - "status": {"readonly": True}, - "name": {"readonly": True}, - "members": {"readonly": True}, - } - - _attribute_map = { - "status": {"key": "status", "type": "UpdateStatus"}, - "name": {"key": "name", "type": "str"}, - "members": {"key": "members", "type": "[MemberUpdateStatus]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.status = None - self.name = None - self.members = None - - -class UpdateRun(ProxyResource): - """A multi-stage process to perform update operations across members of a Fleet. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.SystemData - :ivar e_tag: If eTag is provided in the response body, it may also be provided as a header per - the normal etag convention. Entity tags are used for comparing two or more entities from the - same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match - (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. - :vartype e_tag: str - :ivar provisioning_state: The provisioning state of the UpdateRun resource. Known values are: - "Succeeded", "Failed", and "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.UpdateRunProvisioningState - :ivar strategy: The strategy defines the order in which the clusters will be updated. - If not set, all members will be updated sequentially. The UpdateRun status will show a single - UpdateStage and a single UpdateGroup targeting all members. - The strategy of the UpdateRun can be modified until the run is started. - :vartype strategy: - ~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.UpdateRunStrategy - :ivar managed_cluster_update: The update to be applied to all clusters in the UpdateRun. The - managedClusterUpdate can be modified until the run is started. - :vartype managed_cluster_update: - ~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.ManagedClusterUpdate - :ivar status: The status of the UpdateRun. - :vartype status: ~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.UpdateRunStatus - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "e_tag": {"readonly": True}, - "provisioning_state": {"readonly": True}, - "status": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "e_tag": {"key": "eTag", "type": "str"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "strategy": {"key": "properties.strategy", "type": "UpdateRunStrategy"}, - "managed_cluster_update": {"key": "properties.managedClusterUpdate", "type": "ManagedClusterUpdate"}, - "status": {"key": "properties.status", "type": "UpdateRunStatus"}, - } - - def __init__( - self, - *, - strategy: Optional["_models.UpdateRunStrategy"] = None, - managed_cluster_update: Optional["_models.ManagedClusterUpdate"] = None, - **kwargs: Any - ) -> None: - """ - :keyword strategy: The strategy defines the order in which the clusters will be updated. - If not set, all members will be updated sequentially. The UpdateRun status will show a single - UpdateStage and a single UpdateGroup targeting all members. - The strategy of the UpdateRun can be modified until the run is started. - :paramtype strategy: - ~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.UpdateRunStrategy - :keyword managed_cluster_update: The update to be applied to all clusters in the UpdateRun. The - managedClusterUpdate can be modified until the run is started. - :paramtype managed_cluster_update: - ~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.ManagedClusterUpdate - """ - super().__init__(**kwargs) - self.e_tag = None - self.provisioning_state = None - self.strategy = strategy - self.managed_cluster_update = managed_cluster_update - self.status = None - - -class UpdateRunListResult(_serialization.Model): - """The response of a UpdateRun list operation. - - All required parameters must be populated in order to send to server. - - :ivar value: The UpdateRun items on this page. Required. - :vartype value: list[~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.UpdateRun] - :ivar next_link: The link to the next page of items. - :vartype next_link: str - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[UpdateRun]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, *, value: List["_models.UpdateRun"], next_link: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword value: The UpdateRun items on this page. Required. - :paramtype value: list[~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.UpdateRun] - :keyword next_link: The link to the next page of items. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class UpdateRunStatus(_serialization.Model): - """The status of a UpdateRun. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar status: The status of the UpdateRun. - :vartype status: ~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.UpdateStatus - :ivar stages: The stages composing an update run. Stages are run sequentially withing an - UpdateRun. - :vartype stages: - list[~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.UpdateStageStatus] - """ - - _validation = { - "status": {"readonly": True}, - "stages": {"readonly": True}, - } - - _attribute_map = { - "status": {"key": "status", "type": "UpdateStatus"}, - "stages": {"key": "stages", "type": "[UpdateStageStatus]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.status = None - self.stages = None - - -class UpdateRunStrategy(_serialization.Model): - """Defines the update sequence of the clusters via stages and groups. - - Stages within a run are executed sequentially one after another. - Groups within a stage are executed in parallel. - Member clusters within a group are updated sequentially one after another. - - A valid strategy contains no duplicate groups within or across stages. - - All required parameters must be populated in order to send to server. - - :ivar stages: The list of stages that compose this update run. Min size: 1. Required. - :vartype stages: list[~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.UpdateStage] - """ - - _validation = { - "stages": {"required": True}, - } - - _attribute_map = { - "stages": {"key": "stages", "type": "[UpdateStage]"}, - } - - def __init__(self, *, stages: List["_models.UpdateStage"], **kwargs: Any) -> None: - """ - :keyword stages: The list of stages that compose this update run. Min size: 1. Required. - :paramtype stages: - list[~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.UpdateStage] - """ - super().__init__(**kwargs) - self.stages = stages - - -class UpdateStage(_serialization.Model): - """Defines a stage which contains the groups to update and the steps to take (e.g., wait for a - time period) before starting the next stage. - - All required parameters must be populated in order to send to server. - - :ivar name: The name of the stage. Must be unique within the UpdateRun. Required. - :vartype name: str - :ivar groups: Defines the groups to be executed in parallel in this stage. Duplicate groups are - not allowed. Min size: 1. - :vartype groups: list[~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.UpdateGroup] - :ivar after_stage_wait_in_seconds: The time in seconds to wait at the end of this stage before - starting the next one. Defaults to 0 seconds if unspecified. - :vartype after_stage_wait_in_seconds: int - """ - - _validation = { - "name": {"required": True, "max_length": 50, "min_length": 1, "pattern": r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$"}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "groups": {"key": "groups", "type": "[UpdateGroup]"}, - "after_stage_wait_in_seconds": {"key": "afterStageWaitInSeconds", "type": "int"}, - } - - def __init__( - self, - *, - name: str, - groups: Optional[List["_models.UpdateGroup"]] = None, - after_stage_wait_in_seconds: Optional[int] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: The name of the stage. Must be unique within the UpdateRun. Required. - :paramtype name: str - :keyword groups: Defines the groups to be executed in parallel in this stage. Duplicate groups - are not allowed. Min size: 1. - :paramtype groups: - list[~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.UpdateGroup] - :keyword after_stage_wait_in_seconds: The time in seconds to wait at the end of this stage - before starting the next one. Defaults to 0 seconds if unspecified. - :paramtype after_stage_wait_in_seconds: int - """ - super().__init__(**kwargs) - self.name = name - self.groups = groups - self.after_stage_wait_in_seconds = after_stage_wait_in_seconds - - -class UpdateStageStatus(_serialization.Model): - """The status of a UpdateStage. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar status: The status of the UpdateStage. - :vartype status: ~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.UpdateStatus - :ivar name: The name of the UpdateStage. - :vartype name: str - :ivar groups: The list of groups to be updated as part of this UpdateStage. - :vartype groups: - list[~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.UpdateGroupStatus] - :ivar after_stage_wait_status: The status of the wait period configured on the UpdateStage. - :vartype after_stage_wait_status: - ~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.WaitStatus - """ - - _validation = { - "status": {"readonly": True}, - "name": {"readonly": True}, - "groups": {"readonly": True}, - "after_stage_wait_status": {"readonly": True}, - } - - _attribute_map = { - "status": {"key": "status", "type": "UpdateStatus"}, - "name": {"key": "name", "type": "str"}, - "groups": {"key": "groups", "type": "[UpdateGroupStatus]"}, - "after_stage_wait_status": {"key": "afterStageWaitStatus", "type": "WaitStatus"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.status = None - self.name = None - self.groups = None - self.after_stage_wait_status = None - - -class UpdateStatus(_serialization.Model): - """The status for an operation or group of operations. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar start_time: The time the operation or group was started. - :vartype start_time: ~datetime.datetime - :ivar completed_time: The time the operation or group was completed. - :vartype completed_time: ~datetime.datetime - :ivar state: The State of the operation or group. Known values are: "NotStarted", "Running", - "Stopping", "Stopped", "Failed", and "Completed". - :vartype state: str or ~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.UpdateState - :ivar error: The error details when a failure is encountered. - :vartype error: ~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.ErrorDetail - """ - - _validation = { - "start_time": {"readonly": True}, - "completed_time": {"readonly": True}, - "state": {"readonly": True}, - "error": {"readonly": True}, - } - - _attribute_map = { - "start_time": {"key": "startTime", "type": "iso-8601"}, - "completed_time": {"key": "completedTime", "type": "iso-8601"}, - "state": {"key": "state", "type": "str"}, - "error": {"key": "error", "type": "ErrorDetail"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.start_time = None - self.completed_time = None - self.state = None - self.error = None - - -class WaitStatus(_serialization.Model): - """The status of the wait duration. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar status: The status of the wait duration. - :vartype status: ~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.UpdateStatus - :ivar wait_duration_in_seconds: The wait duration configured in seconds. - :vartype wait_duration_in_seconds: int - """ - - _validation = { - "status": {"readonly": True}, - "wait_duration_in_seconds": {"readonly": True}, - } - - _attribute_map = { - "status": {"key": "status", "type": "UpdateStatus"}, - "wait_duration_in_seconds": {"key": "waitDurationInSeconds", "type": "int"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.status = None - self.wait_duration_in_seconds = None diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_03_15_preview/models/_patch.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_03_15_preview/models/_patch.py deleted file mode 100644 index f7dd32510333d..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_03_15_preview/models/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_03_15_preview/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_03_15_preview/operations/__init__.py deleted file mode 100644 index b2c1526f4d81e..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_03_15_preview/operations/__init__.py +++ /dev/null @@ -1,25 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._operations import Operations -from ._fleets_operations import FleetsOperations -from ._fleet_members_operations import FleetMembersOperations -from ._update_runs_operations import UpdateRunsOperations - -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "Operations", - "FleetsOperations", - "FleetMembersOperations", - "UpdateRunsOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_03_15_preview/operations/_fleet_members_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_03_15_preview/operations/_fleet_members_operations.py deleted file mode 100644 index 61730f29a07c9..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_03_15_preview/operations/_fleet_members_operations.py +++ /dev/null @@ -1,998 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_fleet_request( - resource_group_name: str, fleet_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-15-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, fleet_name: str, fleet_member_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-15-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - "fleetMemberName": _SERIALIZER.url( - "fleet_member_name", - fleet_member_name, - "str", - max_length=50, - min_length=1, - pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_request( - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-15-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - "fleetMemberName": _SERIALIZER.url( - "fleet_member_name", - fleet_member_name, - "str", - max_length=50, - min_length=1, - pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if if_none_match is not None: - _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-15-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - "fleetMemberName": _SERIALIZER.url( - "fleet_member_name", - fleet_member_name, - "str", - max_length=50, - min_length=1, - pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-15-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - "fleetMemberName": _SERIALIZER.url( - "fleet_member_name", - fleet_member_name, - "str", - max_length=50, - min_length=1, - pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -class FleetMembersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.containerservicefleet.v2023_03_15_preview.ContainerServiceFleetMgmtClient`'s - :attr:`fleet_members` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_by_fleet( - self, resource_group_name: str, fleet_name: str, **kwargs: Any - ) -> Iterable["_models.FleetMember"]: - """List FleetMember resources by Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :return: An iterator like instance of either FleetMember or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.FleetMember] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-15-preview") - ) - cls: ClsType[_models.FleetMemberListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_fleet_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("FleetMemberListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get( - self, resource_group_name: str, fleet_name: str, fleet_member_name: str, **kwargs: Any - ) -> _models.FleetMember: - """Get a FleetMember. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :return: FleetMember or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.FleetMember - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-15-preview") - ) - cls: ClsType[_models.FleetMember] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - fleet_member_name=fleet_member_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("FleetMember", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_initial( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - resource: Union[_models.FleetMember, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-15-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "FleetMember") - - _request = build_create_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - fleet_member_name=fleet_member_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - resource: _models.FleetMember, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.FleetMember]: - """Create a FleetMember. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :param resource: Resource create parameters. Required. - :type resource: ~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.FleetMember - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either FleetMember or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.FleetMember] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - resource: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.FleetMember]: - """Create a FleetMember. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :param resource: Resource create parameters. Required. - :type resource: IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either FleetMember or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.FleetMember] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - resource: Union[_models.FleetMember, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[_models.FleetMember]: - """Create a FleetMember. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :param resource: Resource create parameters. Is either a FleetMember type or a IO[bytes] type. - Required. - :type resource: ~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.FleetMember or - IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :return: An instance of LROPoller that returns either FleetMember or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.FleetMember] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-15-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FleetMember] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - fleet_member_name=fleet_member_name, - resource=resource, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FleetMember", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.FleetMember].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.FleetMember]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @overload - def update( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - properties: _models.FleetMemberUpdate, - if_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.FleetMember: - """Update a FleetMember. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :param properties: The resource properties to be updated. Required. - :type properties: - ~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.FleetMemberUpdate - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: FleetMember or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.FleetMember - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - properties: IO[bytes], - if_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.FleetMember: - """Update a FleetMember. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :param properties: The resource properties to be updated. Required. - :type properties: IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: FleetMember or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.FleetMember - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - properties: Union[_models.FleetMemberUpdate, IO[bytes]], - if_match: Optional[str] = None, - **kwargs: Any - ) -> _models.FleetMember: - """Update a FleetMember. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :param properties: The resource properties to be updated. Is either a FleetMemberUpdate type or - a IO[bytes] type. Required. - :type properties: - ~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.FleetMemberUpdate or IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :return: FleetMember or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.FleetMember - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-15-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FleetMember] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties - else: - _json = self._serialize.body(properties, "FleetMemberUpdate") - - _request = build_update_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - fleet_member_name=fleet_member_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("FleetMember", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _delete_initial( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-15-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - fleet_member_name=fleet_member_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[None]: - """Delete a FleetMember. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-15-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - fleet_member_name=fleet_member_name, - if_match=if_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_03_15_preview/operations/_fleets_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_03_15_preview/operations/_fleets_operations.py deleted file mode 100644 index 30811d79e5b24..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_03_15_preview/operations/_fleets_operations.py +++ /dev/null @@ -1,1092 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-15-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/fleets") - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-15-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request(resource_group_name: str, fleet_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-15-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - fleet_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-15-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if if_none_match is not None: - _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, fleet_name: str, subscription_id: str, *, if_match: Optional[str] = None, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-15-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, fleet_name: str, subscription_id: str, *, if_match: Optional[str] = None, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-15-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_credentials_request( - resource_group_name: str, fleet_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-15-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/listCredentials", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class FleetsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.containerservicefleet.v2023_03_15_preview.ContainerServiceFleetMgmtClient`'s - :attr:`fleets` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.Fleet"]: - """Lists fleets in the specified subscription. - - :return: An iterator like instance of either Fleet or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-15-preview") - ) - cls: ClsType[_models.FleetListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("FleetListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Fleet"]: - """Lists fleets in the specified subscription and resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :return: An iterator like instance of either Fleet or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-15-preview") - ) - cls: ClsType[_models.FleetListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("FleetListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get(self, resource_group_name: str, fleet_name: str, **kwargs: Any) -> _models.Fleet: - """Gets a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :return: Fleet or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.Fleet - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-15-preview") - ) - cls: ClsType[_models.Fleet] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Fleet", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - fleet_name: str, - resource: Union[_models.Fleet, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-15-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "Fleet") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - resource: _models.Fleet, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Fleet]: - """Creates or updates a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param resource: Resource create parameters. Required. - :type resource: ~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.Fleet - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either Fleet or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - resource: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Fleet]: - """Creates or updates a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param resource: Resource create parameters. Required. - :type resource: IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either Fleet or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - resource: Union[_models.Fleet, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[_models.Fleet]: - """Creates or updates a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param resource: Resource create parameters. Is either a Fleet type or a IO[bytes] type. - Required. - :type resource: ~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.Fleet or IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :return: An instance of LROPoller that returns either Fleet or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-15-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Fleet] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - resource=resource, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Fleet", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.Fleet].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.Fleet]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - @overload - def update( - self, - resource_group_name: str, - fleet_name: str, - properties: _models.FleetPatch, - if_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Fleet: - """Update a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param properties: The resource properties to be updated. Required. - :type properties: ~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.FleetPatch - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: Fleet or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.Fleet - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def update( - self, - resource_group_name: str, - fleet_name: str, - properties: IO[bytes], - if_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> _models.Fleet: - """Update a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param properties: The resource properties to be updated. Required. - :type properties: IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: Fleet or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.Fleet - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def update( - self, - resource_group_name: str, - fleet_name: str, - properties: Union[_models.FleetPatch, IO[bytes]], - if_match: Optional[str] = None, - **kwargs: Any - ) -> _models.Fleet: - """Update a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param properties: The resource properties to be updated. Is either a FleetPatch type or a - IO[bytes] type. Required. - :type properties: ~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.FleetPatch or - IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :return: Fleet or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.Fleet - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-15-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Fleet] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties - else: - _json = self._serialize.body(properties, "FleetPatch") - - _request = build_update_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Fleet", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _delete_initial( - self, resource_group_name: str, fleet_name: str, if_match: Optional[str] = None, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-15-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, resource_group_name: str, fleet_name: str, if_match: Optional[str] = None, **kwargs: Any - ) -> LROPoller[None]: - """Delete a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-15-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - if_match=if_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list_credentials( - self, resource_group_name: str, fleet_name: str, **kwargs: Any - ) -> _models.FleetCredentialResults: - """Lists the user credentials of a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :return: FleetCredentialResults or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.FleetCredentialResults - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-15-preview") - ) - cls: ClsType[_models.FleetCredentialResults] = kwargs.pop("cls", None) - - _request = build_list_credentials_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("FleetCredentialResults", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_03_15_preview/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_03_15_preview/operations/_operations.py deleted file mode 100644 index 93071f08887de..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_03_15_preview/operations/_operations.py +++ /dev/null @@ -1,156 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-15-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.ContainerService/operations") - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class Operations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.containerservicefleet.v2023_03_15_preview.ContainerServiceFleetMgmtClient`'s - :attr:`operations` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: - """List the operations for the provider. - - :return: An iterator like instance of either Operation or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.Operation] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-15-preview") - ) - cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - 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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_03_15_preview/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_03_15_preview/operations/_patch.py deleted file mode 100644 index f7dd32510333d..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_03_15_preview/operations/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_03_15_preview/operations/_update_runs_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_03_15_preview/operations/_update_runs_operations.py deleted file mode 100644 index d8cb16efdd240..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_03_15_preview/operations/_update_runs_operations.py +++ /dev/null @@ -1,1163 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_fleet_request( - resource_group_name: str, fleet_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-15-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, fleet_name: str, update_run_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-15-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - "updateRunName": _SERIALIZER.url( - "update_run_name", - update_run_name, - "str", - max_length=50, - min_length=1, - pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - fleet_name: str, - update_run_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-15-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - "updateRunName": _SERIALIZER.url( - "update_run_name", - update_run_name, - "str", - max_length=50, - min_length=1, - pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if if_none_match is not None: - _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - fleet_name: str, - update_run_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-15-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - "updateRunName": _SERIALIZER.url( - "update_run_name", - update_run_name, - "str", - max_length=50, - min_length=1, - pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_start_request( - resource_group_name: str, - fleet_name: str, - update_run_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-15-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName}/start", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - "updateRunName": _SERIALIZER.url( - "update_run_name", - update_run_name, - "str", - max_length=50, - min_length=1, - pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_stop_request( - resource_group_name: str, - fleet_name: str, - update_run_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-03-15-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName}/stop", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - "updateRunName": _SERIALIZER.url( - "update_run_name", - update_run_name, - "str", - max_length=50, - min_length=1, - pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class UpdateRunsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.containerservicefleet.v2023_03_15_preview.ContainerServiceFleetMgmtClient`'s - :attr:`update_runs` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_by_fleet(self, resource_group_name: str, fleet_name: str, **kwargs: Any) -> Iterable["_models.UpdateRun"]: - """List UpdateRun resources by Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :return: An iterator like instance of either UpdateRun or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.UpdateRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-15-preview") - ) - cls: ClsType[_models.UpdateRunListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_fleet_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("UpdateRunListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get(self, resource_group_name: str, fleet_name: str, update_run_name: str, **kwargs: Any) -> _models.UpdateRun: - """Get a UpdateRun. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_run_name: The name of the UpdateRun resource. Required. - :type update_run_name: str - :return: UpdateRun or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.UpdateRun - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-15-preview") - ) - cls: ClsType[_models.UpdateRun] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("UpdateRun", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - resource: Union[_models.UpdateRun, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-15-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "UpdateRun") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - resource: _models.UpdateRun, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.UpdateRun]: - """Create a UpdateRun. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_run_name: The name of the UpdateRun resource. Required. - :type update_run_name: str - :param resource: Resource create parameters. Required. - :type resource: ~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.UpdateRun - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either UpdateRun or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.UpdateRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - resource: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.UpdateRun]: - """Create a UpdateRun. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_run_name: The name of the UpdateRun resource. Required. - :type update_run_name: str - :param resource: Resource create parameters. Required. - :type resource: IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either UpdateRun or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.UpdateRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - resource: Union[_models.UpdateRun, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[_models.UpdateRun]: - """Create a UpdateRun. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_run_name: The name of the UpdateRun resource. Required. - :type update_run_name: str - :param resource: Resource create parameters. Is either a UpdateRun type or a IO[bytes] type. - Required. - :type resource: ~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.UpdateRun or - IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :return: An instance of LROPoller that returns either UpdateRun or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.UpdateRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-15-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.UpdateRun] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - resource=resource, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("UpdateRun", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.UpdateRun].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.UpdateRun]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-15-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[None]: - """Delete a UpdateRun. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_run_name: The name of the UpdateRun resource. Required. - :type update_run_name: str - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-15-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - if_match=if_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _start_initial( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-15-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_start_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_start( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[_models.UpdateRun]: - """Starts an UpdateRun. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_run_name: The name of the UpdateRun resource. Required. - :type update_run_name: str - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :return: An instance of LROPoller that returns either UpdateRun or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.UpdateRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-15-preview") - ) - cls: ClsType[_models.UpdateRun] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._start_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - if_match=if_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("UpdateRun", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.UpdateRun].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.UpdateRun]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _stop_initial( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-15-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_stop_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_stop( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[_models.UpdateRun]: - """Stops an UpdateRun. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_run_name: The name of the UpdateRun resource. Required. - :type update_run_name: str - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :return: An instance of LROPoller that returns either UpdateRun or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2023_03_15_preview.models.UpdateRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-03-15-preview") - ) - cls: ClsType[_models.UpdateRun] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._stop_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - if_match=if_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("UpdateRun", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.UpdateRun].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.UpdateRun]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_03_15_preview/py.typed b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_03_15_preview/py.typed deleted file mode 100644 index e5aff4f83af86..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_03_15_preview/py.typed +++ /dev/null @@ -1 +0,0 @@ -# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_06_15_preview/__init__.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_06_15_preview/__init__.py deleted file mode 100644 index 78b8b4b91a49e..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_06_15_preview/__init__.py +++ /dev/null @@ -1,26 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._container_service_fleet_mgmt_client import ContainerServiceFleetMgmtClient -from ._version import VERSION - -__version__ = VERSION - -try: - from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ContainerServiceFleetMgmtClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) - -_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_06_15_preview/_configuration.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_06_15_preview/_configuration.py deleted file mode 100644 index ca5d7651ab380..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_06_15_preview/_configuration.py +++ /dev/null @@ -1,65 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any, TYPE_CHECKING - -from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy - -from ._version import VERSION - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials import TokenCredential - - -class ContainerServiceFleetMgmtClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long - """Configuration for ContainerServiceFleetMgmtClient. - - 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. Required. - :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :keyword api_version: Api Version. Default value is "2023-06-15-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2023-06-15-preview") - - if credential is None: - raise ValueError("Parameter 'credential' must not be None.") - if subscription_id is None: - raise ValueError("Parameter 'subscription_id' must not be None.") - - self.credential = credential - self.subscription_id = subscription_id - self.api_version = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-containerservicefleet/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - 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.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") - if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_06_15_preview/_container_service_fleet_mgmt_client.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_06_15_preview/_container_service_fleet_mgmt_client.py deleted file mode 100644 index 8f333ec0aa903..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_06_15_preview/_container_service_fleet_mgmt_client.py +++ /dev/null @@ -1,132 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, TYPE_CHECKING -from typing_extensions import Self - -from azure.core.pipeline import policies -from azure.core.rest import HttpRequest, HttpResponse -from azure.mgmt.core import ARMPipelineClient -from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy - -from . import models as _models -from .._serialization import Deserializer, Serializer -from ._configuration import ContainerServiceFleetMgmtClientConfiguration -from .operations import FleetMembersOperations, FleetsOperations, Operations, UpdateRunsOperations - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials import TokenCredential - - -class ContainerServiceFleetMgmtClient: # pylint: disable=client-accepts-api-version-keyword - """Azure Kubernetes Fleet Manager api client. - - :ivar operations: Operations operations - :vartype operations: azure.mgmt.containerservicefleet.v2023_06_15_preview.operations.Operations - :ivar fleets: FleetsOperations operations - :vartype fleets: - azure.mgmt.containerservicefleet.v2023_06_15_preview.operations.FleetsOperations - :ivar fleet_members: FleetMembersOperations operations - :vartype fleet_members: - azure.mgmt.containerservicefleet.v2023_06_15_preview.operations.FleetMembersOperations - :ivar update_runs: UpdateRunsOperations operations - :vartype update_runs: - azure.mgmt.containerservicefleet.v2023_06_15_preview.operations.UpdateRunsOperations - :param credential: Credential needed for the client to connect to Azure. Required. - :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". - :type base_url: str - :keyword api_version: Api Version. Default value is "2023-06-15-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - """ - - def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any - ) -> None: - self._config = ContainerServiceFleetMgmtClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs - ) - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - ARMAutoResourceProviderRegistrationPolicy(), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) - - client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer(client_models) - self._deserialize = Deserializer(client_models) - self._serialize.client_side_validation = False - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize, "2023-06-15-preview" - ) - self.fleets = FleetsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-06-15-preview" - ) - self.fleet_members = FleetMembersOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-06-15-preview" - ) - self.update_runs = UpdateRunsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-06-15-preview" - ) - - def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.HttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore - - def close(self) -> None: - self._client.close() - - def __enter__(self) -> Self: - self._client.__enter__() - return self - - def __exit__(self, *exc_details: Any) -> None: - self._client.__exit__(*exc_details) diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_06_15_preview/_metadata.json b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_06_15_preview/_metadata.json deleted file mode 100644 index df3c6e58bec4a..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_06_15_preview/_metadata.json +++ /dev/null @@ -1,113 +0,0 @@ -{ - "chosen_version": "2023-06-15-preview", - "total_api_version_list": ["2023-06-15-preview"], - "client": { - "name": "ContainerServiceFleetMgmtClient", - "filename": "_container_service_fleet_mgmt_client", - "description": "Azure Kubernetes Fleet Manager api client.", - "host_value": "\"https://management.azure.com\"", - "parameterized_host_template": null, - "azure_arm": true, - "has_public_lro_operations": true, - "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ContainerServiceFleetMgmtClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ContainerServiceFleetMgmtClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" - }, - "global_parameters": { - "sync": { - "credential": { - "signature": "credential: \"TokenCredential\",", - "description": "Credential needed for the client to connect to Azure. Required.", - "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true, - "method_location": "positional" - }, - "subscription_id": { - "signature": "subscription_id: str,", - "description": "The ID of the target subscription. Required.", - "docstring_type": "str", - "required": true, - "method_location": "positional" - } - }, - "async": { - "credential": { - "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure. Required.", - "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", - "required": true - }, - "subscription_id": { - "signature": "subscription_id: str,", - "description": "The ID of the target subscription. Required.", - "docstring_type": "str", - "required": true - } - }, - "constant": { - }, - "call": "credential, subscription_id", - "service_client_specific": { - "sync": { - "api_version": { - "signature": "api_version: Optional[str]=None,", - "description": "API version to use if no profile is provided, or if missing in profile.", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", - "description": "Service URL", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "profile": { - "signature": "profile: KnownProfiles=KnownProfiles.default,", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false, - "method_location": "positional" - } - }, - "async": { - "api_version": { - "signature": "api_version: Optional[str] = None,", - "description": "API version to use if no profile is provided, or if missing in profile.", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", - "description": "Service URL", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "profile": { - "signature": "profile: KnownProfiles = KnownProfiles.default,", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false, - "method_location": "positional" - } - } - } - }, - "config": { - "credential": true, - "credential_scopes": ["https://management.azure.com/.default"], - "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", - "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", - "sync_imports": "{\"regular\": {\"sdkcore\": {\"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"sdkcore\": {\"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" - }, - "operation_groups": { - "operations": "Operations", - "fleets": "FleetsOperations", - "fleet_members": "FleetMembersOperations", - "update_runs": "UpdateRunsOperations" - } -} diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_06_15_preview/_patch.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_06_15_preview/_patch.py deleted file mode 100644 index f7dd32510333d..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_06_15_preview/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_06_15_preview/_version.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_06_15_preview/_version.py deleted file mode 100644 index 83f24ab509461..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_06_15_preview/_version.py +++ /dev/null @@ -1,9 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -VERSION = "2.1.0" diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_06_15_preview/aio/__init__.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_06_15_preview/aio/__init__.py deleted file mode 100644 index af1d7b0b47fe9..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_06_15_preview/aio/__init__.py +++ /dev/null @@ -1,23 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._container_service_fleet_mgmt_client import ContainerServiceFleetMgmtClient - -try: - from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ContainerServiceFleetMgmtClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) - -_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_06_15_preview/aio/_configuration.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_06_15_preview/aio/_configuration.py deleted file mode 100644 index c258299d96137..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_06_15_preview/aio/_configuration.py +++ /dev/null @@ -1,65 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any, TYPE_CHECKING - -from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy - -from .._version import VERSION - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential - - -class ContainerServiceFleetMgmtClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long - """Configuration for ContainerServiceFleetMgmtClient. - - 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. Required. - :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :keyword api_version: Api Version. Default value is "2023-06-15-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2023-06-15-preview") - - if credential is None: - raise ValueError("Parameter 'credential' must not be None.") - if subscription_id is None: - raise ValueError("Parameter 'subscription_id' must not be None.") - - self.credential = credential - self.subscription_id = subscription_id - self.api_version = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-containerservicefleet/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - 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.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") - if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_06_15_preview/aio/_container_service_fleet_mgmt_client.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_06_15_preview/aio/_container_service_fleet_mgmt_client.py deleted file mode 100644 index 22f7e8f236deb..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_06_15_preview/aio/_container_service_fleet_mgmt_client.py +++ /dev/null @@ -1,135 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING -from typing_extensions import Self - -from azure.core.pipeline import policies -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.mgmt.core import AsyncARMPipelineClient -from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy - -from .. import models as _models -from ..._serialization import Deserializer, Serializer -from ._configuration import ContainerServiceFleetMgmtClientConfiguration -from .operations import FleetMembersOperations, FleetsOperations, Operations, UpdateRunsOperations - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential - - -class ContainerServiceFleetMgmtClient: # pylint: disable=client-accepts-api-version-keyword - """Azure Kubernetes Fleet Manager api client. - - :ivar operations: Operations operations - :vartype operations: - azure.mgmt.containerservicefleet.v2023_06_15_preview.aio.operations.Operations - :ivar fleets: FleetsOperations operations - :vartype fleets: - azure.mgmt.containerservicefleet.v2023_06_15_preview.aio.operations.FleetsOperations - :ivar fleet_members: FleetMembersOperations operations - :vartype fleet_members: - azure.mgmt.containerservicefleet.v2023_06_15_preview.aio.operations.FleetMembersOperations - :ivar update_runs: UpdateRunsOperations operations - :vartype update_runs: - azure.mgmt.containerservicefleet.v2023_06_15_preview.aio.operations.UpdateRunsOperations - :param credential: Credential needed for the client to connect to Azure. Required. - :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". - :type base_url: str - :keyword api_version: Api Version. Default value is "2023-06-15-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - """ - - def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any - ) -> None: - self._config = ContainerServiceFleetMgmtClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs - ) - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - AsyncARMAutoResourceProviderRegistrationPolicy(), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) - - client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer(client_models) - self._deserialize = Deserializer(client_models) - self._serialize.client_side_validation = False - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize, "2023-06-15-preview" - ) - self.fleets = FleetsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-06-15-preview" - ) - self.fleet_members = FleetMembersOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-06-15-preview" - ) - self.update_runs = UpdateRunsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-06-15-preview" - ) - - def _send_request( - self, request: HttpRequest, *, stream: bool = False, **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = await client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.AsyncHttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore - - async def close(self) -> None: - await self._client.close() - - async def __aenter__(self) -> Self: - await self._client.__aenter__() - return self - - async def __aexit__(self, *exc_details: Any) -> None: - await self._client.__aexit__(*exc_details) diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_06_15_preview/aio/_patch.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_06_15_preview/aio/_patch.py deleted file mode 100644 index f7dd32510333d..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_06_15_preview/aio/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_06_15_preview/aio/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_06_15_preview/aio/operations/__init__.py deleted file mode 100644 index b2c1526f4d81e..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_06_15_preview/aio/operations/__init__.py +++ /dev/null @@ -1,25 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._operations import Operations -from ._fleets_operations import FleetsOperations -from ._fleet_members_operations import FleetMembersOperations -from ._update_runs_operations import UpdateRunsOperations - -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "Operations", - "FleetsOperations", - "FleetMembersOperations", - "UpdateRunsOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_06_15_preview/aio/operations/_fleet_members_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_06_15_preview/aio/operations/_fleet_members_operations.py deleted file mode 100644 index 7b0548a8771d7..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_06_15_preview/aio/operations/_fleet_members_operations.py +++ /dev/null @@ -1,842 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._fleet_members_operations import ( - build_create_request, - build_delete_request, - build_get_request, - build_list_by_fleet_request, - build_update_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class FleetMembersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.containerservicefleet.v2023_06_15_preview.aio.ContainerServiceFleetMgmtClient`'s - :attr:`fleet_members` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_by_fleet( - self, resource_group_name: str, fleet_name: str, **kwargs: Any - ) -> AsyncIterable["_models.FleetMember"]: - """List FleetMember resources by Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :return: An iterator like instance of either FleetMember or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.FleetMember] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-06-15-preview") - ) - cls: ClsType[_models.FleetMemberListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_fleet_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("FleetMemberListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get( - self, resource_group_name: str, fleet_name: str, fleet_member_name: str, **kwargs: Any - ) -> _models.FleetMember: - """Get a FleetMember. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :return: FleetMember or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.FleetMember - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-06-15-preview") - ) - cls: ClsType[_models.FleetMember] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - fleet_member_name=fleet_member_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("FleetMember", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_initial( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - resource: Union[_models.FleetMember, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-06-15-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "FleetMember") - - _request = build_create_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - fleet_member_name=fleet_member_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - resource: _models.FleetMember, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.FleetMember]: - """Create a FleetMember. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :param resource: Resource create parameters. Required. - :type resource: ~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.FleetMember - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either FleetMember or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.FleetMember] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - resource: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.FleetMember]: - """Create a FleetMember. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :param resource: Resource create parameters. Required. - :type resource: IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either FleetMember or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.FleetMember] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - resource: Union[_models.FleetMember, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.FleetMember]: - """Create a FleetMember. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :param resource: Resource create parameters. Is either a FleetMember type or a IO[bytes] type. - Required. - :type resource: ~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.FleetMember or - IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :return: An instance of AsyncLROPoller that returns either FleetMember or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.FleetMember] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-06-15-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FleetMember] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - fleet_member_name=fleet_member_name, - resource=resource, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FleetMember", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.FleetMember].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.FleetMember]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_initial( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - properties: Union[_models.FleetMemberUpdate, IO[bytes]], - if_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-06-15-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties - else: - _json = self._serialize.body(properties, "FleetMemberUpdate") - - _request = build_update_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - fleet_member_name=fleet_member_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - properties: _models.FleetMemberUpdate, - if_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.FleetMember]: - """Update a FleetMember. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :param properties: The resource properties to be updated. Required. - :type properties: - ~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.FleetMemberUpdate - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either FleetMember or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.FleetMember] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - properties: IO[bytes], - if_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.FleetMember]: - """Update a FleetMember. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :param properties: The resource properties to be updated. Required. - :type properties: IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either FleetMember or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.FleetMember] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - properties: Union[_models.FleetMemberUpdate, IO[bytes]], - if_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.FleetMember]: - """Update a FleetMember. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :param properties: The resource properties to be updated. Is either a FleetMemberUpdate type or - a IO[bytes] type. Required. - :type properties: - ~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.FleetMemberUpdate or IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :return: An instance of AsyncLROPoller that returns either FleetMember or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.FleetMember] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-06-15-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FleetMember] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - fleet_member_name=fleet_member_name, - properties=properties, - if_match=if_match, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FleetMember", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.FleetMember].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.FleetMember]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-06-15-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - fleet_member_name=fleet_member_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Delete a FleetMember. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-06-15-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - fleet_member_name=fleet_member_name, - if_match=if_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_06_15_preview/aio/operations/_fleets_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_06_15_preview/aio/operations/_fleets_operations.py deleted file mode 100644 index 58e5cc6bda6cd..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_06_15_preview/aio/operations/_fleets_operations.py +++ /dev/null @@ -1,926 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._fleets_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_by_resource_group_request, - build_list_by_subscription_request, - build_list_credentials_request, - build_update_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class FleetsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.containerservicefleet.v2023_06_15_preview.aio.ContainerServiceFleetMgmtClient`'s - :attr:`fleets` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.Fleet"]: - """Lists fleets in the specified subscription. - - :return: An iterator like instance of either Fleet or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-06-15-preview") - ) - cls: ClsType[_models.FleetListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("FleetListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace - def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.Fleet"]: - """Lists fleets in the specified subscription and resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :return: An iterator like instance of either Fleet or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-06-15-preview") - ) - cls: ClsType[_models.FleetListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("FleetListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get(self, resource_group_name: str, fleet_name: str, **kwargs: Any) -> _models.Fleet: - """Gets a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :return: Fleet or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.Fleet - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-06-15-preview") - ) - cls: ClsType[_models.Fleet] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Fleet", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - fleet_name: str, - resource: Union[_models.Fleet, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-06-15-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "Fleet") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - resource: _models.Fleet, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.Fleet]: - """Creates or updates a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param resource: Resource create parameters. Required. - :type resource: ~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.Fleet - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either Fleet or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - resource: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.Fleet]: - """Creates or updates a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param resource: Resource create parameters. Required. - :type resource: IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either Fleet or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - resource: Union[_models.Fleet, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.Fleet]: - """Creates or updates a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param resource: Resource create parameters. Is either a Fleet type or a IO[bytes] type. - Required. - :type resource: ~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.Fleet or IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :return: An instance of AsyncLROPoller that returns either Fleet or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-06-15-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Fleet] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - resource=resource, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Fleet", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.Fleet].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.Fleet]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_initial( - self, - resource_group_name: str, - fleet_name: str, - properties: Union[_models.FleetPatch, IO[bytes]], - if_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-06-15-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties - else: - _json = self._serialize.body(properties, "FleetPatch") - - _request = build_update_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - fleet_name: str, - properties: _models.FleetPatch, - if_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.Fleet]: - """Update a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param properties: The resource properties to be updated. Required. - :type properties: ~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.FleetPatch - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either Fleet or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - fleet_name: str, - properties: IO[bytes], - if_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.Fleet]: - """Update a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param properties: The resource properties to be updated. Required. - :type properties: IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either Fleet or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - fleet_name: str, - properties: Union[_models.FleetPatch, IO[bytes]], - if_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.Fleet]: - """Update a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param properties: The resource properties to be updated. Is either a FleetPatch type or a - IO[bytes] type. Required. - :type properties: ~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.FleetPatch or - IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :return: An instance of AsyncLROPoller that returns either Fleet or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-06-15-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Fleet] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - properties=properties, - if_match=if_match, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Fleet", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.Fleet].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.Fleet]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, fleet_name: str, if_match: Optional[str] = None, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-06-15-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, fleet_name: str, if_match: Optional[str] = None, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Delete a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-06-15-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - if_match=if_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace_async - async def list_credentials( - self, resource_group_name: str, fleet_name: str, **kwargs: Any - ) -> _models.FleetCredentialResults: - """Lists the user credentials of a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :return: FleetCredentialResults or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.FleetCredentialResults - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-06-15-preview") - ) - cls: ClsType[_models.FleetCredentialResults] = kwargs.pop("cls", None) - - _request = build_list_credentials_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("FleetCredentialResults", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_06_15_preview/aio/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_06_15_preview/aio/operations/_operations.py deleted file mode 100644 index f85687a3327b8..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_06_15_preview/aio/operations/_operations.py +++ /dev/null @@ -1,134 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ...operations._operations import build_list_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class Operations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.containerservicefleet.v2023_06_15_preview.aio.ContainerServiceFleetMgmtClient`'s - :attr:`operations` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: - """List the operations for the provider. - - :return: An iterator like instance of either Operation or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.Operation] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-06-15-preview") - ) - cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("OperationListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_06_15_preview/aio/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_06_15_preview/aio/operations/_patch.py deleted file mode 100644 index f7dd32510333d..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_06_15_preview/aio/operations/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_06_15_preview/aio/operations/_update_runs_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_06_15_preview/aio/operations/_update_runs_operations.py deleted file mode 100644 index ea3ad2db225cb..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_06_15_preview/aio/operations/_update_runs_operations.py +++ /dev/null @@ -1,890 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._update_runs_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_by_fleet_request, - build_start_request, - build_stop_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class UpdateRunsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.containerservicefleet.v2023_06_15_preview.aio.ContainerServiceFleetMgmtClient`'s - :attr:`update_runs` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_by_fleet( - self, resource_group_name: str, fleet_name: str, **kwargs: Any - ) -> AsyncIterable["_models.UpdateRun"]: - """List UpdateRun resources by Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :return: An iterator like instance of either UpdateRun or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.UpdateRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-06-15-preview") - ) - cls: ClsType[_models.UpdateRunListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_fleet_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("UpdateRunListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get( - self, resource_group_name: str, fleet_name: str, update_run_name: str, **kwargs: Any - ) -> _models.UpdateRun: - """Get a UpdateRun. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_run_name: The name of the UpdateRun resource. Required. - :type update_run_name: str - :return: UpdateRun or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.UpdateRun - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-06-15-preview") - ) - cls: ClsType[_models.UpdateRun] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("UpdateRun", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - resource: Union[_models.UpdateRun, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-06-15-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "UpdateRun") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - resource: _models.UpdateRun, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.UpdateRun]: - """Create a UpdateRun. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_run_name: The name of the UpdateRun resource. Required. - :type update_run_name: str - :param resource: Resource create parameters. Required. - :type resource: ~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.UpdateRun - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either UpdateRun or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.UpdateRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - resource: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.UpdateRun]: - """Create a UpdateRun. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_run_name: The name of the UpdateRun resource. Required. - :type update_run_name: str - :param resource: Resource create parameters. Required. - :type resource: IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either UpdateRun or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.UpdateRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - resource: Union[_models.UpdateRun, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.UpdateRun]: - """Create a UpdateRun. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_run_name: The name of the UpdateRun resource. Required. - :type update_run_name: str - :param resource: Resource create parameters. Is either a UpdateRun type or a IO[bytes] type. - Required. - :type resource: ~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.UpdateRun or - IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :return: An instance of AsyncLROPoller that returns either UpdateRun or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.UpdateRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-06-15-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.UpdateRun] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - resource=resource, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("UpdateRun", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.UpdateRun].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.UpdateRun]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-06-15-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Delete a UpdateRun. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_run_name: The name of the UpdateRun resource. Required. - :type update_run_name: str - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-06-15-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - if_match=if_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _start_initial( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-06-15-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_start_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_start( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.UpdateRun]: - """Starts an UpdateRun. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_run_name: The name of the UpdateRun resource. Required. - :type update_run_name: str - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :return: An instance of AsyncLROPoller that returns either UpdateRun or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.UpdateRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-06-15-preview") - ) - cls: ClsType[_models.UpdateRun] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._start_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - if_match=if_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("UpdateRun", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.UpdateRun].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.UpdateRun]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _stop_initial( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-06-15-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_stop_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_stop( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.UpdateRun]: - """Stops an UpdateRun. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_run_name: The name of the UpdateRun resource. Required. - :type update_run_name: str - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :return: An instance of AsyncLROPoller that returns either UpdateRun or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.UpdateRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-06-15-preview") - ) - cls: ClsType[_models.UpdateRun] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._stop_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - if_match=if_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("UpdateRun", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.UpdateRun].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.UpdateRun]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_06_15_preview/models/__init__.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_06_15_preview/models/__init__.py deleted file mode 100644 index 2eca739459fe2..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_06_15_preview/models/__init__.py +++ /dev/null @@ -1,115 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._models_py3 import APIServerAccessProfile -from ._models_py3 import AgentProfile -from ._models_py3 import ErrorAdditionalInfo -from ._models_py3 import ErrorDetail -from ._models_py3 import ErrorResponse -from ._models_py3 import Fleet -from ._models_py3 import FleetCredentialResult -from ._models_py3 import FleetCredentialResults -from ._models_py3 import FleetHubProfile -from ._models_py3 import FleetListResult -from ._models_py3 import FleetMember -from ._models_py3 import FleetMemberListResult -from ._models_py3 import FleetMemberUpdate -from ._models_py3 import FleetPatch -from ._models_py3 import ManagedClusterUpdate -from ._models_py3 import ManagedClusterUpgradeSpec -from ._models_py3 import ManagedServiceIdentity -from ._models_py3 import MemberUpdateStatus -from ._models_py3 import NodeImageSelection -from ._models_py3 import NodeImageSelectionStatus -from ._models_py3 import NodeImageVersion -from ._models_py3 import Operation -from ._models_py3 import OperationDisplay -from ._models_py3 import OperationListResult -from ._models_py3 import ProxyResource -from ._models_py3 import Resource -from ._models_py3 import SystemData -from ._models_py3 import TrackedResource -from ._models_py3 import UpdateGroup -from ._models_py3 import UpdateGroupStatus -from ._models_py3 import UpdateRun -from ._models_py3 import UpdateRunListResult -from ._models_py3 import UpdateRunStatus -from ._models_py3 import UpdateRunStrategy -from ._models_py3 import UpdateStage -from ._models_py3 import UpdateStageStatus -from ._models_py3 import UpdateStatus -from ._models_py3 import UserAssignedIdentity -from ._models_py3 import WaitStatus - -from ._container_service_fleet_mgmt_client_enums import ActionType -from ._container_service_fleet_mgmt_client_enums import CreatedByType -from ._container_service_fleet_mgmt_client_enums import FleetMemberProvisioningState -from ._container_service_fleet_mgmt_client_enums import FleetProvisioningState -from ._container_service_fleet_mgmt_client_enums import ManagedClusterUpgradeType -from ._container_service_fleet_mgmt_client_enums import ManagedServiceIdentityType -from ._container_service_fleet_mgmt_client_enums import NodeImageSelectionType -from ._container_service_fleet_mgmt_client_enums import Origin -from ._container_service_fleet_mgmt_client_enums import UpdateRunProvisioningState -from ._container_service_fleet_mgmt_client_enums import UpdateState -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "APIServerAccessProfile", - "AgentProfile", - "ErrorAdditionalInfo", - "ErrorDetail", - "ErrorResponse", - "Fleet", - "FleetCredentialResult", - "FleetCredentialResults", - "FleetHubProfile", - "FleetListResult", - "FleetMember", - "FleetMemberListResult", - "FleetMemberUpdate", - "FleetPatch", - "ManagedClusterUpdate", - "ManagedClusterUpgradeSpec", - "ManagedServiceIdentity", - "MemberUpdateStatus", - "NodeImageSelection", - "NodeImageSelectionStatus", - "NodeImageVersion", - "Operation", - "OperationDisplay", - "OperationListResult", - "ProxyResource", - "Resource", - "SystemData", - "TrackedResource", - "UpdateGroup", - "UpdateGroupStatus", - "UpdateRun", - "UpdateRunListResult", - "UpdateRunStatus", - "UpdateRunStrategy", - "UpdateStage", - "UpdateStageStatus", - "UpdateStatus", - "UserAssignedIdentity", - "WaitStatus", - "ActionType", - "CreatedByType", - "FleetMemberProvisioningState", - "FleetProvisioningState", - "ManagedClusterUpgradeType", - "ManagedServiceIdentityType", - "NodeImageSelectionType", - "Origin", - "UpdateRunProvisioningState", - "UpdateState", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_06_15_preview/models/_container_service_fleet_mgmt_client_enums.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_06_15_preview/models/_container_service_fleet_mgmt_client_enums.py deleted file mode 100644 index 504cfd1911335..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_06_15_preview/models/_container_service_fleet_mgmt_client_enums.py +++ /dev/null @@ -1,139 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from enum import Enum -from azure.core import CaseInsensitiveEnumMeta - - -class ActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs.""" - - INTERNAL = "Internal" - - -class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of identity that created the resource.""" - - USER = "User" - APPLICATION = "Application" - MANAGED_IDENTITY = "ManagedIdentity" - KEY = "Key" - - -class FleetMemberProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The provisioning state of the last accepted operation.""" - - SUCCEEDED = "Succeeded" - """Resource has been created.""" - FAILED = "Failed" - """Resource creation failed.""" - CANCELED = "Canceled" - """Resource creation was canceled.""" - JOINING = "Joining" - """The provisioning state of a member joining a fleet.""" - LEAVING = "Leaving" - """The provisioning state of a member leaving a fleet.""" - UPDATING = "Updating" - """The provisioning state of a member being updated.""" - - -class FleetProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The provisioning state of the last accepted operation.""" - - SUCCEEDED = "Succeeded" - """Resource has been created.""" - FAILED = "Failed" - """Resource creation failed.""" - CANCELED = "Canceled" - """Resource creation was canceled.""" - CREATING = "Creating" - """The provisioning state of a fleet being created.""" - UPDATING = "Updating" - """The provisioning state of a fleet being updated.""" - DELETING = "Deleting" - """The provisioning state of a fleet being deleted.""" - - -class ManagedClusterUpgradeType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of upgrade to perform when targeting ManagedClusters.""" - - FULL = "Full" - """Full upgrades the control plane and all agent pools of the target ManagedClusters. Requires the - ManagedClusterUpgradeSpec.KubernetesVersion property to be set.""" - NODE_IMAGE_ONLY = "NodeImageOnly" - """NodeImageOnly upgrades only the node images of the target ManagedClusters. Requires the - ManagedClusterUpgradeSpec.KubernetesVersion property to NOT be set.""" - - -class ManagedServiceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of managed service identity (where both SystemAssigned and UserAssigned types are - allowed). - """ - - NONE = "None" - SYSTEM_ASSIGNED = "SystemAssigned" - USER_ASSIGNED = "UserAssigned" - SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned, UserAssigned" - - -class NodeImageSelectionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The node image upgrade type.""" - - LATEST = "Latest" - """Use the latest image version when upgrading nodes. Clusters may use different image versions - (e.g., 'AKSUbuntu-1804gen2containerd-2021.10.12' and 'AKSUbuntu-1804gen2containerd-2021.10.19') - because, for example, the latest available version is different in different regions.""" - CONSISTENT = "Consistent" - """The image versions to upgrade nodes to are selected as described below: for each node pool in - managed clusters affected by the update run, the system selects the latest image version such - that it is available across all other node pools (in all other clusters) of the same image - type. As a result, all node pools of the same image type will be upgraded to the same image - version. For example, if the latest image version for image type 'AKSUbuntu-1804gen2containerd' - is 'AKSUbuntu-1804gen2containerd-2021.10.12' for a node pool in cluster A in region X, and is - 'AKSUbuntu-1804gen2containerd-2021.10.17' for a node pool in cluster B in region Y, the system - will upgrade both node pools to image version 'AKSUbuntu-1804gen2containerd-2021.10.12'.""" - - -class Origin(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit - logs UX. Default value is "user,system". - """ - - USER = "user" - SYSTEM = "system" - USER_SYSTEM = "user,system" - - -class UpdateRunProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The provisioning state of the UpdateRun resource.""" - - SUCCEEDED = "Succeeded" - """Resource has been created.""" - FAILED = "Failed" - """Resource creation failed.""" - CANCELED = "Canceled" - """Resource creation was canceled.""" - - -class UpdateState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The state of the UpdateRun, UpdateStage, UpdateGroup, or MemberUpdate.""" - - NOT_STARTED = "NotStarted" - """The state of an UpdateRun/UpdateStage/UpdateGroup/MemberUpdate that has not been started.""" - RUNNING = "Running" - """The state of an UpdateRun/UpdateStage/UpdateGroup/MemberUpdate that is running.""" - STOPPING = "Stopping" - """The state of an UpdateRun/UpdateStage/UpdateGroup/MemberUpdate that is being stopped.""" - STOPPED = "Stopped" - """The state of an UpdateRun/UpdateStage/UpdateGroup/MemberUpdate that has stopped.""" - SKIPPED = "Skipped" - """The state of an UpdateRun/UpdateStage/UpdateGroup/MemberUpdate that has been skipped.""" - FAILED = "Failed" - """The state of an UpdateRun/UpdateStage/UpdateGroup/MemberUpdate that has failed.""" - COMPLETED = "Completed" - """The state of an UpdateRun/UpdateStage/UpdateGroup/MemberUpdate that has completed.""" diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_06_15_preview/models/_models_py3.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_06_15_preview/models/_models_py3.py deleted file mode 100644 index 914d5fd92f6db..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_06_15_preview/models/_models_py3.py +++ /dev/null @@ -1,1592 +0,0 @@ -# coding=utf-8 -# pylint: disable=too-many-lines -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights 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 Any, Dict, List, Optional, TYPE_CHECKING, Union - -from ... import _serialization - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from .. import models as _models - - -class AgentProfile(_serialization.Model): - """Agent profile for the Fleet hub. - - :ivar subnet_id: The ID of the subnet which the Fleet hub node will join on startup. If this is - not specified, a vnet and subnet will be generated and used. - :vartype subnet_id: str - """ - - _attribute_map = { - "subnet_id": {"key": "subnetId", "type": "str"}, - } - - def __init__(self, *, subnet_id: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword subnet_id: The ID of the subnet which the Fleet hub node will join on startup. If this - is not specified, a vnet and subnet will be generated and used. - :paramtype subnet_id: str - """ - super().__init__(**kwargs) - self.subnet_id = subnet_id - - -class APIServerAccessProfile(_serialization.Model): - """Access profile for the Fleet hub API server. - - :ivar enable_private_cluster: Whether to create the Fleet hub as a private cluster or not. - :vartype enable_private_cluster: bool - :ivar enable_vnet_integration: Whether to enable apiserver vnet integration for the Fleet hub - or not. - :vartype enable_vnet_integration: bool - :ivar subnet_id: The subnet to be used when apiserver vnet integration is enabled. It is - required when creating a new Fleet with BYO vnet. - :vartype subnet_id: str - """ - - _attribute_map = { - "enable_private_cluster": {"key": "enablePrivateCluster", "type": "bool"}, - "enable_vnet_integration": {"key": "enableVnetIntegration", "type": "bool"}, - "subnet_id": {"key": "subnetId", "type": "str"}, - } - - def __init__( - self, - *, - enable_private_cluster: Optional[bool] = None, - enable_vnet_integration: Optional[bool] = None, - subnet_id: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword enable_private_cluster: Whether to create the Fleet hub as a private cluster or not. - :paramtype enable_private_cluster: bool - :keyword enable_vnet_integration: Whether to enable apiserver vnet integration for the Fleet - hub or not. - :paramtype enable_vnet_integration: bool - :keyword subnet_id: The subnet to be used when apiserver vnet integration is enabled. It is - required when creating a new Fleet with BYO vnet. - :paramtype subnet_id: str - """ - super().__init__(**kwargs) - self.enable_private_cluster = enable_private_cluster - self.enable_vnet_integration = enable_vnet_integration - self.subnet_id = subnet_id - - -class ErrorAdditionalInfo(_serialization.Model): - """The resource management error additional info. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar type: The additional info type. - :vartype type: str - :ivar info: The additional info. - :vartype info: JSON - """ - - _validation = { - "type": {"readonly": True}, - "info": {"readonly": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "info": {"key": "info", "type": "object"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.type = None - self.info = None - - -class ErrorDetail(_serialization.Model): - """The error detail. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar code: The error code. - :vartype code: str - :ivar message: The error message. - :vartype message: str - :ivar target: The error target. - :vartype target: str - :ivar details: The error details. - :vartype details: - list[~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.ErrorDetail] - :ivar additional_info: The error additional info. - :vartype additional_info: - list[~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.ErrorAdditionalInfo] - """ - - _validation = { - "code": {"readonly": True}, - "message": {"readonly": True}, - "target": {"readonly": True}, - "details": {"readonly": True}, - "additional_info": {"readonly": True}, - } - - _attribute_map = { - "code": {"key": "code", "type": "str"}, - "message": {"key": "message", "type": "str"}, - "target": {"key": "target", "type": "str"}, - "details": {"key": "details", "type": "[ErrorDetail]"}, - "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.code = None - self.message = None - self.target = None - self.details = None - self.additional_info = None - - -class ErrorResponse(_serialization.Model): - """Common error response for all Azure Resource Manager APIs to return error details for failed - operations. (This also follows the OData error response format.). - - :ivar error: The error object. - :vartype error: ~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.ErrorDetail - """ - - _attribute_map = { - "error": {"key": "error", "type": "ErrorDetail"}, - } - - def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: Any) -> None: - """ - :keyword error: The error object. - :paramtype error: ~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.ErrorDetail - """ - super().__init__(**kwargs) - self.error = error - - -class Resource(_serialization.Model): - """Common fields that are returned in the response for all Azure Resource Manager resources. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.SystemData - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.system_data = None - - -class TrackedResource(Resource): - """The resource model definition for an Azure Resource Manager tracked top level resource which - has 'tags' and a 'location'. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.SystemData - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "location": {"required": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - } - - def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - """ - super().__init__(**kwargs) - self.tags = tags - self.location = location - - -class Fleet(TrackedResource): - """The Fleet 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 server. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.SystemData - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - :ivar e_tag: If eTag is provided in the response body, it may also be provided as a header per - the normal etag convention. Entity tags are used for comparing two or more entities from the - same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match - (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. - :vartype e_tag: str - :ivar identity: Managed identity. - :vartype identity: - ~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.ManagedServiceIdentity - :ivar provisioning_state: The status of the last operation. Known values are: "Succeeded", - "Failed", "Canceled", "Creating", "Updating", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.FleetProvisioningState - :ivar hub_profile: The FleetHubProfile configures the Fleet's hub. - :vartype hub_profile: - ~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.FleetHubProfile - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "location": {"required": True}, - "e_tag": {"readonly": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - "e_tag": {"key": "eTag", "type": "str"}, - "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "hub_profile": {"key": "properties.hubProfile", "type": "FleetHubProfile"}, - } - - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - identity: Optional["_models.ManagedServiceIdentity"] = None, - hub_profile: Optional["_models.FleetHubProfile"] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - :keyword identity: Managed identity. - :paramtype identity: - ~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.ManagedServiceIdentity - :keyword hub_profile: The FleetHubProfile configures the Fleet's hub. - :paramtype hub_profile: - ~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.FleetHubProfile - """ - super().__init__(tags=tags, location=location, **kwargs) - self.e_tag = None - self.identity = identity - self.provisioning_state = None - self.hub_profile = hub_profile - - -class FleetCredentialResult(_serialization.Model): - """One credential result item. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: The name of the credential. - :vartype name: str - :ivar value: Base64-encoded Kubernetes configuration file. - :vartype value: bytes - """ - - _validation = { - "name": {"readonly": True}, - "value": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "value": {"key": "value", "type": "bytearray"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.value = None - - -class FleetCredentialResults(_serialization.Model): - """The Credential results response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar kubeconfigs: Array of base64-encoded Kubernetes configuration files. - :vartype kubeconfigs: - list[~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.FleetCredentialResult] - """ - - _validation = { - "kubeconfigs": {"readonly": True}, - } - - _attribute_map = { - "kubeconfigs": {"key": "kubeconfigs", "type": "[FleetCredentialResult]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.kubeconfigs = None - - -class FleetHubProfile(_serialization.Model): - """The FleetHubProfile configures the fleet hub. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar dns_prefix: DNS prefix used to create the FQDN for the Fleet hub. - :vartype dns_prefix: str - :ivar api_server_access_profile: The access profile for the Fleet hub API server. - :vartype api_server_access_profile: - ~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.APIServerAccessProfile - :ivar agent_profile: The agent profile for the Fleet hub. - :vartype agent_profile: - ~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.AgentProfile - :ivar fqdn: The FQDN of the Fleet hub. - :vartype fqdn: str - :ivar kubernetes_version: The Kubernetes version of the Fleet hub. - :vartype kubernetes_version: str - """ - - _validation = { - "dns_prefix": { - "max_length": 54, - "min_length": 1, - "pattern": r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][a-zA-Z0-9-]{0,52}[a-zA-Z0-9]$", - }, - "fqdn": {"readonly": True}, - "kubernetes_version": {"readonly": True}, - } - - _attribute_map = { - "dns_prefix": {"key": "dnsPrefix", "type": "str"}, - "api_server_access_profile": {"key": "apiServerAccessProfile", "type": "APIServerAccessProfile"}, - "agent_profile": {"key": "agentProfile", "type": "AgentProfile"}, - "fqdn": {"key": "fqdn", "type": "str"}, - "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, - } - - def __init__( - self, - *, - dns_prefix: Optional[str] = None, - api_server_access_profile: Optional["_models.APIServerAccessProfile"] = None, - agent_profile: Optional["_models.AgentProfile"] = None, - **kwargs: Any - ) -> None: - """ - :keyword dns_prefix: DNS prefix used to create the FQDN for the Fleet hub. - :paramtype dns_prefix: str - :keyword api_server_access_profile: The access profile for the Fleet hub API server. - :paramtype api_server_access_profile: - ~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.APIServerAccessProfile - :keyword agent_profile: The agent profile for the Fleet hub. - :paramtype agent_profile: - ~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.AgentProfile - """ - super().__init__(**kwargs) - self.dns_prefix = dns_prefix - self.api_server_access_profile = api_server_access_profile - self.agent_profile = agent_profile - self.fqdn = None - self.kubernetes_version = None - - -class FleetListResult(_serialization.Model): - """The response of a Fleet list operation. - - All required parameters must be populated in order to send to server. - - :ivar value: The Fleet items on this page. Required. - :vartype value: list[~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.Fleet] - :ivar next_link: The link to the next page of items. - :vartype next_link: str - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[Fleet]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, *, value: List["_models.Fleet"], next_link: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword value: The Fleet items on this page. Required. - :paramtype value: list[~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.Fleet] - :keyword next_link: The link to the next page of items. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ProxyResource(Resource): - """The resource model definition for a Azure Resource Manager proxy resource. It will not have - tags and a location. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.SystemData - """ - - -class FleetMember(ProxyResource): - """A member of the Fleet. It contains a reference to an existing Kubernetes cluster on Azure. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.SystemData - :ivar e_tag: If eTag is provided in the response body, it may also be provided as a header per - the normal etag convention. Entity tags are used for comparing two or more entities from the - same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match - (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. - :vartype e_tag: str - :ivar cluster_resource_id: The ARM resource id of the cluster that joins the Fleet. Must be a - valid Azure resource id. e.g.: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{clusterName}'. # pylint: disable=line-too-long - :vartype cluster_resource_id: str - :ivar group: The group this member belongs to for multi-cluster update management. - :vartype group: str - :ivar provisioning_state: The status of the last operation. Known values are: "Succeeded", - "Failed", "Canceled", "Joining", "Leaving", and "Updating". - :vartype provisioning_state: str or - ~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.FleetMemberProvisioningState - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "e_tag": {"readonly": True}, - "group": {"max_length": 50, "min_length": 1, "pattern": r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$"}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "e_tag": {"key": "eTag", "type": "str"}, - "cluster_resource_id": {"key": "properties.clusterResourceId", "type": "str"}, - "group": {"key": "properties.group", "type": "str"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - } - - def __init__( - self, *, cluster_resource_id: Optional[str] = None, group: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword cluster_resource_id: The ARM resource id of the cluster that joins the Fleet. Must be - a valid Azure resource id. e.g.: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{clusterName}'. # pylint: disable=line-too-long - :paramtype cluster_resource_id: str - :keyword group: The group this member belongs to for multi-cluster update management. - :paramtype group: str - """ - super().__init__(**kwargs) - self.e_tag = None - self.cluster_resource_id = cluster_resource_id - self.group = group - self.provisioning_state = None - - -class FleetMemberListResult(_serialization.Model): - """The response of a FleetMember list operation. - - All required parameters must be populated in order to send to server. - - :ivar value: The FleetMember items on this page. Required. - :vartype value: list[~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.FleetMember] - :ivar next_link: The link to the next page of items. - :vartype next_link: str - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[FleetMember]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, *, value: List["_models.FleetMember"], next_link: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword value: The FleetMember items on this page. Required. - :paramtype value: - list[~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.FleetMember] - :keyword next_link: The link to the next page of items. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class FleetMemberUpdate(_serialization.Model): - """The type used for update operations of the FleetMember. - - :ivar group: The group this member belongs to for multi-cluster update management. - :vartype group: str - """ - - _validation = { - "group": {"max_length": 50, "min_length": 1, "pattern": r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$"}, - } - - _attribute_map = { - "group": {"key": "properties.group", "type": "str"}, - } - - def __init__(self, *, group: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword group: The group this member belongs to for multi-cluster update management. - :paramtype group: str - """ - super().__init__(**kwargs) - self.group = group - - -class FleetPatch(_serialization.Model): - """Properties of a Fleet that can be patched. - - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar identity: Managed identity. - :vartype identity: - ~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.ManagedServiceIdentity - """ - - _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, - } - - def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - identity: Optional["_models.ManagedServiceIdentity"] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword identity: Managed identity. - :paramtype identity: - ~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.ManagedServiceIdentity - """ - super().__init__(**kwargs) - self.tags = tags - self.identity = identity - - -class ManagedClusterUpdate(_serialization.Model): - """The update to be applied to the ManagedClusters. - - All required parameters must be populated in order to send to server. - - :ivar upgrade: The upgrade to apply to the ManagedClusters. Required. - :vartype upgrade: - ~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.ManagedClusterUpgradeSpec - :ivar node_image_selection: The node image upgrade to be applied to the target nodes in update - run. - :vartype node_image_selection: - ~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.NodeImageSelection - """ - - _validation = { - "upgrade": {"required": True}, - } - - _attribute_map = { - "upgrade": {"key": "upgrade", "type": "ManagedClusterUpgradeSpec"}, - "node_image_selection": {"key": "nodeImageSelection", "type": "NodeImageSelection"}, - } - - def __init__( - self, - *, - upgrade: "_models.ManagedClusterUpgradeSpec", - node_image_selection: Optional["_models.NodeImageSelection"] = None, - **kwargs: Any - ) -> None: - """ - :keyword upgrade: The upgrade to apply to the ManagedClusters. Required. - :paramtype upgrade: - ~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.ManagedClusterUpgradeSpec - :keyword node_image_selection: The node image upgrade to be applied to the target nodes in - update run. - :paramtype node_image_selection: - ~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.NodeImageSelection - """ - super().__init__(**kwargs) - self.upgrade = upgrade - self.node_image_selection = node_image_selection - - -class ManagedClusterUpgradeSpec(_serialization.Model): - """The upgrade to apply to a ManagedCluster. - - All required parameters must be populated in order to send to server. - - :ivar type: ManagedClusterUpgradeType is the type of upgrade to be applied. Required. Known - values are: "Full" and "NodeImageOnly". - :vartype type: str or - ~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.ManagedClusterUpgradeType - :ivar kubernetes_version: The Kubernetes version to upgrade the member clusters to. - :vartype kubernetes_version: str - """ - - _validation = { - "type": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, - } - - def __init__( - self, - *, - type: Union[str, "_models.ManagedClusterUpgradeType"], - kubernetes_version: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword type: ManagedClusterUpgradeType is the type of upgrade to be applied. Required. Known - values are: "Full" and "NodeImageOnly". - :paramtype type: str or - ~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.ManagedClusterUpgradeType - :keyword kubernetes_version: The Kubernetes version to upgrade the member clusters to. - :paramtype kubernetes_version: str - """ - super().__init__(**kwargs) - self.type = type - self.kubernetes_version = kubernetes_version - - -class ManagedServiceIdentity(_serialization.Model): - """Managed service identity (system assigned and/or user assigned identities). - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar principal_id: The service principal ID of the system assigned identity. This property - will only be provided for a system assigned identity. - :vartype principal_id: str - :ivar tenant_id: The tenant ID of the system assigned identity. This property will only be - provided for a system assigned identity. - :vartype tenant_id: str - :ivar type: Type of managed service identity (where both SystemAssigned and UserAssigned types - are allowed). Required. Known values are: "None", "SystemAssigned", "UserAssigned", and - "SystemAssigned, UserAssigned". - :vartype type: str or - ~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.ManagedServiceIdentityType - :ivar user_assigned_identities: The set of user assigned identities associated with the - resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. # pylint: disable=line-too-long - The dictionary values can be empty objects ({}) in requests. - :vartype user_assigned_identities: dict[str, - ~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.UserAssignedIdentity] - """ - - _validation = { - "principal_id": {"readonly": True}, - "tenant_id": {"readonly": True}, - "type": {"required": True}, - } - - _attribute_map = { - "principal_id": {"key": "principalId", "type": "str"}, - "tenant_id": {"key": "tenantId", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "user_assigned_identities": {"key": "userAssignedIdentities", "type": "{UserAssignedIdentity}"}, - } - - def __init__( - self, - *, - type: Union[str, "_models.ManagedServiceIdentityType"], - user_assigned_identities: Optional[Dict[str, "_models.UserAssignedIdentity"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword type: Type of managed service identity (where both SystemAssigned and UserAssigned - types are allowed). Required. Known values are: "None", "SystemAssigned", "UserAssigned", and - "SystemAssigned, UserAssigned". - :paramtype type: str or - ~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.ManagedServiceIdentityType - :keyword user_assigned_identities: The set of user assigned identities associated with the - resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. # pylint: disable=line-too-long - The dictionary values can be empty objects ({}) in requests. - :paramtype user_assigned_identities: dict[str, - ~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.UserAssignedIdentity] - """ - super().__init__(**kwargs) - self.principal_id = None - self.tenant_id = None - self.type = type - self.user_assigned_identities = user_assigned_identities - - -class MemberUpdateStatus(_serialization.Model): - """The status of a member update operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar status: The status of the MemberUpdate operation. - :vartype status: ~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.UpdateStatus - :ivar name: The name of the FleetMember. - :vartype name: str - :ivar cluster_resource_id: The Azure resource id of the target Kubernetes cluster. - :vartype cluster_resource_id: str - :ivar operation_id: The operation resource id of the latest attempt to perform the operation. - :vartype operation_id: str - :ivar message: The status message after processing the member update operation. - :vartype message: str - """ - - _validation = { - "status": {"readonly": True}, - "name": {"readonly": True}, - "cluster_resource_id": {"readonly": True}, - "operation_id": {"readonly": True}, - "message": {"readonly": True}, - } - - _attribute_map = { - "status": {"key": "status", "type": "UpdateStatus"}, - "name": {"key": "name", "type": "str"}, - "cluster_resource_id": {"key": "clusterResourceId", "type": "str"}, - "operation_id": {"key": "operationId", "type": "str"}, - "message": {"key": "message", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.status = None - self.name = None - self.cluster_resource_id = None - self.operation_id = None - self.message = None - - -class NodeImageSelection(_serialization.Model): - """The node image upgrade to be applied to the target nodes in update run. - - All required parameters must be populated in order to send to server. - - :ivar type: The node image upgrade type. Required. Known values are: "Latest" and "Consistent". - :vartype type: str or - ~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.NodeImageSelectionType - """ - - _validation = { - "type": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - } - - def __init__(self, *, type: Union[str, "_models.NodeImageSelectionType"], **kwargs: Any) -> None: - """ - :keyword type: The node image upgrade type. Required. Known values are: "Latest" and - "Consistent". - :paramtype type: str or - ~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.NodeImageSelectionType - """ - super().__init__(**kwargs) - self.type = type - - -class NodeImageSelectionStatus(_serialization.Model): - """The node image upgrade specs for the update run. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar selected_node_image_versions: The image versions to upgrade the nodes to. - :vartype selected_node_image_versions: - list[~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.NodeImageVersion] - """ - - _validation = { - "selected_node_image_versions": {"readonly": True}, - } - - _attribute_map = { - "selected_node_image_versions": {"key": "selectedNodeImageVersions", "type": "[NodeImageVersion]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.selected_node_image_versions = None - - -class NodeImageVersion(_serialization.Model): - """The node upgrade image version. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar version: The image version to upgrade the nodes to (e.g., - 'AKSUbuntu-1804gen2containerd-2022.12.13'). - :vartype version: str - """ - - _validation = { - "version": {"readonly": True}, - } - - _attribute_map = { - "version": {"key": "version", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.version = None - - -class Operation(_serialization.Model): - """Details of a REST API operation, returned from the Resource Provider Operations API. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: - "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". - :vartype name: str - :ivar is_data_action: Whether the operation applies to data-plane. This is "true" for - data-plane operations and "false" for ARM/control-plane operations. - :vartype is_data_action: bool - :ivar display: Localized display information for this particular operation. - :vartype display: ~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.OperationDisplay - :ivar origin: The intended executor of the operation; as in Resource Based Access Control - (RBAC) and audit logs UX. Default value is "user,system". Known values are: "user", "system", - and "user,system". - :vartype origin: str or ~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.Origin - :ivar action_type: Enum. Indicates the action type. "Internal" refers to actions that are for - internal only APIs. "Internal" - :vartype action_type: str or - ~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.ActionType - """ - - _validation = { - "name": {"readonly": True}, - "is_data_action": {"readonly": True}, - "origin": {"readonly": True}, - "action_type": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "is_data_action": {"key": "isDataAction", "type": "bool"}, - "display": {"key": "display", "type": "OperationDisplay"}, - "origin": {"key": "origin", "type": "str"}, - "action_type": {"key": "actionType", "type": "str"}, - } - - def __init__(self, *, display: Optional["_models.OperationDisplay"] = None, **kwargs: Any) -> None: - """ - :keyword display: Localized display information for this particular operation. - :paramtype display: - ~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.OperationDisplay - """ - super().__init__(**kwargs) - self.name = None - self.is_data_action = None - self.display = display - self.origin = None - self.action_type = None - - -class OperationDisplay(_serialization.Model): - """Localized display information for this particular operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provider: The localized friendly form of the resource provider name, e.g. "Microsoft - Monitoring Insights" or "Microsoft Compute". - :vartype provider: str - :ivar resource: The localized friendly name of the resource type related to this operation. - E.g. "Virtual Machines" or "Job Schedule Collections". - :vartype resource: str - :ivar operation: The concise, localized friendly name for the operation; suitable for - dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual Machine". - :vartype operation: str - :ivar description: The short, localized friendly description of the operation; suitable for - tool tips and detailed views. - :vartype description: str - """ - - _validation = { - "provider": {"readonly": True}, - "resource": {"readonly": True}, - "operation": {"readonly": True}, - "description": {"readonly": True}, - } - - _attribute_map = { - "provider": {"key": "provider", "type": "str"}, - "resource": {"key": "resource", "type": "str"}, - "operation": {"key": "operation", "type": "str"}, - "description": {"key": "description", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.provider = None - self.resource = None - self.operation = None - self.description = None - - -class OperationListResult(_serialization.Model): - """A list of REST API operations supported by an Azure Resource Provider. It contains an URL link - to get the next set of results. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of operations supported by the resource provider. - :vartype value: list[~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.Operation] - :ivar next_link: URL to get the next set of operation list results (if there are any). - :vartype next_link: str - """ - - _validation = { - "value": {"readonly": True}, - "next_link": {"readonly": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[Operation]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.value = None - self.next_link = None - - -class SystemData(_serialization.Model): - """Metadata pertaining to creation and last modification of the resource. - - :ivar created_by: The identity that created the resource. - :vartype created_by: str - :ivar created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", and "Key". - :vartype created_by_type: str or - ~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.CreatedByType - :ivar created_at: The timestamp of resource creation (UTC). - :vartype created_at: ~datetime.datetime - :ivar last_modified_by: The identity that last modified the resource. - :vartype last_modified_by: str - :ivar last_modified_by_type: The type of identity that last modified the resource. Known values - are: "User", "Application", "ManagedIdentity", and "Key". - :vartype last_modified_by_type: str or - ~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.CreatedByType - :ivar last_modified_at: The timestamp of resource last modification (UTC). - :vartype last_modified_at: ~datetime.datetime - """ - - _attribute_map = { - "created_by": {"key": "createdBy", "type": "str"}, - "created_by_type": {"key": "createdByType", "type": "str"}, - "created_at": {"key": "createdAt", "type": "iso-8601"}, - "last_modified_by": {"key": "lastModifiedBy", "type": "str"}, - "last_modified_by_type": {"key": "lastModifiedByType", "type": "str"}, - "last_modified_at": {"key": "lastModifiedAt", "type": "iso-8601"}, - } - - def __init__( - self, - *, - created_by: Optional[str] = None, - created_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, - created_at: Optional[datetime.datetime] = None, - last_modified_by: Optional[str] = None, - last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, - last_modified_at: Optional[datetime.datetime] = None, - **kwargs: Any - ) -> None: - """ - :keyword created_by: The identity that created the resource. - :paramtype created_by: str - :keyword created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", and "Key". - :paramtype created_by_type: str or - ~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.CreatedByType - :keyword created_at: The timestamp of resource creation (UTC). - :paramtype created_at: ~datetime.datetime - :keyword last_modified_by: The identity that last modified the resource. - :paramtype last_modified_by: str - :keyword last_modified_by_type: The type of identity that last modified the resource. Known - values are: "User", "Application", "ManagedIdentity", and "Key". - :paramtype last_modified_by_type: str or - ~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.CreatedByType - :keyword last_modified_at: The timestamp of resource last modification (UTC). - :paramtype last_modified_at: ~datetime.datetime - """ - super().__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 UpdateGroup(_serialization.Model): - """A group to be updated. - - All required parameters must be populated in order to send to server. - - :ivar name: Name of the group. - It must match a group name of an existing fleet member. Required. - :vartype name: str - """ - - _validation = { - "name": {"required": True, "max_length": 50, "min_length": 1, "pattern": r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$"}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - } - - def __init__(self, *, name: str, **kwargs: Any) -> None: - """ - :keyword name: Name of the group. - It must match a group name of an existing fleet member. Required. - :paramtype name: str - """ - super().__init__(**kwargs) - self.name = name - - -class UpdateGroupStatus(_serialization.Model): - """The status of a UpdateGroup. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar status: The status of the UpdateGroup. - :vartype status: ~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.UpdateStatus - :ivar name: The name of the UpdateGroup. - :vartype name: str - :ivar members: The list of member this UpdateGroup updates. - :vartype members: - list[~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.MemberUpdateStatus] - """ - - _validation = { - "status": {"readonly": True}, - "name": {"readonly": True}, - "members": {"readonly": True}, - } - - _attribute_map = { - "status": {"key": "status", "type": "UpdateStatus"}, - "name": {"key": "name", "type": "str"}, - "members": {"key": "members", "type": "[MemberUpdateStatus]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.status = None - self.name = None - self.members = None - - -class UpdateRun(ProxyResource): - """A multi-stage process to perform update operations across members of a Fleet. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.SystemData - :ivar e_tag: If eTag is provided in the response body, it may also be provided as a header per - the normal etag convention. Entity tags are used for comparing two or more entities from the - same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match - (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. - :vartype e_tag: str - :ivar provisioning_state: The provisioning state of the UpdateRun resource. Known values are: - "Succeeded", "Failed", and "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.UpdateRunProvisioningState - :ivar strategy: The strategy defines the order in which the clusters will be updated. - If not set, all members will be updated sequentially. The UpdateRun status will show a single - UpdateStage and a single UpdateGroup targeting all members. - The strategy of the UpdateRun can be modified until the run is started. - :vartype strategy: - ~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.UpdateRunStrategy - :ivar managed_cluster_update: The update to be applied to all clusters in the UpdateRun. The - managedClusterUpdate can be modified until the run is started. - :vartype managed_cluster_update: - ~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.ManagedClusterUpdate - :ivar status: The status of the UpdateRun. - :vartype status: ~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.UpdateRunStatus - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "e_tag": {"readonly": True}, - "provisioning_state": {"readonly": True}, - "status": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "e_tag": {"key": "eTag", "type": "str"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "strategy": {"key": "properties.strategy", "type": "UpdateRunStrategy"}, - "managed_cluster_update": {"key": "properties.managedClusterUpdate", "type": "ManagedClusterUpdate"}, - "status": {"key": "properties.status", "type": "UpdateRunStatus"}, - } - - def __init__( - self, - *, - strategy: Optional["_models.UpdateRunStrategy"] = None, - managed_cluster_update: Optional["_models.ManagedClusterUpdate"] = None, - **kwargs: Any - ) -> None: - """ - :keyword strategy: The strategy defines the order in which the clusters will be updated. - If not set, all members will be updated sequentially. The UpdateRun status will show a single - UpdateStage and a single UpdateGroup targeting all members. - The strategy of the UpdateRun can be modified until the run is started. - :paramtype strategy: - ~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.UpdateRunStrategy - :keyword managed_cluster_update: The update to be applied to all clusters in the UpdateRun. The - managedClusterUpdate can be modified until the run is started. - :paramtype managed_cluster_update: - ~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.ManagedClusterUpdate - """ - super().__init__(**kwargs) - self.e_tag = None - self.provisioning_state = None - self.strategy = strategy - self.managed_cluster_update = managed_cluster_update - self.status = None - - -class UpdateRunListResult(_serialization.Model): - """The response of a UpdateRun list operation. - - All required parameters must be populated in order to send to server. - - :ivar value: The UpdateRun items on this page. Required. - :vartype value: list[~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.UpdateRun] - :ivar next_link: The link to the next page of items. - :vartype next_link: str - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[UpdateRun]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, *, value: List["_models.UpdateRun"], next_link: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword value: The UpdateRun items on this page. Required. - :paramtype value: list[~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.UpdateRun] - :keyword next_link: The link to the next page of items. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class UpdateRunStatus(_serialization.Model): - """The status of a UpdateRun. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar status: The status of the UpdateRun. - :vartype status: ~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.UpdateStatus - :ivar stages: The stages composing an update run. Stages are run sequentially withing an - UpdateRun. - :vartype stages: - list[~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.UpdateStageStatus] - :ivar node_image_selection: The node image upgrade specs for the update run. It is only set in - update run when ``NodeImageSelection.type`` is ``Consistent``. - :vartype node_image_selection: - ~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.NodeImageSelectionStatus - """ - - _validation = { - "status": {"readonly": True}, - "stages": {"readonly": True}, - "node_image_selection": {"readonly": True}, - } - - _attribute_map = { - "status": {"key": "status", "type": "UpdateStatus"}, - "stages": {"key": "stages", "type": "[UpdateStageStatus]"}, - "node_image_selection": {"key": "nodeImageSelection", "type": "NodeImageSelectionStatus"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.status = None - self.stages = None - self.node_image_selection = None - - -class UpdateRunStrategy(_serialization.Model): - """Defines the update sequence of the clusters via stages and groups. - - Stages within a run are executed sequentially one after another. - Groups within a stage are executed in parallel. - Member clusters within a group are updated sequentially one after another. - - A valid strategy contains no duplicate groups within or across stages. - - All required parameters must be populated in order to send to server. - - :ivar stages: The list of stages that compose this update run. Min size: 1. Required. - :vartype stages: list[~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.UpdateStage] - """ - - _validation = { - "stages": {"required": True}, - } - - _attribute_map = { - "stages": {"key": "stages", "type": "[UpdateStage]"}, - } - - def __init__(self, *, stages: List["_models.UpdateStage"], **kwargs: Any) -> None: - """ - :keyword stages: The list of stages that compose this update run. Min size: 1. Required. - :paramtype stages: - list[~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.UpdateStage] - """ - super().__init__(**kwargs) - self.stages = stages - - -class UpdateStage(_serialization.Model): - """Defines a stage which contains the groups to update and the steps to take (e.g., wait for a - time period) before starting the next stage. - - All required parameters must be populated in order to send to server. - - :ivar name: The name of the stage. Must be unique within the UpdateRun. Required. - :vartype name: str - :ivar groups: Defines the groups to be executed in parallel in this stage. Duplicate groups are - not allowed. Min size: 1. - :vartype groups: list[~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.UpdateGroup] - :ivar after_stage_wait_in_seconds: The time in seconds to wait at the end of this stage before - starting the next one. Defaults to 0 seconds if unspecified. - :vartype after_stage_wait_in_seconds: int - """ - - _validation = { - "name": {"required": True, "max_length": 50, "min_length": 1, "pattern": r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$"}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "groups": {"key": "groups", "type": "[UpdateGroup]"}, - "after_stage_wait_in_seconds": {"key": "afterStageWaitInSeconds", "type": "int"}, - } - - def __init__( - self, - *, - name: str, - groups: Optional[List["_models.UpdateGroup"]] = None, - after_stage_wait_in_seconds: Optional[int] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: The name of the stage. Must be unique within the UpdateRun. Required. - :paramtype name: str - :keyword groups: Defines the groups to be executed in parallel in this stage. Duplicate groups - are not allowed. Min size: 1. - :paramtype groups: - list[~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.UpdateGroup] - :keyword after_stage_wait_in_seconds: The time in seconds to wait at the end of this stage - before starting the next one. Defaults to 0 seconds if unspecified. - :paramtype after_stage_wait_in_seconds: int - """ - super().__init__(**kwargs) - self.name = name - self.groups = groups - self.after_stage_wait_in_seconds = after_stage_wait_in_seconds - - -class UpdateStageStatus(_serialization.Model): - """The status of a UpdateStage. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar status: The status of the UpdateStage. - :vartype status: ~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.UpdateStatus - :ivar name: The name of the UpdateStage. - :vartype name: str - :ivar groups: The list of groups to be updated as part of this UpdateStage. - :vartype groups: - list[~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.UpdateGroupStatus] - :ivar after_stage_wait_status: The status of the wait period configured on the UpdateStage. - :vartype after_stage_wait_status: - ~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.WaitStatus - """ - - _validation = { - "status": {"readonly": True}, - "name": {"readonly": True}, - "groups": {"readonly": True}, - "after_stage_wait_status": {"readonly": True}, - } - - _attribute_map = { - "status": {"key": "status", "type": "UpdateStatus"}, - "name": {"key": "name", "type": "str"}, - "groups": {"key": "groups", "type": "[UpdateGroupStatus]"}, - "after_stage_wait_status": {"key": "afterStageWaitStatus", "type": "WaitStatus"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.status = None - self.name = None - self.groups = None - self.after_stage_wait_status = None - - -class UpdateStatus(_serialization.Model): - """The status for an operation or group of operations. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar start_time: The time the operation or group was started. - :vartype start_time: ~datetime.datetime - :ivar completed_time: The time the operation or group was completed. - :vartype completed_time: ~datetime.datetime - :ivar state: The State of the operation or group. Known values are: "NotStarted", "Running", - "Stopping", "Stopped", "Skipped", "Failed", and "Completed". - :vartype state: str or ~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.UpdateState - :ivar error: The error details when a failure is encountered. - :vartype error: ~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.ErrorDetail - """ - - _validation = { - "start_time": {"readonly": True}, - "completed_time": {"readonly": True}, - "state": {"readonly": True}, - "error": {"readonly": True}, - } - - _attribute_map = { - "start_time": {"key": "startTime", "type": "iso-8601"}, - "completed_time": {"key": "completedTime", "type": "iso-8601"}, - "state": {"key": "state", "type": "str"}, - "error": {"key": "error", "type": "ErrorDetail"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.start_time = None - self.completed_time = None - self.state = None - self.error = None - - -class UserAssignedIdentity(_serialization.Model): - """User assigned identity properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar principal_id: The principal ID of the assigned identity. - :vartype principal_id: str - :ivar client_id: The client ID of the assigned identity. - :vartype client_id: str - """ - - _validation = { - "principal_id": {"readonly": True}, - "client_id": {"readonly": True}, - } - - _attribute_map = { - "principal_id": {"key": "principalId", "type": "str"}, - "client_id": {"key": "clientId", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.principal_id = None - self.client_id = None - - -class WaitStatus(_serialization.Model): - """The status of the wait duration. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar status: The status of the wait duration. - :vartype status: ~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.UpdateStatus - :ivar wait_duration_in_seconds: The wait duration configured in seconds. - :vartype wait_duration_in_seconds: int - """ - - _validation = { - "status": {"readonly": True}, - "wait_duration_in_seconds": {"readonly": True}, - } - - _attribute_map = { - "status": {"key": "status", "type": "UpdateStatus"}, - "wait_duration_in_seconds": {"key": "waitDurationInSeconds", "type": "int"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.status = None - self.wait_duration_in_seconds = None diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_06_15_preview/models/_patch.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_06_15_preview/models/_patch.py deleted file mode 100644 index f7dd32510333d..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_06_15_preview/models/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_06_15_preview/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_06_15_preview/operations/__init__.py deleted file mode 100644 index b2c1526f4d81e..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_06_15_preview/operations/__init__.py +++ /dev/null @@ -1,25 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._operations import Operations -from ._fleets_operations import FleetsOperations -from ._fleet_members_operations import FleetMembersOperations -from ._update_runs_operations import UpdateRunsOperations - -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "Operations", - "FleetsOperations", - "FleetMembersOperations", - "UpdateRunsOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_06_15_preview/operations/_fleet_members_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_06_15_preview/operations/_fleet_members_operations.py deleted file mode 100644 index 58cdcb4e06929..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_06_15_preview/operations/_fleet_members_operations.py +++ /dev/null @@ -1,1076 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_fleet_request( - resource_group_name: str, fleet_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-15-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, fleet_name: str, fleet_member_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-15-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - "fleetMemberName": _SERIALIZER.url( - "fleet_member_name", - fleet_member_name, - "str", - max_length=50, - min_length=1, - pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_request( - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-15-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - "fleetMemberName": _SERIALIZER.url( - "fleet_member_name", - fleet_member_name, - "str", - max_length=50, - min_length=1, - pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if if_none_match is not None: - _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-15-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - "fleetMemberName": _SERIALIZER.url( - "fleet_member_name", - fleet_member_name, - "str", - max_length=50, - min_length=1, - pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-15-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - "fleetMemberName": _SERIALIZER.url( - "fleet_member_name", - fleet_member_name, - "str", - max_length=50, - min_length=1, - pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -class FleetMembersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.containerservicefleet.v2023_06_15_preview.ContainerServiceFleetMgmtClient`'s - :attr:`fleet_members` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_by_fleet( - self, resource_group_name: str, fleet_name: str, **kwargs: Any - ) -> Iterable["_models.FleetMember"]: - """List FleetMember resources by Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :return: An iterator like instance of either FleetMember or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.FleetMember] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-06-15-preview") - ) - cls: ClsType[_models.FleetMemberListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_fleet_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("FleetMemberListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get( - self, resource_group_name: str, fleet_name: str, fleet_member_name: str, **kwargs: Any - ) -> _models.FleetMember: - """Get a FleetMember. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :return: FleetMember or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.FleetMember - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-06-15-preview") - ) - cls: ClsType[_models.FleetMember] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - fleet_member_name=fleet_member_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("FleetMember", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_initial( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - resource: Union[_models.FleetMember, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-06-15-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "FleetMember") - - _request = build_create_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - fleet_member_name=fleet_member_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - resource: _models.FleetMember, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.FleetMember]: - """Create a FleetMember. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :param resource: Resource create parameters. Required. - :type resource: ~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.FleetMember - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either FleetMember or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.FleetMember] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - resource: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.FleetMember]: - """Create a FleetMember. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :param resource: Resource create parameters. Required. - :type resource: IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either FleetMember or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.FleetMember] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - resource: Union[_models.FleetMember, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[_models.FleetMember]: - """Create a FleetMember. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :param resource: Resource create parameters. Is either a FleetMember type or a IO[bytes] type. - Required. - :type resource: ~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.FleetMember or - IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :return: An instance of LROPoller that returns either FleetMember or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.FleetMember] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-06-15-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FleetMember] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - fleet_member_name=fleet_member_name, - resource=resource, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FleetMember", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.FleetMember].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.FleetMember]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_initial( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - properties: Union[_models.FleetMemberUpdate, IO[bytes]], - if_match: Optional[str] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-06-15-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties - else: - _json = self._serialize.body(properties, "FleetMemberUpdate") - - _request = build_update_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - fleet_member_name=fleet_member_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - properties: _models.FleetMemberUpdate, - if_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.FleetMember]: - """Update a FleetMember. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :param properties: The resource properties to be updated. Required. - :type properties: - ~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.FleetMemberUpdate - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either FleetMember or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.FleetMember] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - properties: IO[bytes], - if_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.FleetMember]: - """Update a FleetMember. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :param properties: The resource properties to be updated. Required. - :type properties: IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either FleetMember or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.FleetMember] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - properties: Union[_models.FleetMemberUpdate, IO[bytes]], - if_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[_models.FleetMember]: - """Update a FleetMember. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :param properties: The resource properties to be updated. Is either a FleetMemberUpdate type or - a IO[bytes] type. Required. - :type properties: - ~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.FleetMemberUpdate or IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :return: An instance of LROPoller that returns either FleetMember or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.FleetMember] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-06-15-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FleetMember] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - fleet_member_name=fleet_member_name, - properties=properties, - if_match=if_match, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FleetMember", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.FleetMember].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.FleetMember]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-06-15-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - fleet_member_name=fleet_member_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[None]: - """Delete a FleetMember. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-06-15-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - fleet_member_name=fleet_member_name, - if_match=if_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_06_15_preview/operations/_fleets_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_06_15_preview/operations/_fleets_operations.py deleted file mode 100644 index d2bc65d3036f5..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_06_15_preview/operations/_fleets_operations.py +++ /dev/null @@ -1,1165 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-15-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/fleets") - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-15-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request(resource_group_name: str, fleet_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-15-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - fleet_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-15-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if if_none_match is not None: - _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, fleet_name: str, subscription_id: str, *, if_match: Optional[str] = None, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-15-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, fleet_name: str, subscription_id: str, *, if_match: Optional[str] = None, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-15-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_credentials_request( - resource_group_name: str, fleet_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-15-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/listCredentials", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class FleetsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.containerservicefleet.v2023_06_15_preview.ContainerServiceFleetMgmtClient`'s - :attr:`fleets` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.Fleet"]: - """Lists fleets in the specified subscription. - - :return: An iterator like instance of either Fleet or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-06-15-preview") - ) - cls: ClsType[_models.FleetListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("FleetListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Fleet"]: - """Lists fleets in the specified subscription and resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :return: An iterator like instance of either Fleet or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-06-15-preview") - ) - cls: ClsType[_models.FleetListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("FleetListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get(self, resource_group_name: str, fleet_name: str, **kwargs: Any) -> _models.Fleet: - """Gets a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :return: Fleet or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.Fleet - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-06-15-preview") - ) - cls: ClsType[_models.Fleet] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Fleet", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - fleet_name: str, - resource: Union[_models.Fleet, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-06-15-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "Fleet") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - resource: _models.Fleet, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Fleet]: - """Creates or updates a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param resource: Resource create parameters. Required. - :type resource: ~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.Fleet - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either Fleet or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - resource: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Fleet]: - """Creates or updates a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param resource: Resource create parameters. Required. - :type resource: IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either Fleet or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - resource: Union[_models.Fleet, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[_models.Fleet]: - """Creates or updates a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param resource: Resource create parameters. Is either a Fleet type or a IO[bytes] type. - Required. - :type resource: ~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.Fleet or IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :return: An instance of LROPoller that returns either Fleet or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-06-15-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Fleet] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - resource=resource, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Fleet", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.Fleet].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.Fleet]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_initial( - self, - resource_group_name: str, - fleet_name: str, - properties: Union[_models.FleetPatch, IO[bytes]], - if_match: Optional[str] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-06-15-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties - else: - _json = self._serialize.body(properties, "FleetPatch") - - _request = build_update_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - fleet_name: str, - properties: _models.FleetPatch, - if_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Fleet]: - """Update a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param properties: The resource properties to be updated. Required. - :type properties: ~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.FleetPatch - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either Fleet or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - fleet_name: str, - properties: IO[bytes], - if_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Fleet]: - """Update a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param properties: The resource properties to be updated. Required. - :type properties: IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either Fleet or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - fleet_name: str, - properties: Union[_models.FleetPatch, IO[bytes]], - if_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[_models.Fleet]: - """Update a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param properties: The resource properties to be updated. Is either a FleetPatch type or a - IO[bytes] type. Required. - :type properties: ~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.FleetPatch or - IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :return: An instance of LROPoller that returns either Fleet or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-06-15-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Fleet] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - properties=properties, - if_match=if_match, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Fleet", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.Fleet].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.Fleet]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, fleet_name: str, if_match: Optional[str] = None, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-06-15-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, resource_group_name: str, fleet_name: str, if_match: Optional[str] = None, **kwargs: Any - ) -> LROPoller[None]: - """Delete a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-06-15-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - if_match=if_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list_credentials( - self, resource_group_name: str, fleet_name: str, **kwargs: Any - ) -> _models.FleetCredentialResults: - """Lists the user credentials of a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :return: FleetCredentialResults or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.FleetCredentialResults - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-06-15-preview") - ) - cls: ClsType[_models.FleetCredentialResults] = kwargs.pop("cls", None) - - _request = build_list_credentials_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("FleetCredentialResults", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_06_15_preview/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_06_15_preview/operations/_operations.py deleted file mode 100644 index cfa87ea0320cd..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_06_15_preview/operations/_operations.py +++ /dev/null @@ -1,156 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-15-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.ContainerService/operations") - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class Operations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.containerservicefleet.v2023_06_15_preview.ContainerServiceFleetMgmtClient`'s - :attr:`operations` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: - """List the operations for the provider. - - :return: An iterator like instance of either Operation or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.Operation] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-06-15-preview") - ) - cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - 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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_06_15_preview/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_06_15_preview/operations/_patch.py deleted file mode 100644 index f7dd32510333d..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_06_15_preview/operations/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_06_15_preview/operations/_update_runs_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_06_15_preview/operations/_update_runs_operations.py deleted file mode 100644 index ec685e770287e..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_06_15_preview/operations/_update_runs_operations.py +++ /dev/null @@ -1,1163 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_fleet_request( - resource_group_name: str, fleet_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-15-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, fleet_name: str, update_run_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-15-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - "updateRunName": _SERIALIZER.url( - "update_run_name", - update_run_name, - "str", - max_length=50, - min_length=1, - pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - fleet_name: str, - update_run_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-15-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - "updateRunName": _SERIALIZER.url( - "update_run_name", - update_run_name, - "str", - max_length=50, - min_length=1, - pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if if_none_match is not None: - _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - fleet_name: str, - update_run_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-15-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - "updateRunName": _SERIALIZER.url( - "update_run_name", - update_run_name, - "str", - max_length=50, - min_length=1, - pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_start_request( - resource_group_name: str, - fleet_name: str, - update_run_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-15-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName}/start", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - "updateRunName": _SERIALIZER.url( - "update_run_name", - update_run_name, - "str", - max_length=50, - min_length=1, - pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_stop_request( - resource_group_name: str, - fleet_name: str, - update_run_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-06-15-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName}/stop", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - "updateRunName": _SERIALIZER.url( - "update_run_name", - update_run_name, - "str", - max_length=50, - min_length=1, - pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class UpdateRunsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.containerservicefleet.v2023_06_15_preview.ContainerServiceFleetMgmtClient`'s - :attr:`update_runs` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_by_fleet(self, resource_group_name: str, fleet_name: str, **kwargs: Any) -> Iterable["_models.UpdateRun"]: - """List UpdateRun resources by Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :return: An iterator like instance of either UpdateRun or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.UpdateRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-06-15-preview") - ) - cls: ClsType[_models.UpdateRunListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_fleet_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("UpdateRunListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get(self, resource_group_name: str, fleet_name: str, update_run_name: str, **kwargs: Any) -> _models.UpdateRun: - """Get a UpdateRun. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_run_name: The name of the UpdateRun resource. Required. - :type update_run_name: str - :return: UpdateRun or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.UpdateRun - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-06-15-preview") - ) - cls: ClsType[_models.UpdateRun] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("UpdateRun", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - resource: Union[_models.UpdateRun, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-06-15-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "UpdateRun") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - resource: _models.UpdateRun, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.UpdateRun]: - """Create a UpdateRun. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_run_name: The name of the UpdateRun resource. Required. - :type update_run_name: str - :param resource: Resource create parameters. Required. - :type resource: ~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.UpdateRun - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either UpdateRun or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.UpdateRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - resource: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.UpdateRun]: - """Create a UpdateRun. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_run_name: The name of the UpdateRun resource. Required. - :type update_run_name: str - :param resource: Resource create parameters. Required. - :type resource: IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either UpdateRun or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.UpdateRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - resource: Union[_models.UpdateRun, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[_models.UpdateRun]: - """Create a UpdateRun. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_run_name: The name of the UpdateRun resource. Required. - :type update_run_name: str - :param resource: Resource create parameters. Is either a UpdateRun type or a IO[bytes] type. - Required. - :type resource: ~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.UpdateRun or - IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :return: An instance of LROPoller that returns either UpdateRun or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.UpdateRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-06-15-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.UpdateRun] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - resource=resource, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("UpdateRun", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.UpdateRun].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.UpdateRun]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-06-15-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[None]: - """Delete a UpdateRun. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_run_name: The name of the UpdateRun resource. Required. - :type update_run_name: str - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-06-15-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - if_match=if_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _start_initial( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-06-15-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_start_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_start( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[_models.UpdateRun]: - """Starts an UpdateRun. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_run_name: The name of the UpdateRun resource. Required. - :type update_run_name: str - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :return: An instance of LROPoller that returns either UpdateRun or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.UpdateRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-06-15-preview") - ) - cls: ClsType[_models.UpdateRun] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._start_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - if_match=if_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("UpdateRun", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.UpdateRun].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.UpdateRun]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _stop_initial( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-06-15-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_stop_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_stop( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[_models.UpdateRun]: - """Stops an UpdateRun. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_run_name: The name of the UpdateRun resource. Required. - :type update_run_name: str - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :return: An instance of LROPoller that returns either UpdateRun or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2023_06_15_preview.models.UpdateRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-06-15-preview") - ) - cls: ClsType[_models.UpdateRun] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._stop_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - if_match=if_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("UpdateRun", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.UpdateRun].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.UpdateRun]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_06_15_preview/py.typed b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_06_15_preview/py.typed deleted file mode 100644 index e5aff4f83af86..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_06_15_preview/py.typed +++ /dev/null @@ -1 +0,0 @@ -# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/__init__.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/__init__.py deleted file mode 100644 index 78b8b4b91a49e..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/__init__.py +++ /dev/null @@ -1,26 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._container_service_fleet_mgmt_client import ContainerServiceFleetMgmtClient -from ._version import VERSION - -__version__ = VERSION - -try: - from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ContainerServiceFleetMgmtClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) - -_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/_configuration.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/_configuration.py deleted file mode 100644 index 3bd420f13aa22..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/_configuration.py +++ /dev/null @@ -1,65 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any, TYPE_CHECKING - -from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy - -from ._version import VERSION - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials import TokenCredential - - -class ContainerServiceFleetMgmtClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long - """Configuration for ContainerServiceFleetMgmtClient. - - 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. Required. - :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :keyword api_version: Api Version. Default value is "2023-08-15-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2023-08-15-preview") - - if credential is None: - raise ValueError("Parameter 'credential' must not be None.") - if subscription_id is None: - raise ValueError("Parameter 'subscription_id' must not be None.") - - self.credential = credential - self.subscription_id = subscription_id - self.api_version = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-containerservicefleet/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - 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.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") - if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/_container_service_fleet_mgmt_client.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/_container_service_fleet_mgmt_client.py deleted file mode 100644 index 40148472ecba0..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/_container_service_fleet_mgmt_client.py +++ /dev/null @@ -1,144 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, TYPE_CHECKING -from typing_extensions import Self - -from azure.core.pipeline import policies -from azure.core.rest import HttpRequest, HttpResponse -from azure.mgmt.core import ARMPipelineClient -from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy - -from . import models as _models -from .._serialization import Deserializer, Serializer -from ._configuration import ContainerServiceFleetMgmtClientConfiguration -from .operations import ( - FleetMembersOperations, - FleetUpdateStrategiesOperations, - FleetsOperations, - Operations, - UpdateRunsOperations, -) - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials import TokenCredential - - -class ContainerServiceFleetMgmtClient: # pylint: disable=client-accepts-api-version-keyword - """Azure Kubernetes Fleet Manager api client. - - :ivar operations: Operations operations - :vartype operations: azure.mgmt.containerservicefleet.v2023_08_15_preview.operations.Operations - :ivar fleets: FleetsOperations operations - :vartype fleets: - azure.mgmt.containerservicefleet.v2023_08_15_preview.operations.FleetsOperations - :ivar fleet_members: FleetMembersOperations operations - :vartype fleet_members: - azure.mgmt.containerservicefleet.v2023_08_15_preview.operations.FleetMembersOperations - :ivar update_runs: UpdateRunsOperations operations - :vartype update_runs: - azure.mgmt.containerservicefleet.v2023_08_15_preview.operations.UpdateRunsOperations - :ivar fleet_update_strategies: FleetUpdateStrategiesOperations operations - :vartype fleet_update_strategies: - azure.mgmt.containerservicefleet.v2023_08_15_preview.operations.FleetUpdateStrategiesOperations - :param credential: Credential needed for the client to connect to Azure. Required. - :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". - :type base_url: str - :keyword api_version: Api Version. Default value is "2023-08-15-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - """ - - def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any - ) -> None: - self._config = ContainerServiceFleetMgmtClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs - ) - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - ARMAutoResourceProviderRegistrationPolicy(), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) - - client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer(client_models) - self._deserialize = Deserializer(client_models) - self._serialize.client_side_validation = False - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize, "2023-08-15-preview" - ) - self.fleets = FleetsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-08-15-preview" - ) - self.fleet_members = FleetMembersOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-08-15-preview" - ) - self.update_runs = UpdateRunsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-08-15-preview" - ) - self.fleet_update_strategies = FleetUpdateStrategiesOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-08-15-preview" - ) - - def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.HttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore - - def close(self) -> None: - self._client.close() - - def __enter__(self) -> Self: - self._client.__enter__() - return self - - def __exit__(self, *exc_details: Any) -> None: - self._client.__exit__(*exc_details) diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/_metadata.json b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/_metadata.json deleted file mode 100644 index 5038d04d87c8c..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/_metadata.json +++ /dev/null @@ -1,114 +0,0 @@ -{ - "chosen_version": "2023-08-15-preview", - "total_api_version_list": ["2023-08-15-preview"], - "client": { - "name": "ContainerServiceFleetMgmtClient", - "filename": "_container_service_fleet_mgmt_client", - "description": "Azure Kubernetes Fleet Manager api client.", - "host_value": "\"https://management.azure.com\"", - "parameterized_host_template": null, - "azure_arm": true, - "has_public_lro_operations": true, - "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ContainerServiceFleetMgmtClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ContainerServiceFleetMgmtClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" - }, - "global_parameters": { - "sync": { - "credential": { - "signature": "credential: \"TokenCredential\",", - "description": "Credential needed for the client to connect to Azure. Required.", - "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true, - "method_location": "positional" - }, - "subscription_id": { - "signature": "subscription_id: str,", - "description": "The ID of the target subscription. Required.", - "docstring_type": "str", - "required": true, - "method_location": "positional" - } - }, - "async": { - "credential": { - "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure. Required.", - "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", - "required": true - }, - "subscription_id": { - "signature": "subscription_id: str,", - "description": "The ID of the target subscription. Required.", - "docstring_type": "str", - "required": true - } - }, - "constant": { - }, - "call": "credential, subscription_id", - "service_client_specific": { - "sync": { - "api_version": { - "signature": "api_version: Optional[str]=None,", - "description": "API version to use if no profile is provided, or if missing in profile.", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", - "description": "Service URL", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "profile": { - "signature": "profile: KnownProfiles=KnownProfiles.default,", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false, - "method_location": "positional" - } - }, - "async": { - "api_version": { - "signature": "api_version: Optional[str] = None,", - "description": "API version to use if no profile is provided, or if missing in profile.", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", - "description": "Service URL", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "profile": { - "signature": "profile: KnownProfiles = KnownProfiles.default,", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false, - "method_location": "positional" - } - } - } - }, - "config": { - "credential": true, - "credential_scopes": ["https://management.azure.com/.default"], - "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", - "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", - "sync_imports": "{\"regular\": {\"sdkcore\": {\"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"sdkcore\": {\"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" - }, - "operation_groups": { - "operations": "Operations", - "fleets": "FleetsOperations", - "fleet_members": "FleetMembersOperations", - "update_runs": "UpdateRunsOperations", - "fleet_update_strategies": "FleetUpdateStrategiesOperations" - } -} diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/_patch.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/_patch.py deleted file mode 100644 index f7dd32510333d..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/_version.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/_version.py deleted file mode 100644 index 83f24ab509461..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/_version.py +++ /dev/null @@ -1,9 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -VERSION = "2.1.0" diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/aio/__init__.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/aio/__init__.py deleted file mode 100644 index af1d7b0b47fe9..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/aio/__init__.py +++ /dev/null @@ -1,23 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._container_service_fleet_mgmt_client import ContainerServiceFleetMgmtClient - -try: - from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ContainerServiceFleetMgmtClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) - -_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/aio/_configuration.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/aio/_configuration.py deleted file mode 100644 index 984584bc5b36e..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/aio/_configuration.py +++ /dev/null @@ -1,65 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any, TYPE_CHECKING - -from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy - -from .._version import VERSION - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential - - -class ContainerServiceFleetMgmtClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long - """Configuration for ContainerServiceFleetMgmtClient. - - 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. Required. - :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :keyword api_version: Api Version. Default value is "2023-08-15-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2023-08-15-preview") - - if credential is None: - raise ValueError("Parameter 'credential' must not be None.") - if subscription_id is None: - raise ValueError("Parameter 'subscription_id' must not be None.") - - self.credential = credential - self.subscription_id = subscription_id - self.api_version = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-containerservicefleet/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - 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.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") - if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/aio/_container_service_fleet_mgmt_client.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/aio/_container_service_fleet_mgmt_client.py deleted file mode 100644 index 8d416914cc350..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/aio/_container_service_fleet_mgmt_client.py +++ /dev/null @@ -1,147 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING -from typing_extensions import Self - -from azure.core.pipeline import policies -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.mgmt.core import AsyncARMPipelineClient -from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy - -from .. import models as _models -from ..._serialization import Deserializer, Serializer -from ._configuration import ContainerServiceFleetMgmtClientConfiguration -from .operations import ( - FleetMembersOperations, - FleetUpdateStrategiesOperations, - FleetsOperations, - Operations, - UpdateRunsOperations, -) - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential - - -class ContainerServiceFleetMgmtClient: # pylint: disable=client-accepts-api-version-keyword - """Azure Kubernetes Fleet Manager api client. - - :ivar operations: Operations operations - :vartype operations: - azure.mgmt.containerservicefleet.v2023_08_15_preview.aio.operations.Operations - :ivar fleets: FleetsOperations operations - :vartype fleets: - azure.mgmt.containerservicefleet.v2023_08_15_preview.aio.operations.FleetsOperations - :ivar fleet_members: FleetMembersOperations operations - :vartype fleet_members: - azure.mgmt.containerservicefleet.v2023_08_15_preview.aio.operations.FleetMembersOperations - :ivar update_runs: UpdateRunsOperations operations - :vartype update_runs: - azure.mgmt.containerservicefleet.v2023_08_15_preview.aio.operations.UpdateRunsOperations - :ivar fleet_update_strategies: FleetUpdateStrategiesOperations operations - :vartype fleet_update_strategies: - azure.mgmt.containerservicefleet.v2023_08_15_preview.aio.operations.FleetUpdateStrategiesOperations - :param credential: Credential needed for the client to connect to Azure. Required. - :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". - :type base_url: str - :keyword api_version: Api Version. Default value is "2023-08-15-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - """ - - def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any - ) -> None: - self._config = ContainerServiceFleetMgmtClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs - ) - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - AsyncARMAutoResourceProviderRegistrationPolicy(), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) - - client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer(client_models) - self._deserialize = Deserializer(client_models) - self._serialize.client_side_validation = False - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize, "2023-08-15-preview" - ) - self.fleets = FleetsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-08-15-preview" - ) - self.fleet_members = FleetMembersOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-08-15-preview" - ) - self.update_runs = UpdateRunsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-08-15-preview" - ) - self.fleet_update_strategies = FleetUpdateStrategiesOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-08-15-preview" - ) - - def _send_request( - self, request: HttpRequest, *, stream: bool = False, **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = await client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.AsyncHttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore - - async def close(self) -> None: - await self._client.close() - - async def __aenter__(self) -> Self: - await self._client.__aenter__() - return self - - async def __aexit__(self, *exc_details: Any) -> None: - await self._client.__aexit__(*exc_details) diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/aio/_patch.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/aio/_patch.py deleted file mode 100644 index f7dd32510333d..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/aio/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/aio/operations/_fleet_members_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/aio/operations/_fleet_members_operations.py deleted file mode 100644 index c8f4b52cddcce..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/aio/operations/_fleet_members_operations.py +++ /dev/null @@ -1,842 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._fleet_members_operations import ( - build_create_request, - build_delete_request, - build_get_request, - build_list_by_fleet_request, - build_update_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class FleetMembersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.containerservicefleet.v2023_08_15_preview.aio.ContainerServiceFleetMgmtClient`'s - :attr:`fleet_members` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_by_fleet( - self, resource_group_name: str, fleet_name: str, **kwargs: Any - ) -> AsyncIterable["_models.FleetMember"]: - """List FleetMember resources by Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :return: An iterator like instance of either FleetMember or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.FleetMember] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-08-15-preview") - ) - cls: ClsType[_models.FleetMemberListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_fleet_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("FleetMemberListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get( - self, resource_group_name: str, fleet_name: str, fleet_member_name: str, **kwargs: Any - ) -> _models.FleetMember: - """Get a FleetMember. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :return: FleetMember or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.FleetMember - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-08-15-preview") - ) - cls: ClsType[_models.FleetMember] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - fleet_member_name=fleet_member_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("FleetMember", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_initial( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - resource: Union[_models.FleetMember, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-08-15-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "FleetMember") - - _request = build_create_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - fleet_member_name=fleet_member_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - resource: _models.FleetMember, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.FleetMember]: - """Create a FleetMember. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :param resource: Resource create parameters. Required. - :type resource: ~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.FleetMember - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either FleetMember or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.FleetMember] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - resource: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.FleetMember]: - """Create a FleetMember. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :param resource: Resource create parameters. Required. - :type resource: IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either FleetMember or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.FleetMember] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - resource: Union[_models.FleetMember, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.FleetMember]: - """Create a FleetMember. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :param resource: Resource create parameters. Is either a FleetMember type or a IO[bytes] type. - Required. - :type resource: ~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.FleetMember or - IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :return: An instance of AsyncLROPoller that returns either FleetMember or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.FleetMember] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-08-15-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FleetMember] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - fleet_member_name=fleet_member_name, - resource=resource, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FleetMember", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.FleetMember].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.FleetMember]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_initial( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - properties: Union[_models.FleetMemberUpdate, IO[bytes]], - if_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-08-15-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties - else: - _json = self._serialize.body(properties, "FleetMemberUpdate") - - _request = build_update_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - fleet_member_name=fleet_member_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - properties: _models.FleetMemberUpdate, - if_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.FleetMember]: - """Update a FleetMember. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :param properties: The resource properties to be updated. Required. - :type properties: - ~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.FleetMemberUpdate - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either FleetMember or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.FleetMember] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - properties: IO[bytes], - if_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.FleetMember]: - """Update a FleetMember. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :param properties: The resource properties to be updated. Required. - :type properties: IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either FleetMember or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.FleetMember] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - properties: Union[_models.FleetMemberUpdate, IO[bytes]], - if_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.FleetMember]: - """Update a FleetMember. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :param properties: The resource properties to be updated. Is either a FleetMemberUpdate type or - a IO[bytes] type. Required. - :type properties: - ~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.FleetMemberUpdate or IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :return: An instance of AsyncLROPoller that returns either FleetMember or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.FleetMember] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-08-15-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FleetMember] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - fleet_member_name=fleet_member_name, - properties=properties, - if_match=if_match, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FleetMember", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.FleetMember].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.FleetMember]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-08-15-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - fleet_member_name=fleet_member_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Delete a FleetMember. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-08-15-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - fleet_member_name=fleet_member_name, - if_match=if_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/aio/operations/_fleet_update_strategies_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/aio/operations/_fleet_update_strategies_operations.py deleted file mode 100644 index 586a92f376f3c..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/aio/operations/_fleet_update_strategies_operations.py +++ /dev/null @@ -1,606 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._fleet_update_strategies_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_by_fleet_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class FleetUpdateStrategiesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.containerservicefleet.v2023_08_15_preview.aio.ContainerServiceFleetMgmtClient`'s - :attr:`fleet_update_strategies` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_by_fleet( - self, resource_group_name: str, fleet_name: str, **kwargs: Any - ) -> AsyncIterable["_models.FleetUpdateStrategy"]: - """List FleetUpdateStrategy resources by Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :return: An iterator like instance of either FleetUpdateStrategy or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.FleetUpdateStrategy] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-08-15-preview") - ) - cls: ClsType[_models.FleetUpdateStrategyListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_fleet_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("FleetUpdateStrategyListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get( - self, resource_group_name: str, fleet_name: str, update_strategy_name: str, **kwargs: Any - ) -> _models.FleetUpdateStrategy: - """Get a FleetUpdateStrategy. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_strategy_name: The name of the UpdateStrategy resource. Required. - :type update_strategy_name: str - :return: FleetUpdateStrategy or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.FleetUpdateStrategy - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-08-15-preview") - ) - cls: ClsType[_models.FleetUpdateStrategy] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_strategy_name=update_strategy_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("FleetUpdateStrategy", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - fleet_name: str, - update_strategy_name: str, - resource: Union[_models.FleetUpdateStrategy, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-08-15-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "FleetUpdateStrategy") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_strategy_name=update_strategy_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - update_strategy_name: str, - resource: _models.FleetUpdateStrategy, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.FleetUpdateStrategy]: - """Create a FleetUpdateStrategy. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_strategy_name: The name of the UpdateStrategy resource. Required. - :type update_strategy_name: str - :param resource: Resource create parameters. Required. - :type resource: - ~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.FleetUpdateStrategy - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either FleetUpdateStrategy or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.FleetUpdateStrategy] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - update_strategy_name: str, - resource: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.FleetUpdateStrategy]: - """Create a FleetUpdateStrategy. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_strategy_name: The name of the UpdateStrategy resource. Required. - :type update_strategy_name: str - :param resource: Resource create parameters. Required. - :type resource: IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either FleetUpdateStrategy or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.FleetUpdateStrategy] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - update_strategy_name: str, - resource: Union[_models.FleetUpdateStrategy, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.FleetUpdateStrategy]: - """Create a FleetUpdateStrategy. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_strategy_name: The name of the UpdateStrategy resource. Required. - :type update_strategy_name: str - :param resource: Resource create parameters. Is either a FleetUpdateStrategy type or a - IO[bytes] type. Required. - :type resource: - ~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.FleetUpdateStrategy or IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :return: An instance of AsyncLROPoller that returns either FleetUpdateStrategy or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.FleetUpdateStrategy] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-08-15-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FleetUpdateStrategy] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_strategy_name=update_strategy_name, - resource=resource, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FleetUpdateStrategy", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.FleetUpdateStrategy].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.FleetUpdateStrategy]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, - resource_group_name: str, - fleet_name: str, - update_strategy_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-08-15-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_strategy_name=update_strategy_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, - resource_group_name: str, - fleet_name: str, - update_strategy_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Delete a FleetUpdateStrategy. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_strategy_name: The name of the UpdateStrategy resource. Required. - :type update_strategy_name: str - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-08-15-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_strategy_name=update_strategy_name, - if_match=if_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/aio/operations/_fleets_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/aio/operations/_fleets_operations.py deleted file mode 100644 index c0f680c3cd37a..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/aio/operations/_fleets_operations.py +++ /dev/null @@ -1,926 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._fleets_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_by_resource_group_request, - build_list_by_subscription_request, - build_list_credentials_request, - build_update_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class FleetsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.containerservicefleet.v2023_08_15_preview.aio.ContainerServiceFleetMgmtClient`'s - :attr:`fleets` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.Fleet"]: - """Lists fleets in the specified subscription. - - :return: An iterator like instance of either Fleet or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-08-15-preview") - ) - cls: ClsType[_models.FleetListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("FleetListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace - def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.Fleet"]: - """Lists fleets in the specified subscription and resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :return: An iterator like instance of either Fleet or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-08-15-preview") - ) - cls: ClsType[_models.FleetListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("FleetListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get(self, resource_group_name: str, fleet_name: str, **kwargs: Any) -> _models.Fleet: - """Gets a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :return: Fleet or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.Fleet - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-08-15-preview") - ) - cls: ClsType[_models.Fleet] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Fleet", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - fleet_name: str, - resource: Union[_models.Fleet, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-08-15-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "Fleet") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - resource: _models.Fleet, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.Fleet]: - """Creates or updates a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param resource: Resource create parameters. Required. - :type resource: ~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.Fleet - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either Fleet or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - resource: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.Fleet]: - """Creates or updates a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param resource: Resource create parameters. Required. - :type resource: IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either Fleet or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - resource: Union[_models.Fleet, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.Fleet]: - """Creates or updates a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param resource: Resource create parameters. Is either a Fleet type or a IO[bytes] type. - Required. - :type resource: ~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.Fleet or IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :return: An instance of AsyncLROPoller that returns either Fleet or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-08-15-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Fleet] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - resource=resource, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Fleet", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.Fleet].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.Fleet]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_initial( - self, - resource_group_name: str, - fleet_name: str, - properties: Union[_models.FleetPatch, IO[bytes]], - if_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-08-15-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties - else: - _json = self._serialize.body(properties, "FleetPatch") - - _request = build_update_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - fleet_name: str, - properties: _models.FleetPatch, - if_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.Fleet]: - """Update a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param properties: The resource properties to be updated. Required. - :type properties: ~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.FleetPatch - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either Fleet or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - fleet_name: str, - properties: IO[bytes], - if_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.Fleet]: - """Update a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param properties: The resource properties to be updated. Required. - :type properties: IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either Fleet or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - fleet_name: str, - properties: Union[_models.FleetPatch, IO[bytes]], - if_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.Fleet]: - """Update a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param properties: The resource properties to be updated. Is either a FleetPatch type or a - IO[bytes] type. Required. - :type properties: ~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.FleetPatch or - IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :return: An instance of AsyncLROPoller that returns either Fleet or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-08-15-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Fleet] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - properties=properties, - if_match=if_match, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Fleet", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.Fleet].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.Fleet]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, fleet_name: str, if_match: Optional[str] = None, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-08-15-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, fleet_name: str, if_match: Optional[str] = None, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Delete a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-08-15-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - if_match=if_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace_async - async def list_credentials( - self, resource_group_name: str, fleet_name: str, **kwargs: Any - ) -> _models.FleetCredentialResults: - """Lists the user credentials of a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :return: FleetCredentialResults or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.FleetCredentialResults - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-08-15-preview") - ) - cls: ClsType[_models.FleetCredentialResults] = kwargs.pop("cls", None) - - _request = build_list_credentials_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("FleetCredentialResults", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/aio/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/aio/operations/_operations.py deleted file mode 100644 index 80e214fddbeea..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/aio/operations/_operations.py +++ /dev/null @@ -1,134 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ...operations._operations import build_list_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class Operations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.containerservicefleet.v2023_08_15_preview.aio.ContainerServiceFleetMgmtClient`'s - :attr:`operations` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: - """List the operations for the provider. - - :return: An iterator like instance of either Operation or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.Operation] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-08-15-preview") - ) - cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("OperationListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/aio/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/aio/operations/_patch.py deleted file mode 100644 index f7dd32510333d..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/aio/operations/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/aio/operations/_update_runs_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/aio/operations/_update_runs_operations.py deleted file mode 100644 index 3436f40b50fb9..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/aio/operations/_update_runs_operations.py +++ /dev/null @@ -1,890 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._update_runs_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_by_fleet_request, - build_start_request, - build_stop_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class UpdateRunsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.containerservicefleet.v2023_08_15_preview.aio.ContainerServiceFleetMgmtClient`'s - :attr:`update_runs` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_by_fleet( - self, resource_group_name: str, fleet_name: str, **kwargs: Any - ) -> AsyncIterable["_models.UpdateRun"]: - """List UpdateRun resources by Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :return: An iterator like instance of either UpdateRun or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.UpdateRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-08-15-preview") - ) - cls: ClsType[_models.UpdateRunListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_fleet_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("UpdateRunListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get( - self, resource_group_name: str, fleet_name: str, update_run_name: str, **kwargs: Any - ) -> _models.UpdateRun: - """Get a UpdateRun. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_run_name: The name of the UpdateRun resource. Required. - :type update_run_name: str - :return: UpdateRun or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.UpdateRun - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-08-15-preview") - ) - cls: ClsType[_models.UpdateRun] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("UpdateRun", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - resource: Union[_models.UpdateRun, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-08-15-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "UpdateRun") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - resource: _models.UpdateRun, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.UpdateRun]: - """Create a UpdateRun. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_run_name: The name of the UpdateRun resource. Required. - :type update_run_name: str - :param resource: Resource create parameters. Required. - :type resource: ~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.UpdateRun - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either UpdateRun or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.UpdateRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - resource: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.UpdateRun]: - """Create a UpdateRun. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_run_name: The name of the UpdateRun resource. Required. - :type update_run_name: str - :param resource: Resource create parameters. Required. - :type resource: IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either UpdateRun or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.UpdateRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - resource: Union[_models.UpdateRun, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.UpdateRun]: - """Create a UpdateRun. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_run_name: The name of the UpdateRun resource. Required. - :type update_run_name: str - :param resource: Resource create parameters. Is either a UpdateRun type or a IO[bytes] type. - Required. - :type resource: ~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.UpdateRun or - IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :return: An instance of AsyncLROPoller that returns either UpdateRun or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.UpdateRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-08-15-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.UpdateRun] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - resource=resource, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("UpdateRun", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.UpdateRun].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.UpdateRun]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-08-15-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Delete a UpdateRun. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_run_name: The name of the UpdateRun resource. Required. - :type update_run_name: str - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-08-15-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - if_match=if_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _start_initial( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-08-15-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_start_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_start( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.UpdateRun]: - """Starts an UpdateRun. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_run_name: The name of the UpdateRun resource. Required. - :type update_run_name: str - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :return: An instance of AsyncLROPoller that returns either UpdateRun or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.UpdateRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-08-15-preview") - ) - cls: ClsType[_models.UpdateRun] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._start_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - if_match=if_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("UpdateRun", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.UpdateRun].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.UpdateRun]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _stop_initial( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-08-15-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_stop_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_stop( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.UpdateRun]: - """Stops an UpdateRun. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_run_name: The name of the UpdateRun resource. Required. - :type update_run_name: str - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :return: An instance of AsyncLROPoller that returns either UpdateRun or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.UpdateRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-08-15-preview") - ) - cls: ClsType[_models.UpdateRun] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._stop_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - if_match=if_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("UpdateRun", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.UpdateRun].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.UpdateRun]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/models/__init__.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/models/__init__.py deleted file mode 100644 index 5efca9c4b5581..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/models/__init__.py +++ /dev/null @@ -1,121 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._models_py3 import APIServerAccessProfile -from ._models_py3 import AgentProfile -from ._models_py3 import ErrorAdditionalInfo -from ._models_py3 import ErrorDetail -from ._models_py3 import ErrorResponse -from ._models_py3 import Fleet -from ._models_py3 import FleetCredentialResult -from ._models_py3 import FleetCredentialResults -from ._models_py3 import FleetHubProfile -from ._models_py3 import FleetListResult -from ._models_py3 import FleetMember -from ._models_py3 import FleetMemberListResult -from ._models_py3 import FleetMemberUpdate -from ._models_py3 import FleetPatch -from ._models_py3 import FleetUpdateStrategy -from ._models_py3 import FleetUpdateStrategyListResult -from ._models_py3 import ManagedClusterUpdate -from ._models_py3 import ManagedClusterUpgradeSpec -from ._models_py3 import ManagedServiceIdentity -from ._models_py3 import MemberUpdateStatus -from ._models_py3 import NodeImageSelection -from ._models_py3 import NodeImageSelectionStatus -from ._models_py3 import NodeImageVersion -from ._models_py3 import Operation -from ._models_py3 import OperationDisplay -from ._models_py3 import OperationListResult -from ._models_py3 import ProxyResource -from ._models_py3 import Resource -from ._models_py3 import SystemData -from ._models_py3 import TrackedResource -from ._models_py3 import UpdateGroup -from ._models_py3 import UpdateGroupStatus -from ._models_py3 import UpdateRun -from ._models_py3 import UpdateRunListResult -from ._models_py3 import UpdateRunStatus -from ._models_py3 import UpdateRunStrategy -from ._models_py3 import UpdateStage -from ._models_py3 import UpdateStageStatus -from ._models_py3 import UpdateStatus -from ._models_py3 import UserAssignedIdentity -from ._models_py3 import WaitStatus - -from ._container_service_fleet_mgmt_client_enums import ActionType -from ._container_service_fleet_mgmt_client_enums import CreatedByType -from ._container_service_fleet_mgmt_client_enums import FleetMemberProvisioningState -from ._container_service_fleet_mgmt_client_enums import FleetProvisioningState -from ._container_service_fleet_mgmt_client_enums import FleetUpdateStrategyProvisioningState -from ._container_service_fleet_mgmt_client_enums import ManagedClusterUpgradeType -from ._container_service_fleet_mgmt_client_enums import ManagedServiceIdentityType -from ._container_service_fleet_mgmt_client_enums import NodeImageSelectionType -from ._container_service_fleet_mgmt_client_enums import Origin -from ._container_service_fleet_mgmt_client_enums import UpdateRunProvisioningState -from ._container_service_fleet_mgmt_client_enums import UpdateState -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "APIServerAccessProfile", - "AgentProfile", - "ErrorAdditionalInfo", - "ErrorDetail", - "ErrorResponse", - "Fleet", - "FleetCredentialResult", - "FleetCredentialResults", - "FleetHubProfile", - "FleetListResult", - "FleetMember", - "FleetMemberListResult", - "FleetMemberUpdate", - "FleetPatch", - "FleetUpdateStrategy", - "FleetUpdateStrategyListResult", - "ManagedClusterUpdate", - "ManagedClusterUpgradeSpec", - "ManagedServiceIdentity", - "MemberUpdateStatus", - "NodeImageSelection", - "NodeImageSelectionStatus", - "NodeImageVersion", - "Operation", - "OperationDisplay", - "OperationListResult", - "ProxyResource", - "Resource", - "SystemData", - "TrackedResource", - "UpdateGroup", - "UpdateGroupStatus", - "UpdateRun", - "UpdateRunListResult", - "UpdateRunStatus", - "UpdateRunStrategy", - "UpdateStage", - "UpdateStageStatus", - "UpdateStatus", - "UserAssignedIdentity", - "WaitStatus", - "ActionType", - "CreatedByType", - "FleetMemberProvisioningState", - "FleetProvisioningState", - "FleetUpdateStrategyProvisioningState", - "ManagedClusterUpgradeType", - "ManagedServiceIdentityType", - "NodeImageSelectionType", - "Origin", - "UpdateRunProvisioningState", - "UpdateState", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/models/_container_service_fleet_mgmt_client_enums.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/models/_container_service_fleet_mgmt_client_enums.py deleted file mode 100644 index d8b75c1580d44..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/models/_container_service_fleet_mgmt_client_enums.py +++ /dev/null @@ -1,150 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from enum import Enum -from azure.core import CaseInsensitiveEnumMeta - - -class ActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs.""" - - INTERNAL = "Internal" - - -class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of identity that created the resource.""" - - USER = "User" - APPLICATION = "Application" - MANAGED_IDENTITY = "ManagedIdentity" - KEY = "Key" - - -class FleetMemberProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The provisioning state of the last accepted operation.""" - - SUCCEEDED = "Succeeded" - """Resource has been created.""" - FAILED = "Failed" - """Resource creation failed.""" - CANCELED = "Canceled" - """Resource creation was canceled.""" - JOINING = "Joining" - """The provisioning state of a member joining a fleet.""" - LEAVING = "Leaving" - """The provisioning state of a member leaving a fleet.""" - UPDATING = "Updating" - """The provisioning state of a member being updated.""" - - -class FleetProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The provisioning state of the last accepted operation.""" - - SUCCEEDED = "Succeeded" - """Resource has been created.""" - FAILED = "Failed" - """Resource creation failed.""" - CANCELED = "Canceled" - """Resource creation was canceled.""" - CREATING = "Creating" - """The provisioning state of a fleet being created.""" - UPDATING = "Updating" - """The provisioning state of a fleet being updated.""" - DELETING = "Deleting" - """The provisioning state of a fleet being deleted.""" - - -class FleetUpdateStrategyProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The provisioning state of the UpdateStrategy resource.""" - - SUCCEEDED = "Succeeded" - """Resource has been created.""" - FAILED = "Failed" - """Resource creation failed.""" - CANCELED = "Canceled" - """Resource creation was canceled.""" - - -class ManagedClusterUpgradeType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of upgrade to perform when targeting ManagedClusters.""" - - FULL = "Full" - """Full upgrades the control plane and all agent pools of the target ManagedClusters. Requires the - ManagedClusterUpgradeSpec.KubernetesVersion property to be set.""" - NODE_IMAGE_ONLY = "NodeImageOnly" - """NodeImageOnly upgrades only the node images of the target ManagedClusters. Requires the - ManagedClusterUpgradeSpec.KubernetesVersion property to NOT be set.""" - - -class ManagedServiceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of managed service identity (where both SystemAssigned and UserAssigned types are - allowed). - """ - - NONE = "None" - SYSTEM_ASSIGNED = "SystemAssigned" - USER_ASSIGNED = "UserAssigned" - SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned, UserAssigned" - - -class NodeImageSelectionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The node image upgrade type.""" - - LATEST = "Latest" - """Use the latest image version when upgrading nodes. Clusters may use different image versions - (e.g., 'AKSUbuntu-1804gen2containerd-2021.10.12' and 'AKSUbuntu-1804gen2containerd-2021.10.19') - because, for example, the latest available version is different in different regions.""" - CONSISTENT = "Consistent" - """The image versions to upgrade nodes to are selected as described below: for each node pool in - managed clusters affected by the update run, the system selects the latest image version such - that it is available across all other node pools (in all other clusters) of the same image - type. As a result, all node pools of the same image type will be upgraded to the same image - version. For example, if the latest image version for image type 'AKSUbuntu-1804gen2containerd' - is 'AKSUbuntu-1804gen2containerd-2021.10.12' for a node pool in cluster A in region X, and is - 'AKSUbuntu-1804gen2containerd-2021.10.17' for a node pool in cluster B in region Y, the system - will upgrade both node pools to image version 'AKSUbuntu-1804gen2containerd-2021.10.12'.""" - - -class Origin(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit - logs UX. Default value is "user,system". - """ - - USER = "user" - SYSTEM = "system" - USER_SYSTEM = "user,system" - - -class UpdateRunProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The provisioning state of the UpdateRun resource.""" - - SUCCEEDED = "Succeeded" - """Resource has been created.""" - FAILED = "Failed" - """Resource creation failed.""" - CANCELED = "Canceled" - """Resource creation was canceled.""" - - -class UpdateState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The state of the UpdateRun, UpdateStage, UpdateGroup, or MemberUpdate.""" - - NOT_STARTED = "NotStarted" - """The state of an UpdateRun/UpdateStage/UpdateGroup/MemberUpdate that has not been started.""" - RUNNING = "Running" - """The state of an UpdateRun/UpdateStage/UpdateGroup/MemberUpdate that is running.""" - STOPPING = "Stopping" - """The state of an UpdateRun/UpdateStage/UpdateGroup/MemberUpdate that is being stopped.""" - STOPPED = "Stopped" - """The state of an UpdateRun/UpdateStage/UpdateGroup/MemberUpdate that has stopped.""" - SKIPPED = "Skipped" - """The state of an UpdateRun/UpdateStage/UpdateGroup/MemberUpdate that has been skipped.""" - FAILED = "Failed" - """The state of an UpdateRun/UpdateStage/UpdateGroup/MemberUpdate that has failed.""" - COMPLETED = "Completed" - """The state of an UpdateRun/UpdateStage/UpdateGroup/MemberUpdate that has completed.""" diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/models/_models_py3.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/models/_models_py3.py deleted file mode 100644 index fbe74179dad30..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/models/_models_py3.py +++ /dev/null @@ -1,1739 +0,0 @@ -# coding=utf-8 -# pylint: disable=too-many-lines -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights 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 Any, Dict, List, Optional, TYPE_CHECKING, Union - -from ... import _serialization - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from .. import models as _models - - -class AgentProfile(_serialization.Model): - """Agent profile for the Fleet hub. - - :ivar subnet_id: The ID of the subnet which the Fleet hub node will join on startup. If this is - not specified, a vnet and subnet will be generated and used. - :vartype subnet_id: str - :ivar vm_size: The virtual machine size of the Fleet hub. - :vartype vm_size: str - """ - - _attribute_map = { - "subnet_id": {"key": "subnetId", "type": "str"}, - "vm_size": {"key": "vmSize", "type": "str"}, - } - - def __init__(self, *, subnet_id: Optional[str] = None, vm_size: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword subnet_id: The ID of the subnet which the Fleet hub node will join on startup. If this - is not specified, a vnet and subnet will be generated and used. - :paramtype subnet_id: str - :keyword vm_size: The virtual machine size of the Fleet hub. - :paramtype vm_size: str - """ - super().__init__(**kwargs) - self.subnet_id = subnet_id - self.vm_size = vm_size - - -class APIServerAccessProfile(_serialization.Model): - """Access profile for the Fleet hub API server. - - :ivar enable_private_cluster: Whether to create the Fleet hub as a private cluster or not. - :vartype enable_private_cluster: bool - :ivar enable_vnet_integration: Whether to enable apiserver vnet integration for the Fleet hub - or not. - :vartype enable_vnet_integration: bool - :ivar subnet_id: The subnet to be used when apiserver vnet integration is enabled. It is - required when creating a new Fleet with BYO vnet. - :vartype subnet_id: str - """ - - _attribute_map = { - "enable_private_cluster": {"key": "enablePrivateCluster", "type": "bool"}, - "enable_vnet_integration": {"key": "enableVnetIntegration", "type": "bool"}, - "subnet_id": {"key": "subnetId", "type": "str"}, - } - - def __init__( - self, - *, - enable_private_cluster: Optional[bool] = None, - enable_vnet_integration: Optional[bool] = None, - subnet_id: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword enable_private_cluster: Whether to create the Fleet hub as a private cluster or not. - :paramtype enable_private_cluster: bool - :keyword enable_vnet_integration: Whether to enable apiserver vnet integration for the Fleet - hub or not. - :paramtype enable_vnet_integration: bool - :keyword subnet_id: The subnet to be used when apiserver vnet integration is enabled. It is - required when creating a new Fleet with BYO vnet. - :paramtype subnet_id: str - """ - super().__init__(**kwargs) - self.enable_private_cluster = enable_private_cluster - self.enable_vnet_integration = enable_vnet_integration - self.subnet_id = subnet_id - - -class ErrorAdditionalInfo(_serialization.Model): - """The resource management error additional info. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar type: The additional info type. - :vartype type: str - :ivar info: The additional info. - :vartype info: JSON - """ - - _validation = { - "type": {"readonly": True}, - "info": {"readonly": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "info": {"key": "info", "type": "object"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.type = None - self.info = None - - -class ErrorDetail(_serialization.Model): - """The error detail. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar code: The error code. - :vartype code: str - :ivar message: The error message. - :vartype message: str - :ivar target: The error target. - :vartype target: str - :ivar details: The error details. - :vartype details: - list[~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.ErrorDetail] - :ivar additional_info: The error additional info. - :vartype additional_info: - list[~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.ErrorAdditionalInfo] - """ - - _validation = { - "code": {"readonly": True}, - "message": {"readonly": True}, - "target": {"readonly": True}, - "details": {"readonly": True}, - "additional_info": {"readonly": True}, - } - - _attribute_map = { - "code": {"key": "code", "type": "str"}, - "message": {"key": "message", "type": "str"}, - "target": {"key": "target", "type": "str"}, - "details": {"key": "details", "type": "[ErrorDetail]"}, - "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.code = None - self.message = None - self.target = None - self.details = None - self.additional_info = None - - -class ErrorResponse(_serialization.Model): - """Common error response for all Azure Resource Manager APIs to return error details for failed - operations. (This also follows the OData error response format.). - - :ivar error: The error object. - :vartype error: ~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.ErrorDetail - """ - - _attribute_map = { - "error": {"key": "error", "type": "ErrorDetail"}, - } - - def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: Any) -> None: - """ - :keyword error: The error object. - :paramtype error: ~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.ErrorDetail - """ - super().__init__(**kwargs) - self.error = error - - -class Resource(_serialization.Model): - """Common fields that are returned in the response for all Azure Resource Manager resources. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.SystemData - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.system_data = None - - -class TrackedResource(Resource): - """The resource model definition for an Azure Resource Manager tracked top level resource which - has 'tags' and a 'location'. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.SystemData - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "location": {"required": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - } - - def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - """ - super().__init__(**kwargs) - self.tags = tags - self.location = location - - -class Fleet(TrackedResource): - """The Fleet 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 server. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.SystemData - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - :ivar e_tag: If eTag is provided in the response body, it may also be provided as a header per - the normal etag convention. Entity tags are used for comparing two or more entities from the - same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match - (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. - :vartype e_tag: str - :ivar identity: Managed identity. - :vartype identity: - ~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.ManagedServiceIdentity - :ivar provisioning_state: The status of the last operation. Known values are: "Succeeded", - "Failed", "Canceled", "Creating", "Updating", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.FleetProvisioningState - :ivar hub_profile: The FleetHubProfile configures the Fleet's hub. - :vartype hub_profile: - ~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.FleetHubProfile - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "location": {"required": True}, - "e_tag": {"readonly": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - "e_tag": {"key": "eTag", "type": "str"}, - "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "hub_profile": {"key": "properties.hubProfile", "type": "FleetHubProfile"}, - } - - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - identity: Optional["_models.ManagedServiceIdentity"] = None, - hub_profile: Optional["_models.FleetHubProfile"] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - :keyword identity: Managed identity. - :paramtype identity: - ~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.ManagedServiceIdentity - :keyword hub_profile: The FleetHubProfile configures the Fleet's hub. - :paramtype hub_profile: - ~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.FleetHubProfile - """ - super().__init__(tags=tags, location=location, **kwargs) - self.e_tag = None - self.identity = identity - self.provisioning_state = None - self.hub_profile = hub_profile - - -class FleetCredentialResult(_serialization.Model): - """One credential result item. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: The name of the credential. - :vartype name: str - :ivar value: Base64-encoded Kubernetes configuration file. - :vartype value: bytes - """ - - _validation = { - "name": {"readonly": True}, - "value": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "value": {"key": "value", "type": "bytearray"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.value = None - - -class FleetCredentialResults(_serialization.Model): - """The Credential results response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar kubeconfigs: Array of base64-encoded Kubernetes configuration files. - :vartype kubeconfigs: - list[~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.FleetCredentialResult] - """ - - _validation = { - "kubeconfigs": {"readonly": True}, - } - - _attribute_map = { - "kubeconfigs": {"key": "kubeconfigs", "type": "[FleetCredentialResult]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.kubeconfigs = None - - -class FleetHubProfile(_serialization.Model): - """The FleetHubProfile configures the fleet hub. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar dns_prefix: DNS prefix used to create the FQDN for the Fleet hub. - :vartype dns_prefix: str - :ivar api_server_access_profile: The access profile for the Fleet hub API server. - :vartype api_server_access_profile: - ~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.APIServerAccessProfile - :ivar agent_profile: The agent profile for the Fleet hub. - :vartype agent_profile: - ~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.AgentProfile - :ivar fqdn: The FQDN of the Fleet hub. - :vartype fqdn: str - :ivar kubernetes_version: The Kubernetes version of the Fleet hub. - :vartype kubernetes_version: str - :ivar portal_fqdn: The Azure Portal FQDN of the Fleet hub. - :vartype portal_fqdn: str - """ - - _validation = { - "dns_prefix": { - "max_length": 54, - "min_length": 1, - "pattern": r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][a-zA-Z0-9-]{0,52}[a-zA-Z0-9]$", - }, - "fqdn": {"readonly": True}, - "kubernetes_version": {"readonly": True}, - "portal_fqdn": {"readonly": True}, - } - - _attribute_map = { - "dns_prefix": {"key": "dnsPrefix", "type": "str"}, - "api_server_access_profile": {"key": "apiServerAccessProfile", "type": "APIServerAccessProfile"}, - "agent_profile": {"key": "agentProfile", "type": "AgentProfile"}, - "fqdn": {"key": "fqdn", "type": "str"}, - "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, - "portal_fqdn": {"key": "portalFqdn", "type": "str"}, - } - - def __init__( - self, - *, - dns_prefix: Optional[str] = None, - api_server_access_profile: Optional["_models.APIServerAccessProfile"] = None, - agent_profile: Optional["_models.AgentProfile"] = None, - **kwargs: Any - ) -> None: - """ - :keyword dns_prefix: DNS prefix used to create the FQDN for the Fleet hub. - :paramtype dns_prefix: str - :keyword api_server_access_profile: The access profile for the Fleet hub API server. - :paramtype api_server_access_profile: - ~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.APIServerAccessProfile - :keyword agent_profile: The agent profile for the Fleet hub. - :paramtype agent_profile: - ~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.AgentProfile - """ - super().__init__(**kwargs) - self.dns_prefix = dns_prefix - self.api_server_access_profile = api_server_access_profile - self.agent_profile = agent_profile - self.fqdn = None - self.kubernetes_version = None - self.portal_fqdn = None - - -class FleetListResult(_serialization.Model): - """The response of a Fleet list operation. - - All required parameters must be populated in order to send to server. - - :ivar value: The Fleet items on this page. Required. - :vartype value: list[~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.Fleet] - :ivar next_link: The link to the next page of items. - :vartype next_link: str - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[Fleet]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, *, value: List["_models.Fleet"], next_link: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword value: The Fleet items on this page. Required. - :paramtype value: list[~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.Fleet] - :keyword next_link: The link to the next page of items. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ProxyResource(Resource): - """The resource model definition for a Azure Resource Manager proxy resource. It will not have - tags and a location. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.SystemData - """ - - -class FleetMember(ProxyResource): - """A member of the Fleet. It contains a reference to an existing Kubernetes cluster on Azure. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.SystemData - :ivar e_tag: If eTag is provided in the response body, it may also be provided as a header per - the normal etag convention. Entity tags are used for comparing two or more entities from the - same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match - (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. - :vartype e_tag: str - :ivar cluster_resource_id: The ARM resource id of the cluster that joins the Fleet. Must be a - valid Azure resource id. e.g.: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{clusterName}'. # pylint: disable=line-too-long - :vartype cluster_resource_id: str - :ivar group: The group this member belongs to for multi-cluster update management. - :vartype group: str - :ivar provisioning_state: The status of the last operation. Known values are: "Succeeded", - "Failed", "Canceled", "Joining", "Leaving", and "Updating". - :vartype provisioning_state: str or - ~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.FleetMemberProvisioningState - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "e_tag": {"readonly": True}, - "group": {"max_length": 50, "min_length": 1, "pattern": r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$"}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "e_tag": {"key": "eTag", "type": "str"}, - "cluster_resource_id": {"key": "properties.clusterResourceId", "type": "str"}, - "group": {"key": "properties.group", "type": "str"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - } - - def __init__( - self, *, cluster_resource_id: Optional[str] = None, group: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword cluster_resource_id: The ARM resource id of the cluster that joins the Fleet. Must be - a valid Azure resource id. e.g.: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{clusterName}'. # pylint: disable=line-too-long - :paramtype cluster_resource_id: str - :keyword group: The group this member belongs to for multi-cluster update management. - :paramtype group: str - """ - super().__init__(**kwargs) - self.e_tag = None - self.cluster_resource_id = cluster_resource_id - self.group = group - self.provisioning_state = None - - -class FleetMemberListResult(_serialization.Model): - """The response of a FleetMember list operation. - - All required parameters must be populated in order to send to server. - - :ivar value: The FleetMember items on this page. Required. - :vartype value: list[~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.FleetMember] - :ivar next_link: The link to the next page of items. - :vartype next_link: str - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[FleetMember]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, *, value: List["_models.FleetMember"], next_link: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword value: The FleetMember items on this page. Required. - :paramtype value: - list[~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.FleetMember] - :keyword next_link: The link to the next page of items. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class FleetMemberUpdate(_serialization.Model): - """The type used for update operations of the FleetMember. - - :ivar group: The group this member belongs to for multi-cluster update management. - :vartype group: str - """ - - _validation = { - "group": {"max_length": 50, "min_length": 1, "pattern": r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$"}, - } - - _attribute_map = { - "group": {"key": "properties.group", "type": "str"}, - } - - def __init__(self, *, group: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword group: The group this member belongs to for multi-cluster update management. - :paramtype group: str - """ - super().__init__(**kwargs) - self.group = group - - -class FleetPatch(_serialization.Model): - """Properties of a Fleet that can be patched. - - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar identity: Managed identity. - :vartype identity: - ~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.ManagedServiceIdentity - """ - - _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, - } - - def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - identity: Optional["_models.ManagedServiceIdentity"] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword identity: Managed identity. - :paramtype identity: - ~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.ManagedServiceIdentity - """ - super().__init__(**kwargs) - self.tags = tags - self.identity = identity - - -class FleetUpdateStrategy(ProxyResource): - """Defines a multi-stage process to perform update operations across members of a Fleet. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.SystemData - :ivar e_tag: If eTag is provided in the response body, it may also be provided as a header per - the normal etag convention. Entity tags are used for comparing two or more entities from the - same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match - (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. - :vartype e_tag: str - :ivar provisioning_state: The provisioning state of the UpdateStrategy resource. Known values - are: "Succeeded", "Failed", and "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.FleetUpdateStrategyProvisioningState - :ivar strategy: Defines the update sequence of the clusters. - :vartype strategy: - ~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.UpdateRunStrategy - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "e_tag": {"readonly": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "e_tag": {"key": "eTag", "type": "str"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "strategy": {"key": "properties.strategy", "type": "UpdateRunStrategy"}, - } - - def __init__(self, *, strategy: Optional["_models.UpdateRunStrategy"] = None, **kwargs: Any) -> None: - """ - :keyword strategy: Defines the update sequence of the clusters. - :paramtype strategy: - ~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.UpdateRunStrategy - """ - super().__init__(**kwargs) - self.e_tag = None - self.provisioning_state = None - self.strategy = strategy - - -class FleetUpdateStrategyListResult(_serialization.Model): - """The response of a FleetUpdateStrategy list operation. - - All required parameters must be populated in order to send to server. - - :ivar value: The FleetUpdateStrategy items on this page. Required. - :vartype value: - list[~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.FleetUpdateStrategy] - :ivar next_link: The link to the next page of items. - :vartype next_link: str - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[FleetUpdateStrategy]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: List["_models.FleetUpdateStrategy"], next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: The FleetUpdateStrategy items on this page. Required. - :paramtype value: - list[~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.FleetUpdateStrategy] - :keyword next_link: The link to the next page of items. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ManagedClusterUpdate(_serialization.Model): - """The update to be applied to the ManagedClusters. - - All required parameters must be populated in order to send to server. - - :ivar upgrade: The upgrade to apply to the ManagedClusters. Required. - :vartype upgrade: - ~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.ManagedClusterUpgradeSpec - :ivar node_image_selection: The node image upgrade to be applied to the target nodes in update - run. - :vartype node_image_selection: - ~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.NodeImageSelection - """ - - _validation = { - "upgrade": {"required": True}, - } - - _attribute_map = { - "upgrade": {"key": "upgrade", "type": "ManagedClusterUpgradeSpec"}, - "node_image_selection": {"key": "nodeImageSelection", "type": "NodeImageSelection"}, - } - - def __init__( - self, - *, - upgrade: "_models.ManagedClusterUpgradeSpec", - node_image_selection: Optional["_models.NodeImageSelection"] = None, - **kwargs: Any - ) -> None: - """ - :keyword upgrade: The upgrade to apply to the ManagedClusters. Required. - :paramtype upgrade: - ~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.ManagedClusterUpgradeSpec - :keyword node_image_selection: The node image upgrade to be applied to the target nodes in - update run. - :paramtype node_image_selection: - ~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.NodeImageSelection - """ - super().__init__(**kwargs) - self.upgrade = upgrade - self.node_image_selection = node_image_selection - - -class ManagedClusterUpgradeSpec(_serialization.Model): - """The upgrade to apply to a ManagedCluster. - - All required parameters must be populated in order to send to server. - - :ivar type: ManagedClusterUpgradeType is the type of upgrade to be applied. Required. Known - values are: "Full" and "NodeImageOnly". - :vartype type: str or - ~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.ManagedClusterUpgradeType - :ivar kubernetes_version: The Kubernetes version to upgrade the member clusters to. - :vartype kubernetes_version: str - """ - - _validation = { - "type": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, - } - - def __init__( - self, - *, - type: Union[str, "_models.ManagedClusterUpgradeType"], - kubernetes_version: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword type: ManagedClusterUpgradeType is the type of upgrade to be applied. Required. Known - values are: "Full" and "NodeImageOnly". - :paramtype type: str or - ~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.ManagedClusterUpgradeType - :keyword kubernetes_version: The Kubernetes version to upgrade the member clusters to. - :paramtype kubernetes_version: str - """ - super().__init__(**kwargs) - self.type = type - self.kubernetes_version = kubernetes_version - - -class ManagedServiceIdentity(_serialization.Model): - """Managed service identity (system assigned and/or user assigned identities). - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar principal_id: The service principal ID of the system assigned identity. This property - will only be provided for a system assigned identity. - :vartype principal_id: str - :ivar tenant_id: The tenant ID of the system assigned identity. This property will only be - provided for a system assigned identity. - :vartype tenant_id: str - :ivar type: Type of managed service identity (where both SystemAssigned and UserAssigned types - are allowed). Required. Known values are: "None", "SystemAssigned", "UserAssigned", and - "SystemAssigned, UserAssigned". - :vartype type: str or - ~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.ManagedServiceIdentityType - :ivar user_assigned_identities: The set of user assigned identities associated with the - resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. # pylint: disable=line-too-long - The dictionary values can be empty objects ({}) in requests. - :vartype user_assigned_identities: dict[str, - ~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.UserAssignedIdentity] - """ - - _validation = { - "principal_id": {"readonly": True}, - "tenant_id": {"readonly": True}, - "type": {"required": True}, - } - - _attribute_map = { - "principal_id": {"key": "principalId", "type": "str"}, - "tenant_id": {"key": "tenantId", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "user_assigned_identities": {"key": "userAssignedIdentities", "type": "{UserAssignedIdentity}"}, - } - - def __init__( - self, - *, - type: Union[str, "_models.ManagedServiceIdentityType"], - user_assigned_identities: Optional[Dict[str, "_models.UserAssignedIdentity"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword type: Type of managed service identity (where both SystemAssigned and UserAssigned - types are allowed). Required. Known values are: "None", "SystemAssigned", "UserAssigned", and - "SystemAssigned, UserAssigned". - :paramtype type: str or - ~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.ManagedServiceIdentityType - :keyword user_assigned_identities: The set of user assigned identities associated with the - resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. # pylint: disable=line-too-long - The dictionary values can be empty objects ({}) in requests. - :paramtype user_assigned_identities: dict[str, - ~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.UserAssignedIdentity] - """ - super().__init__(**kwargs) - self.principal_id = None - self.tenant_id = None - self.type = type - self.user_assigned_identities = user_assigned_identities - - -class MemberUpdateStatus(_serialization.Model): - """The status of a member update operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar status: The status of the MemberUpdate operation. - :vartype status: ~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.UpdateStatus - :ivar name: The name of the FleetMember. - :vartype name: str - :ivar cluster_resource_id: The Azure resource id of the target Kubernetes cluster. - :vartype cluster_resource_id: str - :ivar operation_id: The operation resource id of the latest attempt to perform the operation. - :vartype operation_id: str - :ivar message: The status message after processing the member update operation. - :vartype message: str - """ - - _validation = { - "status": {"readonly": True}, - "name": {"readonly": True}, - "cluster_resource_id": {"readonly": True}, - "operation_id": {"readonly": True}, - "message": {"readonly": True}, - } - - _attribute_map = { - "status": {"key": "status", "type": "UpdateStatus"}, - "name": {"key": "name", "type": "str"}, - "cluster_resource_id": {"key": "clusterResourceId", "type": "str"}, - "operation_id": {"key": "operationId", "type": "str"}, - "message": {"key": "message", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.status = None - self.name = None - self.cluster_resource_id = None - self.operation_id = None - self.message = None - - -class NodeImageSelection(_serialization.Model): - """The node image upgrade to be applied to the target nodes in update run. - - All required parameters must be populated in order to send to server. - - :ivar type: The node image upgrade type. Required. Known values are: "Latest" and "Consistent". - :vartype type: str or - ~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.NodeImageSelectionType - """ - - _validation = { - "type": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - } - - def __init__(self, *, type: Union[str, "_models.NodeImageSelectionType"], **kwargs: Any) -> None: - """ - :keyword type: The node image upgrade type. Required. Known values are: "Latest" and - "Consistent". - :paramtype type: str or - ~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.NodeImageSelectionType - """ - super().__init__(**kwargs) - self.type = type - - -class NodeImageSelectionStatus(_serialization.Model): - """The node image upgrade specs for the update run. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar selected_node_image_versions: The image versions to upgrade the nodes to. - :vartype selected_node_image_versions: - list[~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.NodeImageVersion] - """ - - _validation = { - "selected_node_image_versions": {"readonly": True}, - } - - _attribute_map = { - "selected_node_image_versions": {"key": "selectedNodeImageVersions", "type": "[NodeImageVersion]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.selected_node_image_versions = None - - -class NodeImageVersion(_serialization.Model): - """The node upgrade image version. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar version: The image version to upgrade the nodes to (e.g., - 'AKSUbuntu-1804gen2containerd-2022.12.13'). - :vartype version: str - """ - - _validation = { - "version": {"readonly": True}, - } - - _attribute_map = { - "version": {"key": "version", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.version = None - - -class Operation(_serialization.Model): - """Details of a REST API operation, returned from the Resource Provider Operations API. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: - "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". - :vartype name: str - :ivar is_data_action: Whether the operation applies to data-plane. This is "true" for - data-plane operations and "false" for ARM/control-plane operations. - :vartype is_data_action: bool - :ivar display: Localized display information for this particular operation. - :vartype display: ~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.OperationDisplay - :ivar origin: The intended executor of the operation; as in Resource Based Access Control - (RBAC) and audit logs UX. Default value is "user,system". Known values are: "user", "system", - and "user,system". - :vartype origin: str or ~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.Origin - :ivar action_type: Enum. Indicates the action type. "Internal" refers to actions that are for - internal only APIs. "Internal" - :vartype action_type: str or - ~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.ActionType - """ - - _validation = { - "name": {"readonly": True}, - "is_data_action": {"readonly": True}, - "origin": {"readonly": True}, - "action_type": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "is_data_action": {"key": "isDataAction", "type": "bool"}, - "display": {"key": "display", "type": "OperationDisplay"}, - "origin": {"key": "origin", "type": "str"}, - "action_type": {"key": "actionType", "type": "str"}, - } - - def __init__(self, *, display: Optional["_models.OperationDisplay"] = None, **kwargs: Any) -> None: - """ - :keyword display: Localized display information for this particular operation. - :paramtype display: - ~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.OperationDisplay - """ - super().__init__(**kwargs) - self.name = None - self.is_data_action = None - self.display = display - self.origin = None - self.action_type = None - - -class OperationDisplay(_serialization.Model): - """Localized display information for this particular operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provider: The localized friendly form of the resource provider name, e.g. "Microsoft - Monitoring Insights" or "Microsoft Compute". - :vartype provider: str - :ivar resource: The localized friendly name of the resource type related to this operation. - E.g. "Virtual Machines" or "Job Schedule Collections". - :vartype resource: str - :ivar operation: The concise, localized friendly name for the operation; suitable for - dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual Machine". - :vartype operation: str - :ivar description: The short, localized friendly description of the operation; suitable for - tool tips and detailed views. - :vartype description: str - """ - - _validation = { - "provider": {"readonly": True}, - "resource": {"readonly": True}, - "operation": {"readonly": True}, - "description": {"readonly": True}, - } - - _attribute_map = { - "provider": {"key": "provider", "type": "str"}, - "resource": {"key": "resource", "type": "str"}, - "operation": {"key": "operation", "type": "str"}, - "description": {"key": "description", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.provider = None - self.resource = None - self.operation = None - self.description = None - - -class OperationListResult(_serialization.Model): - """A list of REST API operations supported by an Azure Resource Provider. It contains an URL link - to get the next set of results. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of operations supported by the resource provider. - :vartype value: list[~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.Operation] - :ivar next_link: URL to get the next set of operation list results (if there are any). - :vartype next_link: str - """ - - _validation = { - "value": {"readonly": True}, - "next_link": {"readonly": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[Operation]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.value = None - self.next_link = None - - -class SystemData(_serialization.Model): - """Metadata pertaining to creation and last modification of the resource. - - :ivar created_by: The identity that created the resource. - :vartype created_by: str - :ivar created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", and "Key". - :vartype created_by_type: str or - ~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.CreatedByType - :ivar created_at: The timestamp of resource creation (UTC). - :vartype created_at: ~datetime.datetime - :ivar last_modified_by: The identity that last modified the resource. - :vartype last_modified_by: str - :ivar last_modified_by_type: The type of identity that last modified the resource. Known values - are: "User", "Application", "ManagedIdentity", and "Key". - :vartype last_modified_by_type: str or - ~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.CreatedByType - :ivar last_modified_at: The timestamp of resource last modification (UTC). - :vartype last_modified_at: ~datetime.datetime - """ - - _attribute_map = { - "created_by": {"key": "createdBy", "type": "str"}, - "created_by_type": {"key": "createdByType", "type": "str"}, - "created_at": {"key": "createdAt", "type": "iso-8601"}, - "last_modified_by": {"key": "lastModifiedBy", "type": "str"}, - "last_modified_by_type": {"key": "lastModifiedByType", "type": "str"}, - "last_modified_at": {"key": "lastModifiedAt", "type": "iso-8601"}, - } - - def __init__( - self, - *, - created_by: Optional[str] = None, - created_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, - created_at: Optional[datetime.datetime] = None, - last_modified_by: Optional[str] = None, - last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, - last_modified_at: Optional[datetime.datetime] = None, - **kwargs: Any - ) -> None: - """ - :keyword created_by: The identity that created the resource. - :paramtype created_by: str - :keyword created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", and "Key". - :paramtype created_by_type: str or - ~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.CreatedByType - :keyword created_at: The timestamp of resource creation (UTC). - :paramtype created_at: ~datetime.datetime - :keyword last_modified_by: The identity that last modified the resource. - :paramtype last_modified_by: str - :keyword last_modified_by_type: The type of identity that last modified the resource. Known - values are: "User", "Application", "ManagedIdentity", and "Key". - :paramtype last_modified_by_type: str or - ~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.CreatedByType - :keyword last_modified_at: The timestamp of resource last modification (UTC). - :paramtype last_modified_at: ~datetime.datetime - """ - super().__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 UpdateGroup(_serialization.Model): - """A group to be updated. - - All required parameters must be populated in order to send to server. - - :ivar name: Name of the group. - It must match a group name of an existing fleet member. Required. - :vartype name: str - """ - - _validation = { - "name": {"required": True, "max_length": 50, "min_length": 1, "pattern": r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$"}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - } - - def __init__(self, *, name: str, **kwargs: Any) -> None: - """ - :keyword name: Name of the group. - It must match a group name of an existing fleet member. Required. - :paramtype name: str - """ - super().__init__(**kwargs) - self.name = name - - -class UpdateGroupStatus(_serialization.Model): - """The status of a UpdateGroup. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar status: The status of the UpdateGroup. - :vartype status: ~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.UpdateStatus - :ivar name: The name of the UpdateGroup. - :vartype name: str - :ivar members: The list of member this UpdateGroup updates. - :vartype members: - list[~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.MemberUpdateStatus] - """ - - _validation = { - "status": {"readonly": True}, - "name": {"readonly": True}, - "members": {"readonly": True}, - } - - _attribute_map = { - "status": {"key": "status", "type": "UpdateStatus"}, - "name": {"key": "name", "type": "str"}, - "members": {"key": "members", "type": "[MemberUpdateStatus]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.status = None - self.name = None - self.members = None - - -class UpdateRun(ProxyResource): - """A multi-stage process to perform update operations across members of a Fleet. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.SystemData - :ivar e_tag: If eTag is provided in the response body, it may also be provided as a header per - the normal etag convention. Entity tags are used for comparing two or more entities from the - same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match - (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. - :vartype e_tag: str - :ivar provisioning_state: The provisioning state of the UpdateRun resource. Known values are: - "Succeeded", "Failed", and "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.UpdateRunProvisioningState - :ivar update_strategy_id: The resource id of the FleetUpdateStrategy resource to reference. - - When creating a new run, there are three ways to define a strategy for the run: - - - #. Define a new strategy in place: Set the "strategy" field. - #. Use an existing strategy: Set the "updateStrategyId" field. (since 2023-08-15-preview) - #. Use the default strategy to update all the members one by one: Leave both - "updateStrategyId" and "strategy" unset. (since 2023-08-15-preview) - - Setting both "updateStrategyId" and "strategy" is invalid. - - UpdateRuns created by "updateStrategyId" snapshot the referenced UpdateStrategy at the time of - creation and store it in the "strategy" field. - Subsequent changes to the referenced FleetUpdateStrategy resource do not propagate. - UpdateRunStrategy changes can be made directly on the "strategy" field before launching the - UpdateRun. - :vartype update_strategy_id: str - :ivar strategy: The strategy defines the order in which the clusters will be updated. - If not set, all members will be updated sequentially. The UpdateRun status will show a single - UpdateStage and a single UpdateGroup targeting all members. - The strategy of the UpdateRun can be modified until the run is started. - :vartype strategy: - ~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.UpdateRunStrategy - :ivar managed_cluster_update: The update to be applied to all clusters in the UpdateRun. The - managedClusterUpdate can be modified until the run is started. - :vartype managed_cluster_update: - ~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.ManagedClusterUpdate - :ivar status: The status of the UpdateRun. - :vartype status: ~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.UpdateRunStatus - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "e_tag": {"readonly": True}, - "provisioning_state": {"readonly": True}, - "status": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "e_tag": {"key": "eTag", "type": "str"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "update_strategy_id": {"key": "properties.updateStrategyId", "type": "str"}, - "strategy": {"key": "properties.strategy", "type": "UpdateRunStrategy"}, - "managed_cluster_update": {"key": "properties.managedClusterUpdate", "type": "ManagedClusterUpdate"}, - "status": {"key": "properties.status", "type": "UpdateRunStatus"}, - } - - def __init__( - self, - *, - update_strategy_id: Optional[str] = None, - strategy: Optional["_models.UpdateRunStrategy"] = None, - managed_cluster_update: Optional["_models.ManagedClusterUpdate"] = None, - **kwargs: Any - ) -> None: - """ - :keyword update_strategy_id: The resource id of the FleetUpdateStrategy resource to reference. - - When creating a new run, there are three ways to define a strategy for the run: - - - #. Define a new strategy in place: Set the "strategy" field. - #. Use an existing strategy: Set the "updateStrategyId" field. (since 2023-08-15-preview) - #. Use the default strategy to update all the members one by one: Leave both - "updateStrategyId" and "strategy" unset. (since 2023-08-15-preview) - - Setting both "updateStrategyId" and "strategy" is invalid. - - UpdateRuns created by "updateStrategyId" snapshot the referenced UpdateStrategy at the time of - creation and store it in the "strategy" field. - Subsequent changes to the referenced FleetUpdateStrategy resource do not propagate. - UpdateRunStrategy changes can be made directly on the "strategy" field before launching the - UpdateRun. - :paramtype update_strategy_id: str - :keyword strategy: The strategy defines the order in which the clusters will be updated. - If not set, all members will be updated sequentially. The UpdateRun status will show a single - UpdateStage and a single UpdateGroup targeting all members. - The strategy of the UpdateRun can be modified until the run is started. - :paramtype strategy: - ~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.UpdateRunStrategy - :keyword managed_cluster_update: The update to be applied to all clusters in the UpdateRun. The - managedClusterUpdate can be modified until the run is started. - :paramtype managed_cluster_update: - ~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.ManagedClusterUpdate - """ - super().__init__(**kwargs) - self.e_tag = None - self.provisioning_state = None - self.update_strategy_id = update_strategy_id - self.strategy = strategy - self.managed_cluster_update = managed_cluster_update - self.status = None - - -class UpdateRunListResult(_serialization.Model): - """The response of a UpdateRun list operation. - - All required parameters must be populated in order to send to server. - - :ivar value: The UpdateRun items on this page. Required. - :vartype value: list[~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.UpdateRun] - :ivar next_link: The link to the next page of items. - :vartype next_link: str - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[UpdateRun]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, *, value: List["_models.UpdateRun"], next_link: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword value: The UpdateRun items on this page. Required. - :paramtype value: list[~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.UpdateRun] - :keyword next_link: The link to the next page of items. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class UpdateRunStatus(_serialization.Model): - """The status of a UpdateRun. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar status: The status of the UpdateRun. - :vartype status: ~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.UpdateStatus - :ivar stages: The stages composing an update run. Stages are run sequentially withing an - UpdateRun. - :vartype stages: - list[~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.UpdateStageStatus] - :ivar node_image_selection: The node image upgrade specs for the update run. It is only set in - update run when ``NodeImageSelection.type`` is ``Consistent``. - :vartype node_image_selection: - ~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.NodeImageSelectionStatus - """ - - _validation = { - "status": {"readonly": True}, - "stages": {"readonly": True}, - "node_image_selection": {"readonly": True}, - } - - _attribute_map = { - "status": {"key": "status", "type": "UpdateStatus"}, - "stages": {"key": "stages", "type": "[UpdateStageStatus]"}, - "node_image_selection": {"key": "nodeImageSelection", "type": "NodeImageSelectionStatus"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.status = None - self.stages = None - self.node_image_selection = None - - -class UpdateRunStrategy(_serialization.Model): - """Defines the update sequence of the clusters via stages and groups. - - Stages within a run are executed sequentially one after another. - Groups within a stage are executed in parallel. - Member clusters within a group are updated sequentially one after another. - - A valid strategy contains no duplicate groups within or across stages. - - All required parameters must be populated in order to send to server. - - :ivar stages: The list of stages that compose this update run. Min size: 1. Required. - :vartype stages: list[~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.UpdateStage] - """ - - _validation = { - "stages": {"required": True}, - } - - _attribute_map = { - "stages": {"key": "stages", "type": "[UpdateStage]"}, - } - - def __init__(self, *, stages: List["_models.UpdateStage"], **kwargs: Any) -> None: - """ - :keyword stages: The list of stages that compose this update run. Min size: 1. Required. - :paramtype stages: - list[~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.UpdateStage] - """ - super().__init__(**kwargs) - self.stages = stages - - -class UpdateStage(_serialization.Model): - """Defines a stage which contains the groups to update and the steps to take (e.g., wait for a - time period) before starting the next stage. - - All required parameters must be populated in order to send to server. - - :ivar name: The name of the stage. Must be unique within the UpdateRun. Required. - :vartype name: str - :ivar groups: Defines the groups to be executed in parallel in this stage. Duplicate groups are - not allowed. Min size: 1. - :vartype groups: list[~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.UpdateGroup] - :ivar after_stage_wait_in_seconds: The time in seconds to wait at the end of this stage before - starting the next one. Defaults to 0 seconds if unspecified. - :vartype after_stage_wait_in_seconds: int - """ - - _validation = { - "name": {"required": True, "max_length": 50, "min_length": 1, "pattern": r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$"}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "groups": {"key": "groups", "type": "[UpdateGroup]"}, - "after_stage_wait_in_seconds": {"key": "afterStageWaitInSeconds", "type": "int"}, - } - - def __init__( - self, - *, - name: str, - groups: Optional[List["_models.UpdateGroup"]] = None, - after_stage_wait_in_seconds: Optional[int] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: The name of the stage. Must be unique within the UpdateRun. Required. - :paramtype name: str - :keyword groups: Defines the groups to be executed in parallel in this stage. Duplicate groups - are not allowed. Min size: 1. - :paramtype groups: - list[~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.UpdateGroup] - :keyword after_stage_wait_in_seconds: The time in seconds to wait at the end of this stage - before starting the next one. Defaults to 0 seconds if unspecified. - :paramtype after_stage_wait_in_seconds: int - """ - super().__init__(**kwargs) - self.name = name - self.groups = groups - self.after_stage_wait_in_seconds = after_stage_wait_in_seconds - - -class UpdateStageStatus(_serialization.Model): - """The status of a UpdateStage. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar status: The status of the UpdateStage. - :vartype status: ~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.UpdateStatus - :ivar name: The name of the UpdateStage. - :vartype name: str - :ivar groups: The list of groups to be updated as part of this UpdateStage. - :vartype groups: - list[~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.UpdateGroupStatus] - :ivar after_stage_wait_status: The status of the wait period configured on the UpdateStage. - :vartype after_stage_wait_status: - ~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.WaitStatus - """ - - _validation = { - "status": {"readonly": True}, - "name": {"readonly": True}, - "groups": {"readonly": True}, - "after_stage_wait_status": {"readonly": True}, - } - - _attribute_map = { - "status": {"key": "status", "type": "UpdateStatus"}, - "name": {"key": "name", "type": "str"}, - "groups": {"key": "groups", "type": "[UpdateGroupStatus]"}, - "after_stage_wait_status": {"key": "afterStageWaitStatus", "type": "WaitStatus"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.status = None - self.name = None - self.groups = None - self.after_stage_wait_status = None - - -class UpdateStatus(_serialization.Model): - """The status for an operation or group of operations. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar start_time: The time the operation or group was started. - :vartype start_time: ~datetime.datetime - :ivar completed_time: The time the operation or group was completed. - :vartype completed_time: ~datetime.datetime - :ivar state: The State of the operation or group. Known values are: "NotStarted", "Running", - "Stopping", "Stopped", "Skipped", "Failed", and "Completed". - :vartype state: str or ~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.UpdateState - :ivar error: The error details when a failure is encountered. - :vartype error: ~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.ErrorDetail - """ - - _validation = { - "start_time": {"readonly": True}, - "completed_time": {"readonly": True}, - "state": {"readonly": True}, - "error": {"readonly": True}, - } - - _attribute_map = { - "start_time": {"key": "startTime", "type": "iso-8601"}, - "completed_time": {"key": "completedTime", "type": "iso-8601"}, - "state": {"key": "state", "type": "str"}, - "error": {"key": "error", "type": "ErrorDetail"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.start_time = None - self.completed_time = None - self.state = None - self.error = None - - -class UserAssignedIdentity(_serialization.Model): - """User assigned identity properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar principal_id: The principal ID of the assigned identity. - :vartype principal_id: str - :ivar client_id: The client ID of the assigned identity. - :vartype client_id: str - """ - - _validation = { - "principal_id": {"readonly": True}, - "client_id": {"readonly": True}, - } - - _attribute_map = { - "principal_id": {"key": "principalId", "type": "str"}, - "client_id": {"key": "clientId", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.principal_id = None - self.client_id = None - - -class WaitStatus(_serialization.Model): - """The status of the wait duration. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar status: The status of the wait duration. - :vartype status: ~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.UpdateStatus - :ivar wait_duration_in_seconds: The wait duration configured in seconds. - :vartype wait_duration_in_seconds: int - """ - - _validation = { - "status": {"readonly": True}, - "wait_duration_in_seconds": {"readonly": True}, - } - - _attribute_map = { - "status": {"key": "status", "type": "UpdateStatus"}, - "wait_duration_in_seconds": {"key": "waitDurationInSeconds", "type": "int"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.status = None - self.wait_duration_in_seconds = None diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/models/_patch.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/models/_patch.py deleted file mode 100644 index f7dd32510333d..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/models/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/operations/_fleet_members_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/operations/_fleet_members_operations.py deleted file mode 100644 index ef37a46c0a6cd..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/operations/_fleet_members_operations.py +++ /dev/null @@ -1,1076 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_fleet_request( - resource_group_name: str, fleet_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-15-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, fleet_name: str, fleet_member_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-15-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - "fleetMemberName": _SERIALIZER.url( - "fleet_member_name", - fleet_member_name, - "str", - max_length=50, - min_length=1, - pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_request( - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-15-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - "fleetMemberName": _SERIALIZER.url( - "fleet_member_name", - fleet_member_name, - "str", - max_length=50, - min_length=1, - pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if if_none_match is not None: - _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-15-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - "fleetMemberName": _SERIALIZER.url( - "fleet_member_name", - fleet_member_name, - "str", - max_length=50, - min_length=1, - pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-15-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - "fleetMemberName": _SERIALIZER.url( - "fleet_member_name", - fleet_member_name, - "str", - max_length=50, - min_length=1, - pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -class FleetMembersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.containerservicefleet.v2023_08_15_preview.ContainerServiceFleetMgmtClient`'s - :attr:`fleet_members` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_by_fleet( - self, resource_group_name: str, fleet_name: str, **kwargs: Any - ) -> Iterable["_models.FleetMember"]: - """List FleetMember resources by Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :return: An iterator like instance of either FleetMember or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.FleetMember] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-08-15-preview") - ) - cls: ClsType[_models.FleetMemberListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_fleet_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("FleetMemberListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get( - self, resource_group_name: str, fleet_name: str, fleet_member_name: str, **kwargs: Any - ) -> _models.FleetMember: - """Get a FleetMember. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :return: FleetMember or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.FleetMember - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-08-15-preview") - ) - cls: ClsType[_models.FleetMember] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - fleet_member_name=fleet_member_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("FleetMember", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_initial( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - resource: Union[_models.FleetMember, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-08-15-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "FleetMember") - - _request = build_create_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - fleet_member_name=fleet_member_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - resource: _models.FleetMember, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.FleetMember]: - """Create a FleetMember. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :param resource: Resource create parameters. Required. - :type resource: ~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.FleetMember - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either FleetMember or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.FleetMember] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - resource: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.FleetMember]: - """Create a FleetMember. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :param resource: Resource create parameters. Required. - :type resource: IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either FleetMember or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.FleetMember] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - resource: Union[_models.FleetMember, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[_models.FleetMember]: - """Create a FleetMember. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :param resource: Resource create parameters. Is either a FleetMember type or a IO[bytes] type. - Required. - :type resource: ~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.FleetMember or - IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :return: An instance of LROPoller that returns either FleetMember or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.FleetMember] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-08-15-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FleetMember] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - fleet_member_name=fleet_member_name, - resource=resource, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FleetMember", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.FleetMember].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.FleetMember]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_initial( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - properties: Union[_models.FleetMemberUpdate, IO[bytes]], - if_match: Optional[str] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-08-15-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties - else: - _json = self._serialize.body(properties, "FleetMemberUpdate") - - _request = build_update_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - fleet_member_name=fleet_member_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - properties: _models.FleetMemberUpdate, - if_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.FleetMember]: - """Update a FleetMember. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :param properties: The resource properties to be updated. Required. - :type properties: - ~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.FleetMemberUpdate - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either FleetMember or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.FleetMember] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - properties: IO[bytes], - if_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.FleetMember]: - """Update a FleetMember. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :param properties: The resource properties to be updated. Required. - :type properties: IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either FleetMember or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.FleetMember] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - properties: Union[_models.FleetMemberUpdate, IO[bytes]], - if_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[_models.FleetMember]: - """Update a FleetMember. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :param properties: The resource properties to be updated. Is either a FleetMemberUpdate type or - a IO[bytes] type. Required. - :type properties: - ~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.FleetMemberUpdate or IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :return: An instance of LROPoller that returns either FleetMember or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.FleetMember] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-08-15-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FleetMember] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - fleet_member_name=fleet_member_name, - properties=properties, - if_match=if_match, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FleetMember", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.FleetMember].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.FleetMember]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-08-15-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - fleet_member_name=fleet_member_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[None]: - """Delete a FleetMember. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-08-15-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - fleet_member_name=fleet_member_name, - if_match=if_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/operations/_fleet_update_strategies_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/operations/_fleet_update_strategies_operations.py deleted file mode 100644 index 97c1a01fb6c70..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/operations/_fleet_update_strategies_operations.py +++ /dev/null @@ -1,787 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_fleet_request( - resource_group_name: str, fleet_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-15-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateStrategies", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, fleet_name: str, update_strategy_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-15-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateStrategies/{updateStrategyName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - "updateStrategyName": _SERIALIZER.url( - "update_strategy_name", - update_strategy_name, - "str", - max_length=50, - min_length=1, - pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - fleet_name: str, - update_strategy_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-15-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateStrategies/{updateStrategyName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - "updateStrategyName": _SERIALIZER.url( - "update_strategy_name", - update_strategy_name, - "str", - max_length=50, - min_length=1, - pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if if_none_match is not None: - _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - fleet_name: str, - update_strategy_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-15-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateStrategies/{updateStrategyName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - "updateStrategyName": _SERIALIZER.url( - "update_strategy_name", - update_strategy_name, - "str", - max_length=50, - min_length=1, - pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -class FleetUpdateStrategiesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.containerservicefleet.v2023_08_15_preview.ContainerServiceFleetMgmtClient`'s - :attr:`fleet_update_strategies` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_by_fleet( - self, resource_group_name: str, fleet_name: str, **kwargs: Any - ) -> Iterable["_models.FleetUpdateStrategy"]: - """List FleetUpdateStrategy resources by Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :return: An iterator like instance of either FleetUpdateStrategy or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.FleetUpdateStrategy] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-08-15-preview") - ) - cls: ClsType[_models.FleetUpdateStrategyListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_fleet_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("FleetUpdateStrategyListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get( - self, resource_group_name: str, fleet_name: str, update_strategy_name: str, **kwargs: Any - ) -> _models.FleetUpdateStrategy: - """Get a FleetUpdateStrategy. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_strategy_name: The name of the UpdateStrategy resource. Required. - :type update_strategy_name: str - :return: FleetUpdateStrategy or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.FleetUpdateStrategy - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-08-15-preview") - ) - cls: ClsType[_models.FleetUpdateStrategy] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_strategy_name=update_strategy_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("FleetUpdateStrategy", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - fleet_name: str, - update_strategy_name: str, - resource: Union[_models.FleetUpdateStrategy, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-08-15-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "FleetUpdateStrategy") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_strategy_name=update_strategy_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - update_strategy_name: str, - resource: _models.FleetUpdateStrategy, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.FleetUpdateStrategy]: - """Create a FleetUpdateStrategy. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_strategy_name: The name of the UpdateStrategy resource. Required. - :type update_strategy_name: str - :param resource: Resource create parameters. Required. - :type resource: - ~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.FleetUpdateStrategy - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either FleetUpdateStrategy or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.FleetUpdateStrategy] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - update_strategy_name: str, - resource: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.FleetUpdateStrategy]: - """Create a FleetUpdateStrategy. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_strategy_name: The name of the UpdateStrategy resource. Required. - :type update_strategy_name: str - :param resource: Resource create parameters. Required. - :type resource: IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either FleetUpdateStrategy or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.FleetUpdateStrategy] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - update_strategy_name: str, - resource: Union[_models.FleetUpdateStrategy, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[_models.FleetUpdateStrategy]: - """Create a FleetUpdateStrategy. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_strategy_name: The name of the UpdateStrategy resource. Required. - :type update_strategy_name: str - :param resource: Resource create parameters. Is either a FleetUpdateStrategy type or a - IO[bytes] type. Required. - :type resource: - ~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.FleetUpdateStrategy or IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :return: An instance of LROPoller that returns either FleetUpdateStrategy or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.FleetUpdateStrategy] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-08-15-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FleetUpdateStrategy] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_strategy_name=update_strategy_name, - resource=resource, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FleetUpdateStrategy", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.FleetUpdateStrategy].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.FleetUpdateStrategy]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, - resource_group_name: str, - fleet_name: str, - update_strategy_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-08-15-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_strategy_name=update_strategy_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, - resource_group_name: str, - fleet_name: str, - update_strategy_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[None]: - """Delete a FleetUpdateStrategy. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_strategy_name: The name of the UpdateStrategy resource. Required. - :type update_strategy_name: str - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-08-15-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_strategy_name=update_strategy_name, - if_match=if_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/operations/_fleets_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/operations/_fleets_operations.py deleted file mode 100644 index bc71485d3fec6..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/operations/_fleets_operations.py +++ /dev/null @@ -1,1165 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-15-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/fleets") - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-15-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request(resource_group_name: str, fleet_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-15-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - fleet_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-15-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if if_none_match is not None: - _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, fleet_name: str, subscription_id: str, *, if_match: Optional[str] = None, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-15-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, fleet_name: str, subscription_id: str, *, if_match: Optional[str] = None, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-15-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_credentials_request( - resource_group_name: str, fleet_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-15-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/listCredentials", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class FleetsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.containerservicefleet.v2023_08_15_preview.ContainerServiceFleetMgmtClient`'s - :attr:`fleets` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.Fleet"]: - """Lists fleets in the specified subscription. - - :return: An iterator like instance of either Fleet or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-08-15-preview") - ) - cls: ClsType[_models.FleetListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("FleetListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Fleet"]: - """Lists fleets in the specified subscription and resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :return: An iterator like instance of either Fleet or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-08-15-preview") - ) - cls: ClsType[_models.FleetListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("FleetListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get(self, resource_group_name: str, fleet_name: str, **kwargs: Any) -> _models.Fleet: - """Gets a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :return: Fleet or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.Fleet - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-08-15-preview") - ) - cls: ClsType[_models.Fleet] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Fleet", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - fleet_name: str, - resource: Union[_models.Fleet, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-08-15-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "Fleet") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - resource: _models.Fleet, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Fleet]: - """Creates or updates a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param resource: Resource create parameters. Required. - :type resource: ~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.Fleet - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either Fleet or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - resource: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Fleet]: - """Creates or updates a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param resource: Resource create parameters. Required. - :type resource: IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either Fleet or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - resource: Union[_models.Fleet, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[_models.Fleet]: - """Creates or updates a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param resource: Resource create parameters. Is either a Fleet type or a IO[bytes] type. - Required. - :type resource: ~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.Fleet or IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :return: An instance of LROPoller that returns either Fleet or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-08-15-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Fleet] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - resource=resource, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Fleet", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.Fleet].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.Fleet]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_initial( - self, - resource_group_name: str, - fleet_name: str, - properties: Union[_models.FleetPatch, IO[bytes]], - if_match: Optional[str] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-08-15-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties - else: - _json = self._serialize.body(properties, "FleetPatch") - - _request = build_update_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - fleet_name: str, - properties: _models.FleetPatch, - if_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Fleet]: - """Update a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param properties: The resource properties to be updated. Required. - :type properties: ~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.FleetPatch - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either Fleet or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - fleet_name: str, - properties: IO[bytes], - if_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Fleet]: - """Update a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param properties: The resource properties to be updated. Required. - :type properties: IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either Fleet or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - fleet_name: str, - properties: Union[_models.FleetPatch, IO[bytes]], - if_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[_models.Fleet]: - """Update a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param properties: The resource properties to be updated. Is either a FleetPatch type or a - IO[bytes] type. Required. - :type properties: ~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.FleetPatch or - IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :return: An instance of LROPoller that returns either Fleet or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-08-15-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Fleet] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - properties=properties, - if_match=if_match, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Fleet", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.Fleet].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.Fleet]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, fleet_name: str, if_match: Optional[str] = None, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-08-15-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, resource_group_name: str, fleet_name: str, if_match: Optional[str] = None, **kwargs: Any - ) -> LROPoller[None]: - """Delete a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-08-15-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - if_match=if_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list_credentials( - self, resource_group_name: str, fleet_name: str, **kwargs: Any - ) -> _models.FleetCredentialResults: - """Lists the user credentials of a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :return: FleetCredentialResults or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.FleetCredentialResults - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-08-15-preview") - ) - cls: ClsType[_models.FleetCredentialResults] = kwargs.pop("cls", None) - - _request = build_list_credentials_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("FleetCredentialResults", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/operations/_operations.py deleted file mode 100644 index 8dd93a2b5919a..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/operations/_operations.py +++ /dev/null @@ -1,156 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-15-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.ContainerService/operations") - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class Operations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.containerservicefleet.v2023_08_15_preview.ContainerServiceFleetMgmtClient`'s - :attr:`operations` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: - """List the operations for the provider. - - :return: An iterator like instance of either Operation or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.Operation] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-08-15-preview") - ) - cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - 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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/operations/_patch.py deleted file mode 100644 index f7dd32510333d..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/operations/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/operations/_update_runs_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/operations/_update_runs_operations.py deleted file mode 100644 index 75d92582202a4..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/operations/_update_runs_operations.py +++ /dev/null @@ -1,1163 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_fleet_request( - resource_group_name: str, fleet_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-15-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, fleet_name: str, update_run_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-15-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - "updateRunName": _SERIALIZER.url( - "update_run_name", - update_run_name, - "str", - max_length=50, - min_length=1, - pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - fleet_name: str, - update_run_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-15-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - "updateRunName": _SERIALIZER.url( - "update_run_name", - update_run_name, - "str", - max_length=50, - min_length=1, - pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if if_none_match is not None: - _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - fleet_name: str, - update_run_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-15-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - "updateRunName": _SERIALIZER.url( - "update_run_name", - update_run_name, - "str", - max_length=50, - min_length=1, - pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_start_request( - resource_group_name: str, - fleet_name: str, - update_run_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-15-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName}/start", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - "updateRunName": _SERIALIZER.url( - "update_run_name", - update_run_name, - "str", - max_length=50, - min_length=1, - pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_stop_request( - resource_group_name: str, - fleet_name: str, - update_run_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-08-15-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName}/stop", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - "updateRunName": _SERIALIZER.url( - "update_run_name", - update_run_name, - "str", - max_length=50, - min_length=1, - pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class UpdateRunsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.containerservicefleet.v2023_08_15_preview.ContainerServiceFleetMgmtClient`'s - :attr:`update_runs` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_by_fleet(self, resource_group_name: str, fleet_name: str, **kwargs: Any) -> Iterable["_models.UpdateRun"]: - """List UpdateRun resources by Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :return: An iterator like instance of either UpdateRun or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.UpdateRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-08-15-preview") - ) - cls: ClsType[_models.UpdateRunListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_fleet_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("UpdateRunListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get(self, resource_group_name: str, fleet_name: str, update_run_name: str, **kwargs: Any) -> _models.UpdateRun: - """Get a UpdateRun. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_run_name: The name of the UpdateRun resource. Required. - :type update_run_name: str - :return: UpdateRun or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.UpdateRun - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-08-15-preview") - ) - cls: ClsType[_models.UpdateRun] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("UpdateRun", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - resource: Union[_models.UpdateRun, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-08-15-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "UpdateRun") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - resource: _models.UpdateRun, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.UpdateRun]: - """Create a UpdateRun. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_run_name: The name of the UpdateRun resource. Required. - :type update_run_name: str - :param resource: Resource create parameters. Required. - :type resource: ~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.UpdateRun - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either UpdateRun or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.UpdateRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - resource: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.UpdateRun]: - """Create a UpdateRun. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_run_name: The name of the UpdateRun resource. Required. - :type update_run_name: str - :param resource: Resource create parameters. Required. - :type resource: IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either UpdateRun or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.UpdateRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - resource: Union[_models.UpdateRun, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[_models.UpdateRun]: - """Create a UpdateRun. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_run_name: The name of the UpdateRun resource. Required. - :type update_run_name: str - :param resource: Resource create parameters. Is either a UpdateRun type or a IO[bytes] type. - Required. - :type resource: ~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.UpdateRun or - IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :return: An instance of LROPoller that returns either UpdateRun or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.UpdateRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-08-15-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.UpdateRun] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - resource=resource, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("UpdateRun", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.UpdateRun].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.UpdateRun]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-08-15-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[None]: - """Delete a UpdateRun. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_run_name: The name of the UpdateRun resource. Required. - :type update_run_name: str - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-08-15-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - if_match=if_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _start_initial( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-08-15-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_start_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_start( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[_models.UpdateRun]: - """Starts an UpdateRun. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_run_name: The name of the UpdateRun resource. Required. - :type update_run_name: str - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :return: An instance of LROPoller that returns either UpdateRun or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.UpdateRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-08-15-preview") - ) - cls: ClsType[_models.UpdateRun] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._start_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - if_match=if_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("UpdateRun", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.UpdateRun].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.UpdateRun]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _stop_initial( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-08-15-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_stop_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_stop( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[_models.UpdateRun]: - """Stops an UpdateRun. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_run_name: The name of the UpdateRun resource. Required. - :type update_run_name: str - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :return: An instance of LROPoller that returns either UpdateRun or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2023_08_15_preview.models.UpdateRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2023-08-15-preview") - ) - cls: ClsType[_models.UpdateRun] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._stop_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - if_match=if_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("UpdateRun", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.UpdateRun].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.UpdateRun]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/py.typed b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/py.typed deleted file mode 100644 index e5aff4f83af86..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/py.typed +++ /dev/null @@ -1 +0,0 @@ -# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/__init__.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/__init__.py deleted file mode 100644 index 78b8b4b91a49e..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/__init__.py +++ /dev/null @@ -1,26 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._container_service_fleet_mgmt_client import ContainerServiceFleetMgmtClient -from ._version import VERSION - -__version__ = VERSION - -try: - from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ContainerServiceFleetMgmtClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) - -_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/_configuration.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/_configuration.py deleted file mode 100644 index 8df1e03261c31..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/_configuration.py +++ /dev/null @@ -1,65 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any, TYPE_CHECKING - -from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy - -from ._version import VERSION - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials import TokenCredential - - -class ContainerServiceFleetMgmtClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long - """Configuration for ContainerServiceFleetMgmtClient. - - 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. Required. - :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :keyword api_version: Api Version. Default value is "2023-10-15". Note that overriding this - default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2023-10-15") - - if credential is None: - raise ValueError("Parameter 'credential' must not be None.") - if subscription_id is None: - raise ValueError("Parameter 'subscription_id' must not be None.") - - self.credential = credential - self.subscription_id = subscription_id - self.api_version = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-containerservicefleet/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - 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.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") - if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/_container_service_fleet_mgmt_client.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/_container_service_fleet_mgmt_client.py deleted file mode 100644 index ce2f6eac654f6..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/_container_service_fleet_mgmt_client.py +++ /dev/null @@ -1,139 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, TYPE_CHECKING -from typing_extensions import Self - -from azure.core.pipeline import policies -from azure.core.rest import HttpRequest, HttpResponse -from azure.mgmt.core import ARMPipelineClient -from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy - -from . import models as _models -from .._serialization import Deserializer, Serializer -from ._configuration import ContainerServiceFleetMgmtClientConfiguration -from .operations import ( - FleetMembersOperations, - FleetUpdateStrategiesOperations, - FleetsOperations, - Operations, - UpdateRunsOperations, -) - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials import TokenCredential - - -class ContainerServiceFleetMgmtClient: # pylint: disable=client-accepts-api-version-keyword - """Azure Kubernetes Fleet Manager api client. - - :ivar operations: Operations operations - :vartype operations: azure.mgmt.containerservicefleet.v2023_10_15.operations.Operations - :ivar fleets: FleetsOperations operations - :vartype fleets: azure.mgmt.containerservicefleet.v2023_10_15.operations.FleetsOperations - :ivar fleet_members: FleetMembersOperations operations - :vartype fleet_members: - azure.mgmt.containerservicefleet.v2023_10_15.operations.FleetMembersOperations - :ivar update_runs: UpdateRunsOperations operations - :vartype update_runs: - azure.mgmt.containerservicefleet.v2023_10_15.operations.UpdateRunsOperations - :ivar fleet_update_strategies: FleetUpdateStrategiesOperations operations - :vartype fleet_update_strategies: - azure.mgmt.containerservicefleet.v2023_10_15.operations.FleetUpdateStrategiesOperations - :param credential: Credential needed for the client to connect to Azure. Required. - :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". - :type base_url: str - :keyword api_version: Api Version. Default value is "2023-10-15". Note that overriding this - default value may result in unsupported behavior. - :paramtype api_version: str - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - """ - - def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any - ) -> None: - self._config = ContainerServiceFleetMgmtClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs - ) - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - ARMAutoResourceProviderRegistrationPolicy(), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) - - client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer(client_models) - self._deserialize = Deserializer(client_models) - self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize, "2023-10-15") - self.fleets = FleetsOperations(self._client, self._config, self._serialize, self._deserialize, "2023-10-15") - self.fleet_members = FleetMembersOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-10-15" - ) - self.update_runs = UpdateRunsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-10-15" - ) - self.fleet_update_strategies = FleetUpdateStrategiesOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-10-15" - ) - - def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.HttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore - - def close(self) -> None: - self._client.close() - - def __enter__(self) -> Self: - self._client.__enter__() - return self - - def __exit__(self, *exc_details: Any) -> None: - self._client.__exit__(*exc_details) diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/_metadata.json b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/_metadata.json deleted file mode 100644 index b1f17cb884ecf..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/_metadata.json +++ /dev/null @@ -1,114 +0,0 @@ -{ - "chosen_version": "2023-10-15", - "total_api_version_list": ["2023-10-15"], - "client": { - "name": "ContainerServiceFleetMgmtClient", - "filename": "_container_service_fleet_mgmt_client", - "description": "Azure Kubernetes Fleet Manager api client.", - "host_value": "\"https://management.azure.com\"", - "parameterized_host_template": null, - "azure_arm": true, - "has_public_lro_operations": true, - "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ContainerServiceFleetMgmtClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ContainerServiceFleetMgmtClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" - }, - "global_parameters": { - "sync": { - "credential": { - "signature": "credential: \"TokenCredential\",", - "description": "Credential needed for the client to connect to Azure. Required.", - "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true, - "method_location": "positional" - }, - "subscription_id": { - "signature": "subscription_id: str,", - "description": "The ID of the target subscription. Required.", - "docstring_type": "str", - "required": true, - "method_location": "positional" - } - }, - "async": { - "credential": { - "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure. Required.", - "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", - "required": true - }, - "subscription_id": { - "signature": "subscription_id: str,", - "description": "The ID of the target subscription. Required.", - "docstring_type": "str", - "required": true - } - }, - "constant": { - }, - "call": "credential, subscription_id", - "service_client_specific": { - "sync": { - "api_version": { - "signature": "api_version: Optional[str]=None,", - "description": "API version to use if no profile is provided, or if missing in profile.", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", - "description": "Service URL", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "profile": { - "signature": "profile: KnownProfiles=KnownProfiles.default,", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false, - "method_location": "positional" - } - }, - "async": { - "api_version": { - "signature": "api_version: Optional[str] = None,", - "description": "API version to use if no profile is provided, or if missing in profile.", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", - "description": "Service URL", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "profile": { - "signature": "profile: KnownProfiles = KnownProfiles.default,", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false, - "method_location": "positional" - } - } - } - }, - "config": { - "credential": true, - "credential_scopes": ["https://management.azure.com/.default"], - "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", - "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", - "sync_imports": "{\"regular\": {\"sdkcore\": {\"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"sdkcore\": {\"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" - }, - "operation_groups": { - "operations": "Operations", - "fleets": "FleetsOperations", - "fleet_members": "FleetMembersOperations", - "update_runs": "UpdateRunsOperations", - "fleet_update_strategies": "FleetUpdateStrategiesOperations" - } -} diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/_patch.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/_patch.py deleted file mode 100644 index f7dd32510333d..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/_version.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/_version.py deleted file mode 100644 index 83f24ab509461..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/_version.py +++ /dev/null @@ -1,9 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -VERSION = "2.1.0" diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/aio/__init__.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/aio/__init__.py deleted file mode 100644 index af1d7b0b47fe9..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/aio/__init__.py +++ /dev/null @@ -1,23 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._container_service_fleet_mgmt_client import ContainerServiceFleetMgmtClient - -try: - from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ContainerServiceFleetMgmtClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) - -_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/aio/_configuration.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/aio/_configuration.py deleted file mode 100644 index 809347e8dbcae..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/aio/_configuration.py +++ /dev/null @@ -1,65 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any, TYPE_CHECKING - -from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy - -from .._version import VERSION - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential - - -class ContainerServiceFleetMgmtClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long - """Configuration for ContainerServiceFleetMgmtClient. - - 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. Required. - :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :keyword api_version: Api Version. Default value is "2023-10-15". Note that overriding this - default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2023-10-15") - - if credential is None: - raise ValueError("Parameter 'credential' must not be None.") - if subscription_id is None: - raise ValueError("Parameter 'subscription_id' must not be None.") - - self.credential = credential - self.subscription_id = subscription_id - self.api_version = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-containerservicefleet/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - 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.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") - if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/aio/_container_service_fleet_mgmt_client.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/aio/_container_service_fleet_mgmt_client.py deleted file mode 100644 index df20a129abbcc..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/aio/_container_service_fleet_mgmt_client.py +++ /dev/null @@ -1,141 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING -from typing_extensions import Self - -from azure.core.pipeline import policies -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.mgmt.core import AsyncARMPipelineClient -from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy - -from .. import models as _models -from ..._serialization import Deserializer, Serializer -from ._configuration import ContainerServiceFleetMgmtClientConfiguration -from .operations import ( - FleetMembersOperations, - FleetUpdateStrategiesOperations, - FleetsOperations, - Operations, - UpdateRunsOperations, -) - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential - - -class ContainerServiceFleetMgmtClient: # pylint: disable=client-accepts-api-version-keyword - """Azure Kubernetes Fleet Manager api client. - - :ivar operations: Operations operations - :vartype operations: azure.mgmt.containerservicefleet.v2023_10_15.aio.operations.Operations - :ivar fleets: FleetsOperations operations - :vartype fleets: azure.mgmt.containerservicefleet.v2023_10_15.aio.operations.FleetsOperations - :ivar fleet_members: FleetMembersOperations operations - :vartype fleet_members: - azure.mgmt.containerservicefleet.v2023_10_15.aio.operations.FleetMembersOperations - :ivar update_runs: UpdateRunsOperations operations - :vartype update_runs: - azure.mgmt.containerservicefleet.v2023_10_15.aio.operations.UpdateRunsOperations - :ivar fleet_update_strategies: FleetUpdateStrategiesOperations operations - :vartype fleet_update_strategies: - azure.mgmt.containerservicefleet.v2023_10_15.aio.operations.FleetUpdateStrategiesOperations - :param credential: Credential needed for the client to connect to Azure. Required. - :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". - :type base_url: str - :keyword api_version: Api Version. Default value is "2023-10-15". Note that overriding this - default value may result in unsupported behavior. - :paramtype api_version: str - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - """ - - def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any - ) -> None: - self._config = ContainerServiceFleetMgmtClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs - ) - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - AsyncARMAutoResourceProviderRegistrationPolicy(), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) - - client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer(client_models) - self._deserialize = Deserializer(client_models) - self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize, "2023-10-15") - self.fleets = FleetsOperations(self._client, self._config, self._serialize, self._deserialize, "2023-10-15") - self.fleet_members = FleetMembersOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-10-15" - ) - self.update_runs = UpdateRunsOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-10-15" - ) - self.fleet_update_strategies = FleetUpdateStrategiesOperations( - self._client, self._config, self._serialize, self._deserialize, "2023-10-15" - ) - - def _send_request( - self, request: HttpRequest, *, stream: bool = False, **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = await client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.AsyncHttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore - - async def close(self) -> None: - await self._client.close() - - async def __aenter__(self) -> Self: - await self._client.__aenter__() - return self - - async def __aexit__(self, *exc_details: Any) -> None: - await self._client.__aexit__(*exc_details) diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/aio/_patch.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/aio/_patch.py deleted file mode 100644 index f7dd32510333d..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/aio/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/aio/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/aio/operations/__init__.py deleted file mode 100644 index 2233c34e005ae..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/aio/operations/__init__.py +++ /dev/null @@ -1,27 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._operations import Operations -from ._fleets_operations import FleetsOperations -from ._fleet_members_operations import FleetMembersOperations -from ._update_runs_operations import UpdateRunsOperations -from ._fleet_update_strategies_operations import FleetUpdateStrategiesOperations - -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "Operations", - "FleetsOperations", - "FleetMembersOperations", - "UpdateRunsOperations", - "FleetUpdateStrategiesOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/aio/operations/_fleet_members_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/aio/operations/_fleet_members_operations.py deleted file mode 100644 index 684a7cc961503..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/aio/operations/_fleet_members_operations.py +++ /dev/null @@ -1,824 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._fleet_members_operations import ( - build_create_request, - build_delete_request, - build_get_request, - build_list_by_fleet_request, - build_update_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class FleetMembersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.containerservicefleet.v2023_10_15.aio.ContainerServiceFleetMgmtClient`'s - :attr:`fleet_members` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_by_fleet( - self, resource_group_name: str, fleet_name: str, **kwargs: Any - ) -> AsyncIterable["_models.FleetMember"]: - """List FleetMember resources by Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :return: An iterator like instance of either FleetMember or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservicefleet.v2023_10_15.models.FleetMember] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-10-15")) - cls: ClsType[_models.FleetMemberListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_fleet_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("FleetMemberListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get( - self, resource_group_name: str, fleet_name: str, fleet_member_name: str, **kwargs: Any - ) -> _models.FleetMember: - """Get a FleetMember. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :return: FleetMember or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2023_10_15.models.FleetMember - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-10-15")) - cls: ClsType[_models.FleetMember] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - fleet_member_name=fleet_member_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("FleetMember", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_initial( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - resource: Union[_models.FleetMember, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-10-15")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "FleetMember") - - _request = build_create_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - fleet_member_name=fleet_member_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - resource: _models.FleetMember, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.FleetMember]: - """Create a FleetMember. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :param resource: Resource create parameters. Required. - :type resource: ~azure.mgmt.containerservicefleet.v2023_10_15.models.FleetMember - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either FleetMember or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2023_10_15.models.FleetMember] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - resource: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.FleetMember]: - """Create a FleetMember. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :param resource: Resource create parameters. Required. - :type resource: IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either FleetMember or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2023_10_15.models.FleetMember] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - resource: Union[_models.FleetMember, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.FleetMember]: - """Create a FleetMember. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :param resource: Resource create parameters. Is either a FleetMember type or a IO[bytes] type. - Required. - :type resource: ~azure.mgmt.containerservicefleet.v2023_10_15.models.FleetMember or IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :return: An instance of AsyncLROPoller that returns either FleetMember or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2023_10_15.models.FleetMember] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-10-15")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FleetMember] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - fleet_member_name=fleet_member_name, - resource=resource, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FleetMember", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.FleetMember].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.FleetMember]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_initial( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - properties: Union[_models.FleetMemberUpdate, IO[bytes]], - if_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-10-15")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties - else: - _json = self._serialize.body(properties, "FleetMemberUpdate") - - _request = build_update_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - fleet_member_name=fleet_member_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - properties: _models.FleetMemberUpdate, - if_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.FleetMember]: - """Update a FleetMember. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :param properties: The resource properties to be updated. Required. - :type properties: ~azure.mgmt.containerservicefleet.v2023_10_15.models.FleetMemberUpdate - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either FleetMember or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2023_10_15.models.FleetMember] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - properties: IO[bytes], - if_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.FleetMember]: - """Update a FleetMember. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :param properties: The resource properties to be updated. Required. - :type properties: IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either FleetMember or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2023_10_15.models.FleetMember] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - properties: Union[_models.FleetMemberUpdate, IO[bytes]], - if_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.FleetMember]: - """Update a FleetMember. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :param properties: The resource properties to be updated. Is either a FleetMemberUpdate type or - a IO[bytes] type. Required. - :type properties: ~azure.mgmt.containerservicefleet.v2023_10_15.models.FleetMemberUpdate or - IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :return: An instance of AsyncLROPoller that returns either FleetMember or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2023_10_15.models.FleetMember] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-10-15")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FleetMember] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - fleet_member_name=fleet_member_name, - properties=properties, - if_match=if_match, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FleetMember", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.FleetMember].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.FleetMember]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-10-15")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - fleet_member_name=fleet_member_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Delete a FleetMember. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-10-15")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - fleet_member_name=fleet_member_name, - if_match=if_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/aio/operations/_fleet_update_strategies_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/aio/operations/_fleet_update_strategies_operations.py deleted file mode 100644 index cefc4323f6849..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/aio/operations/_fleet_update_strategies_operations.py +++ /dev/null @@ -1,593 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._fleet_update_strategies_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_by_fleet_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class FleetUpdateStrategiesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.containerservicefleet.v2023_10_15.aio.ContainerServiceFleetMgmtClient`'s - :attr:`fleet_update_strategies` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_by_fleet( - self, resource_group_name: str, fleet_name: str, **kwargs: Any - ) -> AsyncIterable["_models.FleetUpdateStrategy"]: - """List FleetUpdateStrategy resources by Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :return: An iterator like instance of either FleetUpdateStrategy or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservicefleet.v2023_10_15.models.FleetUpdateStrategy] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-10-15")) - cls: ClsType[_models.FleetUpdateStrategyListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_fleet_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("FleetUpdateStrategyListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get( - self, resource_group_name: str, fleet_name: str, update_strategy_name: str, **kwargs: Any - ) -> _models.FleetUpdateStrategy: - """Get a FleetUpdateStrategy. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_strategy_name: The name of the UpdateStrategy resource. Required. - :type update_strategy_name: str - :return: FleetUpdateStrategy or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2023_10_15.models.FleetUpdateStrategy - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-10-15")) - cls: ClsType[_models.FleetUpdateStrategy] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_strategy_name=update_strategy_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("FleetUpdateStrategy", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - fleet_name: str, - update_strategy_name: str, - resource: Union[_models.FleetUpdateStrategy, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-10-15")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "FleetUpdateStrategy") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_strategy_name=update_strategy_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - update_strategy_name: str, - resource: _models.FleetUpdateStrategy, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.FleetUpdateStrategy]: - """Create a FleetUpdateStrategy. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_strategy_name: The name of the UpdateStrategy resource. Required. - :type update_strategy_name: str - :param resource: Resource create parameters. Required. - :type resource: ~azure.mgmt.containerservicefleet.v2023_10_15.models.FleetUpdateStrategy - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either FleetUpdateStrategy or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2023_10_15.models.FleetUpdateStrategy] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - update_strategy_name: str, - resource: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.FleetUpdateStrategy]: - """Create a FleetUpdateStrategy. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_strategy_name: The name of the UpdateStrategy resource. Required. - :type update_strategy_name: str - :param resource: Resource create parameters. Required. - :type resource: IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either FleetUpdateStrategy or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2023_10_15.models.FleetUpdateStrategy] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - update_strategy_name: str, - resource: Union[_models.FleetUpdateStrategy, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.FleetUpdateStrategy]: - """Create a FleetUpdateStrategy. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_strategy_name: The name of the UpdateStrategy resource. Required. - :type update_strategy_name: str - :param resource: Resource create parameters. Is either a FleetUpdateStrategy type or a - IO[bytes] type. Required. - :type resource: ~azure.mgmt.containerservicefleet.v2023_10_15.models.FleetUpdateStrategy or - IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :return: An instance of AsyncLROPoller that returns either FleetUpdateStrategy or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2023_10_15.models.FleetUpdateStrategy] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-10-15")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FleetUpdateStrategy] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_strategy_name=update_strategy_name, - resource=resource, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FleetUpdateStrategy", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.FleetUpdateStrategy].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.FleetUpdateStrategy]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, - resource_group_name: str, - fleet_name: str, - update_strategy_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-10-15")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_strategy_name=update_strategy_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, - resource_group_name: str, - fleet_name: str, - update_strategy_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Delete a FleetUpdateStrategy. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_strategy_name: The name of the UpdateStrategy resource. Required. - :type update_strategy_name: str - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-10-15")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_strategy_name=update_strategy_name, - if_match=if_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/aio/operations/_fleets_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/aio/operations/_fleets_operations.py deleted file mode 100644 index 61915e01d7b1a..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/aio/operations/_fleets_operations.py +++ /dev/null @@ -1,905 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._fleets_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_by_resource_group_request, - build_list_by_subscription_request, - build_list_credentials_request, - build_update_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class FleetsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.containerservicefleet.v2023_10_15.aio.ContainerServiceFleetMgmtClient`'s - :attr:`fleets` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.Fleet"]: - """Lists fleets in the specified subscription. - - :return: An iterator like instance of either Fleet or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservicefleet.v2023_10_15.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-10-15")) - cls: ClsType[_models.FleetListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("FleetListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace - def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.Fleet"]: - """Lists fleets in the specified subscription and resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :return: An iterator like instance of either Fleet or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservicefleet.v2023_10_15.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-10-15")) - cls: ClsType[_models.FleetListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("FleetListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get(self, resource_group_name: str, fleet_name: str, **kwargs: Any) -> _models.Fleet: - """Gets a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :return: Fleet or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2023_10_15.models.Fleet - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-10-15")) - cls: ClsType[_models.Fleet] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Fleet", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - fleet_name: str, - resource: Union[_models.Fleet, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-10-15")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "Fleet") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - resource: _models.Fleet, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.Fleet]: - """Creates or updates a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param resource: Resource create parameters. Required. - :type resource: ~azure.mgmt.containerservicefleet.v2023_10_15.models.Fleet - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either Fleet or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2023_10_15.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - resource: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.Fleet]: - """Creates or updates a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param resource: Resource create parameters. Required. - :type resource: IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either Fleet or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2023_10_15.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - resource: Union[_models.Fleet, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.Fleet]: - """Creates or updates a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param resource: Resource create parameters. Is either a Fleet type or a IO[bytes] type. - Required. - :type resource: ~azure.mgmt.containerservicefleet.v2023_10_15.models.Fleet or IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :return: An instance of AsyncLROPoller that returns either Fleet or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2023_10_15.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-10-15")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Fleet] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - resource=resource, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Fleet", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.Fleet].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.Fleet]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_initial( - self, - resource_group_name: str, - fleet_name: str, - properties: Union[_models.FleetPatch, IO[bytes]], - if_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-10-15")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties - else: - _json = self._serialize.body(properties, "FleetPatch") - - _request = build_update_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - fleet_name: str, - properties: _models.FleetPatch, - if_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.Fleet]: - """Update a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param properties: The resource properties to be updated. Required. - :type properties: ~azure.mgmt.containerservicefleet.v2023_10_15.models.FleetPatch - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either Fleet or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2023_10_15.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - fleet_name: str, - properties: IO[bytes], - if_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.Fleet]: - """Update a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param properties: The resource properties to be updated. Required. - :type properties: IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either Fleet or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2023_10_15.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - fleet_name: str, - properties: Union[_models.FleetPatch, IO[bytes]], - if_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.Fleet]: - """Update a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param properties: The resource properties to be updated. Is either a FleetPatch type or a - IO[bytes] type. Required. - :type properties: ~azure.mgmt.containerservicefleet.v2023_10_15.models.FleetPatch or IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :return: An instance of AsyncLROPoller that returns either Fleet or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2023_10_15.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-10-15")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Fleet] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - properties=properties, - if_match=if_match, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Fleet", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.Fleet].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.Fleet]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, fleet_name: str, if_match: Optional[str] = None, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-10-15")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, fleet_name: str, if_match: Optional[str] = None, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Delete a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-10-15")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - if_match=if_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace_async - async def list_credentials( - self, resource_group_name: str, fleet_name: str, **kwargs: Any - ) -> _models.FleetCredentialResults: - """Lists the user credentials of a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :return: FleetCredentialResults or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2023_10_15.models.FleetCredentialResults - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-10-15")) - cls: ClsType[_models.FleetCredentialResults] = kwargs.pop("cls", None) - - _request = build_list_credentials_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("FleetCredentialResults", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/aio/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/aio/operations/_patch.py deleted file mode 100644 index f7dd32510333d..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/aio/operations/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/aio/operations/_update_runs_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/aio/operations/_update_runs_operations.py deleted file mode 100644 index 8ec141038998d..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/aio/operations/_update_runs_operations.py +++ /dev/null @@ -1,869 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._update_runs_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_by_fleet_request, - build_start_request, - build_stop_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class UpdateRunsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.containerservicefleet.v2023_10_15.aio.ContainerServiceFleetMgmtClient`'s - :attr:`update_runs` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_by_fleet( - self, resource_group_name: str, fleet_name: str, **kwargs: Any - ) -> AsyncIterable["_models.UpdateRun"]: - """List UpdateRun resources by Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :return: An iterator like instance of either UpdateRun or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservicefleet.v2023_10_15.models.UpdateRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-10-15")) - cls: ClsType[_models.UpdateRunListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_fleet_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("UpdateRunListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get( - self, resource_group_name: str, fleet_name: str, update_run_name: str, **kwargs: Any - ) -> _models.UpdateRun: - """Get a UpdateRun. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_run_name: The name of the UpdateRun resource. Required. - :type update_run_name: str - :return: UpdateRun or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2023_10_15.models.UpdateRun - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-10-15")) - cls: ClsType[_models.UpdateRun] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("UpdateRun", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - resource: Union[_models.UpdateRun, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-10-15")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "UpdateRun") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - resource: _models.UpdateRun, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.UpdateRun]: - """Create a UpdateRun. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_run_name: The name of the UpdateRun resource. Required. - :type update_run_name: str - :param resource: Resource create parameters. Required. - :type resource: ~azure.mgmt.containerservicefleet.v2023_10_15.models.UpdateRun - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either UpdateRun or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2023_10_15.models.UpdateRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - resource: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.UpdateRun]: - """Create a UpdateRun. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_run_name: The name of the UpdateRun resource. Required. - :type update_run_name: str - :param resource: Resource create parameters. Required. - :type resource: IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either UpdateRun or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2023_10_15.models.UpdateRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - resource: Union[_models.UpdateRun, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.UpdateRun]: - """Create a UpdateRun. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_run_name: The name of the UpdateRun resource. Required. - :type update_run_name: str - :param resource: Resource create parameters. Is either a UpdateRun type or a IO[bytes] type. - Required. - :type resource: ~azure.mgmt.containerservicefleet.v2023_10_15.models.UpdateRun or IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :return: An instance of AsyncLROPoller that returns either UpdateRun or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2023_10_15.models.UpdateRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-10-15")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.UpdateRun] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - resource=resource, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("UpdateRun", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.UpdateRun].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.UpdateRun]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-10-15")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Delete a UpdateRun. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_run_name: The name of the UpdateRun resource. Required. - :type update_run_name: str - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-10-15")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - if_match=if_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _start_initial( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-10-15")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_start_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_start( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.UpdateRun]: - """Starts an UpdateRun. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_run_name: The name of the UpdateRun resource. Required. - :type update_run_name: str - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :return: An instance of AsyncLROPoller that returns either UpdateRun or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2023_10_15.models.UpdateRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-10-15")) - cls: ClsType[_models.UpdateRun] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._start_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - if_match=if_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("UpdateRun", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.UpdateRun].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.UpdateRun]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _stop_initial( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-10-15")) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_stop_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_stop( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.UpdateRun]: - """Stops an UpdateRun. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_run_name: The name of the UpdateRun resource. Required. - :type update_run_name: str - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :return: An instance of AsyncLROPoller that returns either UpdateRun or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2023_10_15.models.UpdateRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-10-15")) - cls: ClsType[_models.UpdateRun] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._stop_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - if_match=if_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("UpdateRun", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.UpdateRun].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.UpdateRun]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/models/__init__.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/models/__init__.py deleted file mode 100644 index 3429b2ba846f9..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/models/__init__.py +++ /dev/null @@ -1,115 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._models_py3 import ErrorAdditionalInfo -from ._models_py3 import ErrorDetail -from ._models_py3 import ErrorResponse -from ._models_py3 import Fleet -from ._models_py3 import FleetCredentialResult -from ._models_py3 import FleetCredentialResults -from ._models_py3 import FleetListResult -from ._models_py3 import FleetMember -from ._models_py3 import FleetMemberListResult -from ._models_py3 import FleetMemberUpdate -from ._models_py3 import FleetPatch -from ._models_py3 import FleetUpdateStrategy -from ._models_py3 import FleetUpdateStrategyListResult -from ._models_py3 import ManagedClusterUpdate -from ._models_py3 import ManagedClusterUpgradeSpec -from ._models_py3 import ManagedServiceIdentity -from ._models_py3 import MemberUpdateStatus -from ._models_py3 import NodeImageSelection -from ._models_py3 import NodeImageSelectionStatus -from ._models_py3 import NodeImageVersion -from ._models_py3 import Operation -from ._models_py3 import OperationDisplay -from ._models_py3 import OperationListResult -from ._models_py3 import ProxyResource -from ._models_py3 import Resource -from ._models_py3 import SystemData -from ._models_py3 import TrackedResource -from ._models_py3 import UpdateGroup -from ._models_py3 import UpdateGroupStatus -from ._models_py3 import UpdateRun -from ._models_py3 import UpdateRunListResult -from ._models_py3 import UpdateRunStatus -from ._models_py3 import UpdateRunStrategy -from ._models_py3 import UpdateStage -from ._models_py3 import UpdateStageStatus -from ._models_py3 import UpdateStatus -from ._models_py3 import UserAssignedIdentity -from ._models_py3 import WaitStatus - -from ._container_service_fleet_mgmt_client_enums import ActionType -from ._container_service_fleet_mgmt_client_enums import CreatedByType -from ._container_service_fleet_mgmt_client_enums import FleetMemberProvisioningState -from ._container_service_fleet_mgmt_client_enums import FleetProvisioningState -from ._container_service_fleet_mgmt_client_enums import FleetUpdateStrategyProvisioningState -from ._container_service_fleet_mgmt_client_enums import ManagedClusterUpgradeType -from ._container_service_fleet_mgmt_client_enums import ManagedServiceIdentityType -from ._container_service_fleet_mgmt_client_enums import NodeImageSelectionType -from ._container_service_fleet_mgmt_client_enums import Origin -from ._container_service_fleet_mgmt_client_enums import UpdateRunProvisioningState -from ._container_service_fleet_mgmt_client_enums import UpdateState -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ErrorAdditionalInfo", - "ErrorDetail", - "ErrorResponse", - "Fleet", - "FleetCredentialResult", - "FleetCredentialResults", - "FleetListResult", - "FleetMember", - "FleetMemberListResult", - "FleetMemberUpdate", - "FleetPatch", - "FleetUpdateStrategy", - "FleetUpdateStrategyListResult", - "ManagedClusterUpdate", - "ManagedClusterUpgradeSpec", - "ManagedServiceIdentity", - "MemberUpdateStatus", - "NodeImageSelection", - "NodeImageSelectionStatus", - "NodeImageVersion", - "Operation", - "OperationDisplay", - "OperationListResult", - "ProxyResource", - "Resource", - "SystemData", - "TrackedResource", - "UpdateGroup", - "UpdateGroupStatus", - "UpdateRun", - "UpdateRunListResult", - "UpdateRunStatus", - "UpdateRunStrategy", - "UpdateStage", - "UpdateStageStatus", - "UpdateStatus", - "UserAssignedIdentity", - "WaitStatus", - "ActionType", - "CreatedByType", - "FleetMemberProvisioningState", - "FleetProvisioningState", - "FleetUpdateStrategyProvisioningState", - "ManagedClusterUpgradeType", - "ManagedServiceIdentityType", - "NodeImageSelectionType", - "Origin", - "UpdateRunProvisioningState", - "UpdateState", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/models/_container_service_fleet_mgmt_client_enums.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/models/_container_service_fleet_mgmt_client_enums.py deleted file mode 100644 index d8b75c1580d44..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/models/_container_service_fleet_mgmt_client_enums.py +++ /dev/null @@ -1,150 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from enum import Enum -from azure.core import CaseInsensitiveEnumMeta - - -class ActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs.""" - - INTERNAL = "Internal" - - -class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of identity that created the resource.""" - - USER = "User" - APPLICATION = "Application" - MANAGED_IDENTITY = "ManagedIdentity" - KEY = "Key" - - -class FleetMemberProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The provisioning state of the last accepted operation.""" - - SUCCEEDED = "Succeeded" - """Resource has been created.""" - FAILED = "Failed" - """Resource creation failed.""" - CANCELED = "Canceled" - """Resource creation was canceled.""" - JOINING = "Joining" - """The provisioning state of a member joining a fleet.""" - LEAVING = "Leaving" - """The provisioning state of a member leaving a fleet.""" - UPDATING = "Updating" - """The provisioning state of a member being updated.""" - - -class FleetProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The provisioning state of the last accepted operation.""" - - SUCCEEDED = "Succeeded" - """Resource has been created.""" - FAILED = "Failed" - """Resource creation failed.""" - CANCELED = "Canceled" - """Resource creation was canceled.""" - CREATING = "Creating" - """The provisioning state of a fleet being created.""" - UPDATING = "Updating" - """The provisioning state of a fleet being updated.""" - DELETING = "Deleting" - """The provisioning state of a fleet being deleted.""" - - -class FleetUpdateStrategyProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The provisioning state of the UpdateStrategy resource.""" - - SUCCEEDED = "Succeeded" - """Resource has been created.""" - FAILED = "Failed" - """Resource creation failed.""" - CANCELED = "Canceled" - """Resource creation was canceled.""" - - -class ManagedClusterUpgradeType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of upgrade to perform when targeting ManagedClusters.""" - - FULL = "Full" - """Full upgrades the control plane and all agent pools of the target ManagedClusters. Requires the - ManagedClusterUpgradeSpec.KubernetesVersion property to be set.""" - NODE_IMAGE_ONLY = "NodeImageOnly" - """NodeImageOnly upgrades only the node images of the target ManagedClusters. Requires the - ManagedClusterUpgradeSpec.KubernetesVersion property to NOT be set.""" - - -class ManagedServiceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of managed service identity (where both SystemAssigned and UserAssigned types are - allowed). - """ - - NONE = "None" - SYSTEM_ASSIGNED = "SystemAssigned" - USER_ASSIGNED = "UserAssigned" - SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned, UserAssigned" - - -class NodeImageSelectionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The node image upgrade type.""" - - LATEST = "Latest" - """Use the latest image version when upgrading nodes. Clusters may use different image versions - (e.g., 'AKSUbuntu-1804gen2containerd-2021.10.12' and 'AKSUbuntu-1804gen2containerd-2021.10.19') - because, for example, the latest available version is different in different regions.""" - CONSISTENT = "Consistent" - """The image versions to upgrade nodes to are selected as described below: for each node pool in - managed clusters affected by the update run, the system selects the latest image version such - that it is available across all other node pools (in all other clusters) of the same image - type. As a result, all node pools of the same image type will be upgraded to the same image - version. For example, if the latest image version for image type 'AKSUbuntu-1804gen2containerd' - is 'AKSUbuntu-1804gen2containerd-2021.10.12' for a node pool in cluster A in region X, and is - 'AKSUbuntu-1804gen2containerd-2021.10.17' for a node pool in cluster B in region Y, the system - will upgrade both node pools to image version 'AKSUbuntu-1804gen2containerd-2021.10.12'.""" - - -class Origin(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit - logs UX. Default value is "user,system". - """ - - USER = "user" - SYSTEM = "system" - USER_SYSTEM = "user,system" - - -class UpdateRunProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The provisioning state of the UpdateRun resource.""" - - SUCCEEDED = "Succeeded" - """Resource has been created.""" - FAILED = "Failed" - """Resource creation failed.""" - CANCELED = "Canceled" - """Resource creation was canceled.""" - - -class UpdateState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The state of the UpdateRun, UpdateStage, UpdateGroup, or MemberUpdate.""" - - NOT_STARTED = "NotStarted" - """The state of an UpdateRun/UpdateStage/UpdateGroup/MemberUpdate that has not been started.""" - RUNNING = "Running" - """The state of an UpdateRun/UpdateStage/UpdateGroup/MemberUpdate that is running.""" - STOPPING = "Stopping" - """The state of an UpdateRun/UpdateStage/UpdateGroup/MemberUpdate that is being stopped.""" - STOPPED = "Stopped" - """The state of an UpdateRun/UpdateStage/UpdateGroup/MemberUpdate that has stopped.""" - SKIPPED = "Skipped" - """The state of an UpdateRun/UpdateStage/UpdateGroup/MemberUpdate that has been skipped.""" - FAILED = "Failed" - """The state of an UpdateRun/UpdateStage/UpdateGroup/MemberUpdate that has failed.""" - COMPLETED = "Completed" - """The state of an UpdateRun/UpdateStage/UpdateGroup/MemberUpdate that has completed.""" diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/models/_models_py3.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/models/_models_py3.py deleted file mode 100644 index b88d13311f717..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/models/_models_py3.py +++ /dev/null @@ -1,1575 +0,0 @@ -# coding=utf-8 -# pylint: disable=too-many-lines -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights 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 Any, Dict, List, Optional, TYPE_CHECKING, Union - -from ... import _serialization - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from .. import models as _models - - -class ErrorAdditionalInfo(_serialization.Model): - """The resource management error additional info. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar type: The additional info type. - :vartype type: str - :ivar info: The additional info. - :vartype info: JSON - """ - - _validation = { - "type": {"readonly": True}, - "info": {"readonly": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "info": {"key": "info", "type": "object"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.type = None - self.info = None - - -class ErrorDetail(_serialization.Model): - """The error detail. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar code: The error code. - :vartype code: str - :ivar message: The error message. - :vartype message: str - :ivar target: The error target. - :vartype target: str - :ivar details: The error details. - :vartype details: list[~azure.mgmt.containerservicefleet.v2023_10_15.models.ErrorDetail] - :ivar additional_info: The error additional info. - :vartype additional_info: - list[~azure.mgmt.containerservicefleet.v2023_10_15.models.ErrorAdditionalInfo] - """ - - _validation = { - "code": {"readonly": True}, - "message": {"readonly": True}, - "target": {"readonly": True}, - "details": {"readonly": True}, - "additional_info": {"readonly": True}, - } - - _attribute_map = { - "code": {"key": "code", "type": "str"}, - "message": {"key": "message", "type": "str"}, - "target": {"key": "target", "type": "str"}, - "details": {"key": "details", "type": "[ErrorDetail]"}, - "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.code = None - self.message = None - self.target = None - self.details = None - self.additional_info = None - - -class ErrorResponse(_serialization.Model): - """Common error response for all Azure Resource Manager APIs to return error details for failed - operations. (This also follows the OData error response format.). - - :ivar error: The error object. - :vartype error: ~azure.mgmt.containerservicefleet.v2023_10_15.models.ErrorDetail - """ - - _attribute_map = { - "error": {"key": "error", "type": "ErrorDetail"}, - } - - def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: Any) -> None: - """ - :keyword error: The error object. - :paramtype error: ~azure.mgmt.containerservicefleet.v2023_10_15.models.ErrorDetail - """ - super().__init__(**kwargs) - self.error = error - - -class Resource(_serialization.Model): - """Common fields that are returned in the response for all Azure Resource Manager resources. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.containerservicefleet.v2023_10_15.models.SystemData - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.system_data = None - - -class TrackedResource(Resource): - """The resource model definition for an Azure Resource Manager tracked top level resource which - has 'tags' and a 'location'. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.containerservicefleet.v2023_10_15.models.SystemData - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "location": {"required": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - } - - def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - """ - super().__init__(**kwargs) - self.tags = tags - self.location = location - - -class Fleet(TrackedResource): - """The Fleet 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 server. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.containerservicefleet.v2023_10_15.models.SystemData - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - :ivar e_tag: If eTag is provided in the response body, it may also be provided as a header per - the normal etag convention. Entity tags are used for comparing two or more entities from the - same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match - (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. - :vartype e_tag: str - :ivar identity: Managed identity. - :vartype identity: ~azure.mgmt.containerservicefleet.v2023_10_15.models.ManagedServiceIdentity - :ivar provisioning_state: The status of the last operation. Known values are: "Succeeded", - "Failed", "Canceled", "Creating", "Updating", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.containerservicefleet.v2023_10_15.models.FleetProvisioningState - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "location": {"required": True}, - "e_tag": {"readonly": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - "e_tag": {"key": "eTag", "type": "str"}, - "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - } - - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - identity: Optional["_models.ManagedServiceIdentity"] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - :keyword identity: Managed identity. - :paramtype identity: - ~azure.mgmt.containerservicefleet.v2023_10_15.models.ManagedServiceIdentity - """ - super().__init__(tags=tags, location=location, **kwargs) - self.e_tag = None - self.identity = identity - self.provisioning_state = None - - -class FleetCredentialResult(_serialization.Model): - """One credential result item. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: The name of the credential. - :vartype name: str - :ivar value: Base64-encoded Kubernetes configuration file. - :vartype value: bytes - """ - - _validation = { - "name": {"readonly": True}, - "value": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "value": {"key": "value", "type": "bytearray"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.value = None - - -class FleetCredentialResults(_serialization.Model): - """The Credential results response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar kubeconfigs: Array of base64-encoded Kubernetes configuration files. - :vartype kubeconfigs: - list[~azure.mgmt.containerservicefleet.v2023_10_15.models.FleetCredentialResult] - """ - - _validation = { - "kubeconfigs": {"readonly": True}, - } - - _attribute_map = { - "kubeconfigs": {"key": "kubeconfigs", "type": "[FleetCredentialResult]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.kubeconfigs = None - - -class FleetListResult(_serialization.Model): - """The response of a Fleet list operation. - - All required parameters must be populated in order to send to server. - - :ivar value: The Fleet items on this page. Required. - :vartype value: list[~azure.mgmt.containerservicefleet.v2023_10_15.models.Fleet] - :ivar next_link: The link to the next page of items. - :vartype next_link: str - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[Fleet]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, *, value: List["_models.Fleet"], next_link: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword value: The Fleet items on this page. Required. - :paramtype value: list[~azure.mgmt.containerservicefleet.v2023_10_15.models.Fleet] - :keyword next_link: The link to the next page of items. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ProxyResource(Resource): - """The resource model definition for a Azure Resource Manager proxy resource. It will not have - tags and a location. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.containerservicefleet.v2023_10_15.models.SystemData - """ - - -class FleetMember(ProxyResource): - """A member of the Fleet. It contains a reference to an existing Kubernetes cluster on Azure. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.containerservicefleet.v2023_10_15.models.SystemData - :ivar e_tag: If eTag is provided in the response body, it may also be provided as a header per - the normal etag convention. Entity tags are used for comparing two or more entities from the - same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match - (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. - :vartype e_tag: str - :ivar cluster_resource_id: The ARM resource id of the cluster that joins the Fleet. Must be a - valid Azure resource id. e.g.: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{clusterName}'. # pylint: disable=line-too-long - :vartype cluster_resource_id: str - :ivar group: The group this member belongs to for multi-cluster update management. - :vartype group: str - :ivar provisioning_state: The status of the last operation. Known values are: "Succeeded", - "Failed", "Canceled", "Joining", "Leaving", and "Updating". - :vartype provisioning_state: str or - ~azure.mgmt.containerservicefleet.v2023_10_15.models.FleetMemberProvisioningState - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "e_tag": {"readonly": True}, - "group": {"max_length": 50, "min_length": 1, "pattern": r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$"}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "e_tag": {"key": "eTag", "type": "str"}, - "cluster_resource_id": {"key": "properties.clusterResourceId", "type": "str"}, - "group": {"key": "properties.group", "type": "str"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - } - - def __init__( - self, *, cluster_resource_id: Optional[str] = None, group: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword cluster_resource_id: The ARM resource id of the cluster that joins the Fleet. Must be - a valid Azure resource id. e.g.: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{clusterName}'. # pylint: disable=line-too-long - :paramtype cluster_resource_id: str - :keyword group: The group this member belongs to for multi-cluster update management. - :paramtype group: str - """ - super().__init__(**kwargs) - self.e_tag = None - self.cluster_resource_id = cluster_resource_id - self.group = group - self.provisioning_state = None - - -class FleetMemberListResult(_serialization.Model): - """The response of a FleetMember list operation. - - All required parameters must be populated in order to send to server. - - :ivar value: The FleetMember items on this page. Required. - :vartype value: list[~azure.mgmt.containerservicefleet.v2023_10_15.models.FleetMember] - :ivar next_link: The link to the next page of items. - :vartype next_link: str - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[FleetMember]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, *, value: List["_models.FleetMember"], next_link: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword value: The FleetMember items on this page. Required. - :paramtype value: list[~azure.mgmt.containerservicefleet.v2023_10_15.models.FleetMember] - :keyword next_link: The link to the next page of items. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class FleetMemberUpdate(_serialization.Model): - """The type used for update operations of the FleetMember. - - :ivar group: The group this member belongs to for multi-cluster update management. - :vartype group: str - """ - - _validation = { - "group": {"max_length": 50, "min_length": 1, "pattern": r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$"}, - } - - _attribute_map = { - "group": {"key": "properties.group", "type": "str"}, - } - - def __init__(self, *, group: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword group: The group this member belongs to for multi-cluster update management. - :paramtype group: str - """ - super().__init__(**kwargs) - self.group = group - - -class FleetPatch(_serialization.Model): - """Properties of a Fleet that can be patched. - - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar identity: Managed identity. - :vartype identity: ~azure.mgmt.containerservicefleet.v2023_10_15.models.ManagedServiceIdentity - """ - - _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, - } - - def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - identity: Optional["_models.ManagedServiceIdentity"] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword identity: Managed identity. - :paramtype identity: - ~azure.mgmt.containerservicefleet.v2023_10_15.models.ManagedServiceIdentity - """ - super().__init__(**kwargs) - self.tags = tags - self.identity = identity - - -class FleetUpdateStrategy(ProxyResource): - """Defines a multi-stage process to perform update operations across members of a Fleet. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.containerservicefleet.v2023_10_15.models.SystemData - :ivar e_tag: If eTag is provided in the response body, it may also be provided as a header per - the normal etag convention. Entity tags are used for comparing two or more entities from the - same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match - (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. - :vartype e_tag: str - :ivar provisioning_state: The provisioning state of the UpdateStrategy resource. Known values - are: "Succeeded", "Failed", and "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.containerservicefleet.v2023_10_15.models.FleetUpdateStrategyProvisioningState - :ivar strategy: Defines the update sequence of the clusters. - :vartype strategy: ~azure.mgmt.containerservicefleet.v2023_10_15.models.UpdateRunStrategy - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "e_tag": {"readonly": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "e_tag": {"key": "eTag", "type": "str"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "strategy": {"key": "properties.strategy", "type": "UpdateRunStrategy"}, - } - - def __init__(self, *, strategy: Optional["_models.UpdateRunStrategy"] = None, **kwargs: Any) -> None: - """ - :keyword strategy: Defines the update sequence of the clusters. - :paramtype strategy: ~azure.mgmt.containerservicefleet.v2023_10_15.models.UpdateRunStrategy - """ - super().__init__(**kwargs) - self.e_tag = None - self.provisioning_state = None - self.strategy = strategy - - -class FleetUpdateStrategyListResult(_serialization.Model): - """The response of a FleetUpdateStrategy list operation. - - All required parameters must be populated in order to send to server. - - :ivar value: The FleetUpdateStrategy items on this page. Required. - :vartype value: list[~azure.mgmt.containerservicefleet.v2023_10_15.models.FleetUpdateStrategy] - :ivar next_link: The link to the next page of items. - :vartype next_link: str - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[FleetUpdateStrategy]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: List["_models.FleetUpdateStrategy"], next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: The FleetUpdateStrategy items on this page. Required. - :paramtype value: - list[~azure.mgmt.containerservicefleet.v2023_10_15.models.FleetUpdateStrategy] - :keyword next_link: The link to the next page of items. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ManagedClusterUpdate(_serialization.Model): - """The update to be applied to the ManagedClusters. - - All required parameters must be populated in order to send to server. - - :ivar upgrade: The upgrade to apply to the ManagedClusters. Required. - :vartype upgrade: - ~azure.mgmt.containerservicefleet.v2023_10_15.models.ManagedClusterUpgradeSpec - :ivar node_image_selection: The node image upgrade to be applied to the target nodes in update - run. - :vartype node_image_selection: - ~azure.mgmt.containerservicefleet.v2023_10_15.models.NodeImageSelection - """ - - _validation = { - "upgrade": {"required": True}, - } - - _attribute_map = { - "upgrade": {"key": "upgrade", "type": "ManagedClusterUpgradeSpec"}, - "node_image_selection": {"key": "nodeImageSelection", "type": "NodeImageSelection"}, - } - - def __init__( - self, - *, - upgrade: "_models.ManagedClusterUpgradeSpec", - node_image_selection: Optional["_models.NodeImageSelection"] = None, - **kwargs: Any - ) -> None: - """ - :keyword upgrade: The upgrade to apply to the ManagedClusters. Required. - :paramtype upgrade: - ~azure.mgmt.containerservicefleet.v2023_10_15.models.ManagedClusterUpgradeSpec - :keyword node_image_selection: The node image upgrade to be applied to the target nodes in - update run. - :paramtype node_image_selection: - ~azure.mgmt.containerservicefleet.v2023_10_15.models.NodeImageSelection - """ - super().__init__(**kwargs) - self.upgrade = upgrade - self.node_image_selection = node_image_selection - - -class ManagedClusterUpgradeSpec(_serialization.Model): - """The upgrade to apply to a ManagedCluster. - - All required parameters must be populated in order to send to server. - - :ivar type: ManagedClusterUpgradeType is the type of upgrade to be applied. Required. Known - values are: "Full" and "NodeImageOnly". - :vartype type: str or - ~azure.mgmt.containerservicefleet.v2023_10_15.models.ManagedClusterUpgradeType - :ivar kubernetes_version: The Kubernetes version to upgrade the member clusters to. - :vartype kubernetes_version: str - """ - - _validation = { - "type": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, - } - - def __init__( - self, - *, - type: Union[str, "_models.ManagedClusterUpgradeType"], - kubernetes_version: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword type: ManagedClusterUpgradeType is the type of upgrade to be applied. Required. Known - values are: "Full" and "NodeImageOnly". - :paramtype type: str or - ~azure.mgmt.containerservicefleet.v2023_10_15.models.ManagedClusterUpgradeType - :keyword kubernetes_version: The Kubernetes version to upgrade the member clusters to. - :paramtype kubernetes_version: str - """ - super().__init__(**kwargs) - self.type = type - self.kubernetes_version = kubernetes_version - - -class ManagedServiceIdentity(_serialization.Model): - """Managed service identity (system assigned and/or user assigned identities). - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar principal_id: The service principal ID of the system assigned identity. This property - will only be provided for a system assigned identity. - :vartype principal_id: str - :ivar tenant_id: The tenant ID of the system assigned identity. This property will only be - provided for a system assigned identity. - :vartype tenant_id: str - :ivar type: Type of managed service identity (where both SystemAssigned and UserAssigned types - are allowed). Required. Known values are: "None", "SystemAssigned", "UserAssigned", and - "SystemAssigned, UserAssigned". - :vartype type: str or - ~azure.mgmt.containerservicefleet.v2023_10_15.models.ManagedServiceIdentityType - :ivar user_assigned_identities: The set of user assigned identities associated with the - resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. # pylint: disable=line-too-long - The dictionary values can be empty objects ({}) in requests. - :vartype user_assigned_identities: dict[str, - ~azure.mgmt.containerservicefleet.v2023_10_15.models.UserAssignedIdentity] - """ - - _validation = { - "principal_id": {"readonly": True}, - "tenant_id": {"readonly": True}, - "type": {"required": True}, - } - - _attribute_map = { - "principal_id": {"key": "principalId", "type": "str"}, - "tenant_id": {"key": "tenantId", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "user_assigned_identities": {"key": "userAssignedIdentities", "type": "{UserAssignedIdentity}"}, - } - - def __init__( - self, - *, - type: Union[str, "_models.ManagedServiceIdentityType"], - user_assigned_identities: Optional[Dict[str, "_models.UserAssignedIdentity"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword type: Type of managed service identity (where both SystemAssigned and UserAssigned - types are allowed). Required. Known values are: "None", "SystemAssigned", "UserAssigned", and - "SystemAssigned, UserAssigned". - :paramtype type: str or - ~azure.mgmt.containerservicefleet.v2023_10_15.models.ManagedServiceIdentityType - :keyword user_assigned_identities: The set of user assigned identities associated with the - resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. # pylint: disable=line-too-long - The dictionary values can be empty objects ({}) in requests. - :paramtype user_assigned_identities: dict[str, - ~azure.mgmt.containerservicefleet.v2023_10_15.models.UserAssignedIdentity] - """ - super().__init__(**kwargs) - self.principal_id = None - self.tenant_id = None - self.type = type - self.user_assigned_identities = user_assigned_identities - - -class MemberUpdateStatus(_serialization.Model): - """The status of a member update operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar status: The status of the MemberUpdate operation. - :vartype status: ~azure.mgmt.containerservicefleet.v2023_10_15.models.UpdateStatus - :ivar name: The name of the FleetMember. - :vartype name: str - :ivar cluster_resource_id: The Azure resource id of the target Kubernetes cluster. - :vartype cluster_resource_id: str - :ivar operation_id: The operation resource id of the latest attempt to perform the operation. - :vartype operation_id: str - :ivar message: The status message after processing the member update operation. - :vartype message: str - """ - - _validation = { - "status": {"readonly": True}, - "name": {"readonly": True}, - "cluster_resource_id": {"readonly": True}, - "operation_id": {"readonly": True}, - "message": {"readonly": True}, - } - - _attribute_map = { - "status": {"key": "status", "type": "UpdateStatus"}, - "name": {"key": "name", "type": "str"}, - "cluster_resource_id": {"key": "clusterResourceId", "type": "str"}, - "operation_id": {"key": "operationId", "type": "str"}, - "message": {"key": "message", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.status = None - self.name = None - self.cluster_resource_id = None - self.operation_id = None - self.message = None - - -class NodeImageSelection(_serialization.Model): - """The node image upgrade to be applied to the target nodes in update run. - - All required parameters must be populated in order to send to server. - - :ivar type: The node image upgrade type. Required. Known values are: "Latest" and "Consistent". - :vartype type: str or - ~azure.mgmt.containerservicefleet.v2023_10_15.models.NodeImageSelectionType - """ - - _validation = { - "type": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - } - - def __init__(self, *, type: Union[str, "_models.NodeImageSelectionType"], **kwargs: Any) -> None: - """ - :keyword type: The node image upgrade type. Required. Known values are: "Latest" and - "Consistent". - :paramtype type: str or - ~azure.mgmt.containerservicefleet.v2023_10_15.models.NodeImageSelectionType - """ - super().__init__(**kwargs) - self.type = type - - -class NodeImageSelectionStatus(_serialization.Model): - """The node image upgrade specs for the update run. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar selected_node_image_versions: The image versions to upgrade the nodes to. - :vartype selected_node_image_versions: - list[~azure.mgmt.containerservicefleet.v2023_10_15.models.NodeImageVersion] - """ - - _validation = { - "selected_node_image_versions": {"readonly": True}, - } - - _attribute_map = { - "selected_node_image_versions": {"key": "selectedNodeImageVersions", "type": "[NodeImageVersion]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.selected_node_image_versions = None - - -class NodeImageVersion(_serialization.Model): - """The node upgrade image version. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar version: The image version to upgrade the nodes to (e.g., - 'AKSUbuntu-1804gen2containerd-2022.12.13'). - :vartype version: str - """ - - _validation = { - "version": {"readonly": True}, - } - - _attribute_map = { - "version": {"key": "version", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.version = None - - -class Operation(_serialization.Model): - """Details of a REST API operation, returned from the Resource Provider Operations API. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: - "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". - :vartype name: str - :ivar is_data_action: Whether the operation applies to data-plane. This is "true" for - data-plane operations and "false" for ARM/control-plane operations. - :vartype is_data_action: bool - :ivar display: Localized display information for this particular operation. - :vartype display: ~azure.mgmt.containerservicefleet.v2023_10_15.models.OperationDisplay - :ivar origin: The intended executor of the operation; as in Resource Based Access Control - (RBAC) and audit logs UX. Default value is "user,system". Known values are: "user", "system", - and "user,system". - :vartype origin: str or ~azure.mgmt.containerservicefleet.v2023_10_15.models.Origin - :ivar action_type: Enum. Indicates the action type. "Internal" refers to actions that are for - internal only APIs. "Internal" - :vartype action_type: str or ~azure.mgmt.containerservicefleet.v2023_10_15.models.ActionType - """ - - _validation = { - "name": {"readonly": True}, - "is_data_action": {"readonly": True}, - "origin": {"readonly": True}, - "action_type": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "is_data_action": {"key": "isDataAction", "type": "bool"}, - "display": {"key": "display", "type": "OperationDisplay"}, - "origin": {"key": "origin", "type": "str"}, - "action_type": {"key": "actionType", "type": "str"}, - } - - def __init__(self, *, display: Optional["_models.OperationDisplay"] = None, **kwargs: Any) -> None: - """ - :keyword display: Localized display information for this particular operation. - :paramtype display: ~azure.mgmt.containerservicefleet.v2023_10_15.models.OperationDisplay - """ - super().__init__(**kwargs) - self.name = None - self.is_data_action = None - self.display = display - self.origin = None - self.action_type = None - - -class OperationDisplay(_serialization.Model): - """Localized display information for this particular operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provider: The localized friendly form of the resource provider name, e.g. "Microsoft - Monitoring Insights" or "Microsoft Compute". - :vartype provider: str - :ivar resource: The localized friendly name of the resource type related to this operation. - E.g. "Virtual Machines" or "Job Schedule Collections". - :vartype resource: str - :ivar operation: The concise, localized friendly name for the operation; suitable for - dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual Machine". - :vartype operation: str - :ivar description: The short, localized friendly description of the operation; suitable for - tool tips and detailed views. - :vartype description: str - """ - - _validation = { - "provider": {"readonly": True}, - "resource": {"readonly": True}, - "operation": {"readonly": True}, - "description": {"readonly": True}, - } - - _attribute_map = { - "provider": {"key": "provider", "type": "str"}, - "resource": {"key": "resource", "type": "str"}, - "operation": {"key": "operation", "type": "str"}, - "description": {"key": "description", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.provider = None - self.resource = None - self.operation = None - self.description = None - - -class OperationListResult(_serialization.Model): - """A list of REST API operations supported by an Azure Resource Provider. It contains an URL link - to get the next set of results. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of operations supported by the resource provider. - :vartype value: list[~azure.mgmt.containerservicefleet.v2023_10_15.models.Operation] - :ivar next_link: URL to get the next set of operation list results (if there are any). - :vartype next_link: str - """ - - _validation = { - "value": {"readonly": True}, - "next_link": {"readonly": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[Operation]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.value = None - self.next_link = None - - -class SystemData(_serialization.Model): - """Metadata pertaining to creation and last modification of the resource. - - :ivar created_by: The identity that created the resource. - :vartype created_by: str - :ivar created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", and "Key". - :vartype created_by_type: str or - ~azure.mgmt.containerservicefleet.v2023_10_15.models.CreatedByType - :ivar created_at: The timestamp of resource creation (UTC). - :vartype created_at: ~datetime.datetime - :ivar last_modified_by: The identity that last modified the resource. - :vartype last_modified_by: str - :ivar last_modified_by_type: The type of identity that last modified the resource. Known values - are: "User", "Application", "ManagedIdentity", and "Key". - :vartype last_modified_by_type: str or - ~azure.mgmt.containerservicefleet.v2023_10_15.models.CreatedByType - :ivar last_modified_at: The timestamp of resource last modification (UTC). - :vartype last_modified_at: ~datetime.datetime - """ - - _attribute_map = { - "created_by": {"key": "createdBy", "type": "str"}, - "created_by_type": {"key": "createdByType", "type": "str"}, - "created_at": {"key": "createdAt", "type": "iso-8601"}, - "last_modified_by": {"key": "lastModifiedBy", "type": "str"}, - "last_modified_by_type": {"key": "lastModifiedByType", "type": "str"}, - "last_modified_at": {"key": "lastModifiedAt", "type": "iso-8601"}, - } - - def __init__( - self, - *, - created_by: Optional[str] = None, - created_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, - created_at: Optional[datetime.datetime] = None, - last_modified_by: Optional[str] = None, - last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, - last_modified_at: Optional[datetime.datetime] = None, - **kwargs: Any - ) -> None: - """ - :keyword created_by: The identity that created the resource. - :paramtype created_by: str - :keyword created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", and "Key". - :paramtype created_by_type: str or - ~azure.mgmt.containerservicefleet.v2023_10_15.models.CreatedByType - :keyword created_at: The timestamp of resource creation (UTC). - :paramtype created_at: ~datetime.datetime - :keyword last_modified_by: The identity that last modified the resource. - :paramtype last_modified_by: str - :keyword last_modified_by_type: The type of identity that last modified the resource. Known - values are: "User", "Application", "ManagedIdentity", and "Key". - :paramtype last_modified_by_type: str or - ~azure.mgmt.containerservicefleet.v2023_10_15.models.CreatedByType - :keyword last_modified_at: The timestamp of resource last modification (UTC). - :paramtype last_modified_at: ~datetime.datetime - """ - super().__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 UpdateGroup(_serialization.Model): - """A group to be updated. - - All required parameters must be populated in order to send to server. - - :ivar name: Name of the group. - It must match a group name of an existing fleet member. Required. - :vartype name: str - """ - - _validation = { - "name": {"required": True, "max_length": 50, "min_length": 1, "pattern": r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$"}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - } - - def __init__(self, *, name: str, **kwargs: Any) -> None: - """ - :keyword name: Name of the group. - It must match a group name of an existing fleet member. Required. - :paramtype name: str - """ - super().__init__(**kwargs) - self.name = name - - -class UpdateGroupStatus(_serialization.Model): - """The status of a UpdateGroup. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar status: The status of the UpdateGroup. - :vartype status: ~azure.mgmt.containerservicefleet.v2023_10_15.models.UpdateStatus - :ivar name: The name of the UpdateGroup. - :vartype name: str - :ivar members: The list of member this UpdateGroup updates. - :vartype members: list[~azure.mgmt.containerservicefleet.v2023_10_15.models.MemberUpdateStatus] - """ - - _validation = { - "status": {"readonly": True}, - "name": {"readonly": True}, - "members": {"readonly": True}, - } - - _attribute_map = { - "status": {"key": "status", "type": "UpdateStatus"}, - "name": {"key": "name", "type": "str"}, - "members": {"key": "members", "type": "[MemberUpdateStatus]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.status = None - self.name = None - self.members = None - - -class UpdateRun(ProxyResource): - """A multi-stage process to perform update operations across members of a Fleet. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.containerservicefleet.v2023_10_15.models.SystemData - :ivar e_tag: If eTag is provided in the response body, it may also be provided as a header per - the normal etag convention. Entity tags are used for comparing two or more entities from the - same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match - (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. - :vartype e_tag: str - :ivar provisioning_state: The provisioning state of the UpdateRun resource. Known values are: - "Succeeded", "Failed", and "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.containerservicefleet.v2023_10_15.models.UpdateRunProvisioningState - :ivar update_strategy_id: The resource id of the FleetUpdateStrategy resource to reference. - - When creating a new run, there are three ways to define a strategy for the run: - - - #. Define a new strategy in place: Set the "strategy" field. - #. Use an existing strategy: Set the "updateStrategyId" field. (since 2023-08-15-preview) - #. Use the default strategy to update all the members one by one: Leave both - "updateStrategyId" and "strategy" unset. (since 2023-08-15-preview) - - Setting both "updateStrategyId" and "strategy" is invalid. - - UpdateRuns created by "updateStrategyId" snapshot the referenced UpdateStrategy at the time of - creation and store it in the "strategy" field. - Subsequent changes to the referenced FleetUpdateStrategy resource do not propagate. - UpdateRunStrategy changes can be made directly on the "strategy" field before launching the - UpdateRun. - :vartype update_strategy_id: str - :ivar strategy: The strategy defines the order in which the clusters will be updated. - If not set, all members will be updated sequentially. The UpdateRun status will show a single - UpdateStage and a single UpdateGroup targeting all members. - The strategy of the UpdateRun can be modified until the run is started. - :vartype strategy: ~azure.mgmt.containerservicefleet.v2023_10_15.models.UpdateRunStrategy - :ivar managed_cluster_update: The update to be applied to all clusters in the UpdateRun. The - managedClusterUpdate can be modified until the run is started. - :vartype managed_cluster_update: - ~azure.mgmt.containerservicefleet.v2023_10_15.models.ManagedClusterUpdate - :ivar status: The status of the UpdateRun. - :vartype status: ~azure.mgmt.containerservicefleet.v2023_10_15.models.UpdateRunStatus - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "e_tag": {"readonly": True}, - "provisioning_state": {"readonly": True}, - "status": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "e_tag": {"key": "eTag", "type": "str"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "update_strategy_id": {"key": "properties.updateStrategyId", "type": "str"}, - "strategy": {"key": "properties.strategy", "type": "UpdateRunStrategy"}, - "managed_cluster_update": {"key": "properties.managedClusterUpdate", "type": "ManagedClusterUpdate"}, - "status": {"key": "properties.status", "type": "UpdateRunStatus"}, - } - - def __init__( - self, - *, - update_strategy_id: Optional[str] = None, - strategy: Optional["_models.UpdateRunStrategy"] = None, - managed_cluster_update: Optional["_models.ManagedClusterUpdate"] = None, - **kwargs: Any - ) -> None: - """ - :keyword update_strategy_id: The resource id of the FleetUpdateStrategy resource to reference. - - When creating a new run, there are three ways to define a strategy for the run: - - - #. Define a new strategy in place: Set the "strategy" field. - #. Use an existing strategy: Set the "updateStrategyId" field. (since 2023-08-15-preview) - #. Use the default strategy to update all the members one by one: Leave both - "updateStrategyId" and "strategy" unset. (since 2023-08-15-preview) - - Setting both "updateStrategyId" and "strategy" is invalid. - - UpdateRuns created by "updateStrategyId" snapshot the referenced UpdateStrategy at the time of - creation and store it in the "strategy" field. - Subsequent changes to the referenced FleetUpdateStrategy resource do not propagate. - UpdateRunStrategy changes can be made directly on the "strategy" field before launching the - UpdateRun. - :paramtype update_strategy_id: str - :keyword strategy: The strategy defines the order in which the clusters will be updated. - If not set, all members will be updated sequentially. The UpdateRun status will show a single - UpdateStage and a single UpdateGroup targeting all members. - The strategy of the UpdateRun can be modified until the run is started. - :paramtype strategy: ~azure.mgmt.containerservicefleet.v2023_10_15.models.UpdateRunStrategy - :keyword managed_cluster_update: The update to be applied to all clusters in the UpdateRun. The - managedClusterUpdate can be modified until the run is started. - :paramtype managed_cluster_update: - ~azure.mgmt.containerservicefleet.v2023_10_15.models.ManagedClusterUpdate - """ - super().__init__(**kwargs) - self.e_tag = None - self.provisioning_state = None - self.update_strategy_id = update_strategy_id - self.strategy = strategy - self.managed_cluster_update = managed_cluster_update - self.status = None - - -class UpdateRunListResult(_serialization.Model): - """The response of a UpdateRun list operation. - - All required parameters must be populated in order to send to server. - - :ivar value: The UpdateRun items on this page. Required. - :vartype value: list[~azure.mgmt.containerservicefleet.v2023_10_15.models.UpdateRun] - :ivar next_link: The link to the next page of items. - :vartype next_link: str - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[UpdateRun]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, *, value: List["_models.UpdateRun"], next_link: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword value: The UpdateRun items on this page. Required. - :paramtype value: list[~azure.mgmt.containerservicefleet.v2023_10_15.models.UpdateRun] - :keyword next_link: The link to the next page of items. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class UpdateRunStatus(_serialization.Model): - """The status of a UpdateRun. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar status: The status of the UpdateRun. - :vartype status: ~azure.mgmt.containerservicefleet.v2023_10_15.models.UpdateStatus - :ivar stages: The stages composing an update run. Stages are run sequentially withing an - UpdateRun. - :vartype stages: list[~azure.mgmt.containerservicefleet.v2023_10_15.models.UpdateStageStatus] - :ivar node_image_selection: The node image upgrade specs for the update run. It is only set in - update run when ``NodeImageSelection.type`` is ``Consistent``. - :vartype node_image_selection: - ~azure.mgmt.containerservicefleet.v2023_10_15.models.NodeImageSelectionStatus - """ - - _validation = { - "status": {"readonly": True}, - "stages": {"readonly": True}, - "node_image_selection": {"readonly": True}, - } - - _attribute_map = { - "status": {"key": "status", "type": "UpdateStatus"}, - "stages": {"key": "stages", "type": "[UpdateStageStatus]"}, - "node_image_selection": {"key": "nodeImageSelection", "type": "NodeImageSelectionStatus"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.status = None - self.stages = None - self.node_image_selection = None - - -class UpdateRunStrategy(_serialization.Model): - """Defines the update sequence of the clusters via stages and groups. - - Stages within a run are executed sequentially one after another. - Groups within a stage are executed in parallel. - Member clusters within a group are updated sequentially one after another. - - A valid strategy contains no duplicate groups within or across stages. - - All required parameters must be populated in order to send to server. - - :ivar stages: The list of stages that compose this update run. Min size: 1. Required. - :vartype stages: list[~azure.mgmt.containerservicefleet.v2023_10_15.models.UpdateStage] - """ - - _validation = { - "stages": {"required": True}, - } - - _attribute_map = { - "stages": {"key": "stages", "type": "[UpdateStage]"}, - } - - def __init__(self, *, stages: List["_models.UpdateStage"], **kwargs: Any) -> None: - """ - :keyword stages: The list of stages that compose this update run. Min size: 1. Required. - :paramtype stages: list[~azure.mgmt.containerservicefleet.v2023_10_15.models.UpdateStage] - """ - super().__init__(**kwargs) - self.stages = stages - - -class UpdateStage(_serialization.Model): - """Defines a stage which contains the groups to update and the steps to take (e.g., wait for a - time period) before starting the next stage. - - All required parameters must be populated in order to send to server. - - :ivar name: The name of the stage. Must be unique within the UpdateRun. Required. - :vartype name: str - :ivar groups: Defines the groups to be executed in parallel in this stage. Duplicate groups are - not allowed. Min size: 1. - :vartype groups: list[~azure.mgmt.containerservicefleet.v2023_10_15.models.UpdateGroup] - :ivar after_stage_wait_in_seconds: The time in seconds to wait at the end of this stage before - starting the next one. Defaults to 0 seconds if unspecified. - :vartype after_stage_wait_in_seconds: int - """ - - _validation = { - "name": {"required": True, "max_length": 50, "min_length": 1, "pattern": r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$"}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "groups": {"key": "groups", "type": "[UpdateGroup]"}, - "after_stage_wait_in_seconds": {"key": "afterStageWaitInSeconds", "type": "int"}, - } - - def __init__( - self, - *, - name: str, - groups: Optional[List["_models.UpdateGroup"]] = None, - after_stage_wait_in_seconds: Optional[int] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: The name of the stage. Must be unique within the UpdateRun. Required. - :paramtype name: str - :keyword groups: Defines the groups to be executed in parallel in this stage. Duplicate groups - are not allowed. Min size: 1. - :paramtype groups: list[~azure.mgmt.containerservicefleet.v2023_10_15.models.UpdateGroup] - :keyword after_stage_wait_in_seconds: The time in seconds to wait at the end of this stage - before starting the next one. Defaults to 0 seconds if unspecified. - :paramtype after_stage_wait_in_seconds: int - """ - super().__init__(**kwargs) - self.name = name - self.groups = groups - self.after_stage_wait_in_seconds = after_stage_wait_in_seconds - - -class UpdateStageStatus(_serialization.Model): - """The status of a UpdateStage. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar status: The status of the UpdateStage. - :vartype status: ~azure.mgmt.containerservicefleet.v2023_10_15.models.UpdateStatus - :ivar name: The name of the UpdateStage. - :vartype name: str - :ivar groups: The list of groups to be updated as part of this UpdateStage. - :vartype groups: list[~azure.mgmt.containerservicefleet.v2023_10_15.models.UpdateGroupStatus] - :ivar after_stage_wait_status: The status of the wait period configured on the UpdateStage. - :vartype after_stage_wait_status: - ~azure.mgmt.containerservicefleet.v2023_10_15.models.WaitStatus - """ - - _validation = { - "status": {"readonly": True}, - "name": {"readonly": True}, - "groups": {"readonly": True}, - "after_stage_wait_status": {"readonly": True}, - } - - _attribute_map = { - "status": {"key": "status", "type": "UpdateStatus"}, - "name": {"key": "name", "type": "str"}, - "groups": {"key": "groups", "type": "[UpdateGroupStatus]"}, - "after_stage_wait_status": {"key": "afterStageWaitStatus", "type": "WaitStatus"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.status = None - self.name = None - self.groups = None - self.after_stage_wait_status = None - - -class UpdateStatus(_serialization.Model): - """The status for an operation or group of operations. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar start_time: The time the operation or group was started. - :vartype start_time: ~datetime.datetime - :ivar completed_time: The time the operation or group was completed. - :vartype completed_time: ~datetime.datetime - :ivar state: The State of the operation or group. Known values are: "NotStarted", "Running", - "Stopping", "Stopped", "Skipped", "Failed", and "Completed". - :vartype state: str or ~azure.mgmt.containerservicefleet.v2023_10_15.models.UpdateState - :ivar error: The error details when a failure is encountered. - :vartype error: ~azure.mgmt.containerservicefleet.v2023_10_15.models.ErrorDetail - """ - - _validation = { - "start_time": {"readonly": True}, - "completed_time": {"readonly": True}, - "state": {"readonly": True}, - "error": {"readonly": True}, - } - - _attribute_map = { - "start_time": {"key": "startTime", "type": "iso-8601"}, - "completed_time": {"key": "completedTime", "type": "iso-8601"}, - "state": {"key": "state", "type": "str"}, - "error": {"key": "error", "type": "ErrorDetail"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.start_time = None - self.completed_time = None - self.state = None - self.error = None - - -class UserAssignedIdentity(_serialization.Model): - """User assigned identity properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar principal_id: The principal ID of the assigned identity. - :vartype principal_id: str - :ivar client_id: The client ID of the assigned identity. - :vartype client_id: str - """ - - _validation = { - "principal_id": {"readonly": True}, - "client_id": {"readonly": True}, - } - - _attribute_map = { - "principal_id": {"key": "principalId", "type": "str"}, - "client_id": {"key": "clientId", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.principal_id = None - self.client_id = None - - -class WaitStatus(_serialization.Model): - """The status of the wait duration. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar status: The status of the wait duration. - :vartype status: ~azure.mgmt.containerservicefleet.v2023_10_15.models.UpdateStatus - :ivar wait_duration_in_seconds: The wait duration configured in seconds. - :vartype wait_duration_in_seconds: int - """ - - _validation = { - "status": {"readonly": True}, - "wait_duration_in_seconds": {"readonly": True}, - } - - _attribute_map = { - "status": {"key": "status", "type": "UpdateStatus"}, - "wait_duration_in_seconds": {"key": "waitDurationInSeconds", "type": "int"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.status = None - self.wait_duration_in_seconds = None diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/models/_patch.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/models/_patch.py deleted file mode 100644 index f7dd32510333d..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/models/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/operations/__init__.py deleted file mode 100644 index 2233c34e005ae..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/operations/__init__.py +++ /dev/null @@ -1,27 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._operations import Operations -from ._fleets_operations import FleetsOperations -from ._fleet_members_operations import FleetMembersOperations -from ._update_runs_operations import UpdateRunsOperations -from ._fleet_update_strategies_operations import FleetUpdateStrategiesOperations - -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "Operations", - "FleetsOperations", - "FleetMembersOperations", - "UpdateRunsOperations", - "FleetUpdateStrategiesOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/operations/_fleet_members_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/operations/_fleet_members_operations.py deleted file mode 100644 index dab3b680fc0b9..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/operations/_fleet_members_operations.py +++ /dev/null @@ -1,1058 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_fleet_request( - resource_group_name: str, fleet_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-15")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, fleet_name: str, fleet_member_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-15")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - "fleetMemberName": _SERIALIZER.url( - "fleet_member_name", - fleet_member_name, - "str", - max_length=50, - min_length=1, - pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_request( - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-15")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - "fleetMemberName": _SERIALIZER.url( - "fleet_member_name", - fleet_member_name, - "str", - max_length=50, - min_length=1, - pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if if_none_match is not None: - _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-15")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - "fleetMemberName": _SERIALIZER.url( - "fleet_member_name", - fleet_member_name, - "str", - max_length=50, - min_length=1, - pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-15")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - "fleetMemberName": _SERIALIZER.url( - "fleet_member_name", - fleet_member_name, - "str", - max_length=50, - min_length=1, - pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -class FleetMembersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.containerservicefleet.v2023_10_15.ContainerServiceFleetMgmtClient`'s - :attr:`fleet_members` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_by_fleet( - self, resource_group_name: str, fleet_name: str, **kwargs: Any - ) -> Iterable["_models.FleetMember"]: - """List FleetMember resources by Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :return: An iterator like instance of either FleetMember or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservicefleet.v2023_10_15.models.FleetMember] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-10-15")) - cls: ClsType[_models.FleetMemberListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_fleet_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("FleetMemberListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get( - self, resource_group_name: str, fleet_name: str, fleet_member_name: str, **kwargs: Any - ) -> _models.FleetMember: - """Get a FleetMember. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :return: FleetMember or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2023_10_15.models.FleetMember - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-10-15")) - cls: ClsType[_models.FleetMember] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - fleet_member_name=fleet_member_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("FleetMember", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_initial( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - resource: Union[_models.FleetMember, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-10-15")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "FleetMember") - - _request = build_create_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - fleet_member_name=fleet_member_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - resource: _models.FleetMember, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.FleetMember]: - """Create a FleetMember. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :param resource: Resource create parameters. Required. - :type resource: ~azure.mgmt.containerservicefleet.v2023_10_15.models.FleetMember - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either FleetMember or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2023_10_15.models.FleetMember] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - resource: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.FleetMember]: - """Create a FleetMember. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :param resource: Resource create parameters. Required. - :type resource: IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either FleetMember or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2023_10_15.models.FleetMember] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - resource: Union[_models.FleetMember, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[_models.FleetMember]: - """Create a FleetMember. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :param resource: Resource create parameters. Is either a FleetMember type or a IO[bytes] type. - Required. - :type resource: ~azure.mgmt.containerservicefleet.v2023_10_15.models.FleetMember or IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :return: An instance of LROPoller that returns either FleetMember or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2023_10_15.models.FleetMember] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-10-15")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FleetMember] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - fleet_member_name=fleet_member_name, - resource=resource, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FleetMember", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.FleetMember].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.FleetMember]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_initial( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - properties: Union[_models.FleetMemberUpdate, IO[bytes]], - if_match: Optional[str] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-10-15")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties - else: - _json = self._serialize.body(properties, "FleetMemberUpdate") - - _request = build_update_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - fleet_member_name=fleet_member_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - properties: _models.FleetMemberUpdate, - if_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.FleetMember]: - """Update a FleetMember. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :param properties: The resource properties to be updated. Required. - :type properties: ~azure.mgmt.containerservicefleet.v2023_10_15.models.FleetMemberUpdate - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either FleetMember or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2023_10_15.models.FleetMember] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - properties: IO[bytes], - if_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.FleetMember]: - """Update a FleetMember. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :param properties: The resource properties to be updated. Required. - :type properties: IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either FleetMember or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2023_10_15.models.FleetMember] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - properties: Union[_models.FleetMemberUpdate, IO[bytes]], - if_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[_models.FleetMember]: - """Update a FleetMember. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :param properties: The resource properties to be updated. Is either a FleetMemberUpdate type or - a IO[bytes] type. Required. - :type properties: ~azure.mgmt.containerservicefleet.v2023_10_15.models.FleetMemberUpdate or - IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :return: An instance of LROPoller that returns either FleetMember or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2023_10_15.models.FleetMember] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-10-15")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FleetMember] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - fleet_member_name=fleet_member_name, - properties=properties, - if_match=if_match, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FleetMember", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.FleetMember].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.FleetMember]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-10-15")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - fleet_member_name=fleet_member_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[None]: - """Delete a FleetMember. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-10-15")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - fleet_member_name=fleet_member_name, - if_match=if_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/operations/_fleet_update_strategies_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/operations/_fleet_update_strategies_operations.py deleted file mode 100644 index 4370980932d09..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/operations/_fleet_update_strategies_operations.py +++ /dev/null @@ -1,774 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_fleet_request( - resource_group_name: str, fleet_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-15")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateStrategies", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, fleet_name: str, update_strategy_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-15")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateStrategies/{updateStrategyName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - "updateStrategyName": _SERIALIZER.url( - "update_strategy_name", - update_strategy_name, - "str", - max_length=50, - min_length=1, - pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - fleet_name: str, - update_strategy_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-15")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateStrategies/{updateStrategyName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - "updateStrategyName": _SERIALIZER.url( - "update_strategy_name", - update_strategy_name, - "str", - max_length=50, - min_length=1, - pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if if_none_match is not None: - _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - fleet_name: str, - update_strategy_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-15")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateStrategies/{updateStrategyName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - "updateStrategyName": _SERIALIZER.url( - "update_strategy_name", - update_strategy_name, - "str", - max_length=50, - min_length=1, - pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -class FleetUpdateStrategiesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.containerservicefleet.v2023_10_15.ContainerServiceFleetMgmtClient`'s - :attr:`fleet_update_strategies` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_by_fleet( - self, resource_group_name: str, fleet_name: str, **kwargs: Any - ) -> Iterable["_models.FleetUpdateStrategy"]: - """List FleetUpdateStrategy resources by Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :return: An iterator like instance of either FleetUpdateStrategy or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservicefleet.v2023_10_15.models.FleetUpdateStrategy] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-10-15")) - cls: ClsType[_models.FleetUpdateStrategyListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_fleet_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("FleetUpdateStrategyListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get( - self, resource_group_name: str, fleet_name: str, update_strategy_name: str, **kwargs: Any - ) -> _models.FleetUpdateStrategy: - """Get a FleetUpdateStrategy. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_strategy_name: The name of the UpdateStrategy resource. Required. - :type update_strategy_name: str - :return: FleetUpdateStrategy or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2023_10_15.models.FleetUpdateStrategy - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-10-15")) - cls: ClsType[_models.FleetUpdateStrategy] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_strategy_name=update_strategy_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("FleetUpdateStrategy", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - fleet_name: str, - update_strategy_name: str, - resource: Union[_models.FleetUpdateStrategy, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-10-15")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "FleetUpdateStrategy") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_strategy_name=update_strategy_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - update_strategy_name: str, - resource: _models.FleetUpdateStrategy, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.FleetUpdateStrategy]: - """Create a FleetUpdateStrategy. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_strategy_name: The name of the UpdateStrategy resource. Required. - :type update_strategy_name: str - :param resource: Resource create parameters. Required. - :type resource: ~azure.mgmt.containerservicefleet.v2023_10_15.models.FleetUpdateStrategy - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either FleetUpdateStrategy or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2023_10_15.models.FleetUpdateStrategy] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - update_strategy_name: str, - resource: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.FleetUpdateStrategy]: - """Create a FleetUpdateStrategy. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_strategy_name: The name of the UpdateStrategy resource. Required. - :type update_strategy_name: str - :param resource: Resource create parameters. Required. - :type resource: IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either FleetUpdateStrategy or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2023_10_15.models.FleetUpdateStrategy] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - update_strategy_name: str, - resource: Union[_models.FleetUpdateStrategy, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[_models.FleetUpdateStrategy]: - """Create a FleetUpdateStrategy. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_strategy_name: The name of the UpdateStrategy resource. Required. - :type update_strategy_name: str - :param resource: Resource create parameters. Is either a FleetUpdateStrategy type or a - IO[bytes] type. Required. - :type resource: ~azure.mgmt.containerservicefleet.v2023_10_15.models.FleetUpdateStrategy or - IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :return: An instance of LROPoller that returns either FleetUpdateStrategy or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2023_10_15.models.FleetUpdateStrategy] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-10-15")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FleetUpdateStrategy] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_strategy_name=update_strategy_name, - resource=resource, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FleetUpdateStrategy", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.FleetUpdateStrategy].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.FleetUpdateStrategy]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, - resource_group_name: str, - fleet_name: str, - update_strategy_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-10-15")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_strategy_name=update_strategy_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, - resource_group_name: str, - fleet_name: str, - update_strategy_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[None]: - """Delete a FleetUpdateStrategy. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_strategy_name: The name of the UpdateStrategy resource. Required. - :type update_strategy_name: str - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-10-15")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_strategy_name=update_strategy_name, - if_match=if_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/operations/_fleets_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/operations/_fleets_operations.py deleted file mode 100644 index 8b1b052c23159..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/operations/_fleets_operations.py +++ /dev/null @@ -1,1144 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-15")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/fleets") - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-15")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request(resource_group_name: str, fleet_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-15")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - fleet_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-15")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if if_none_match is not None: - _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, fleet_name: str, subscription_id: str, *, if_match: Optional[str] = None, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-15")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, fleet_name: str, subscription_id: str, *, if_match: Optional[str] = None, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-15")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_credentials_request( - resource_group_name: str, fleet_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-15")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/listCredentials", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class FleetsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.containerservicefleet.v2023_10_15.ContainerServiceFleetMgmtClient`'s - :attr:`fleets` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.Fleet"]: - """Lists fleets in the specified subscription. - - :return: An iterator like instance of either Fleet or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservicefleet.v2023_10_15.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-10-15")) - cls: ClsType[_models.FleetListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("FleetListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Fleet"]: - """Lists fleets in the specified subscription and resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :return: An iterator like instance of either Fleet or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservicefleet.v2023_10_15.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-10-15")) - cls: ClsType[_models.FleetListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("FleetListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get(self, resource_group_name: str, fleet_name: str, **kwargs: Any) -> _models.Fleet: - """Gets a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :return: Fleet or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2023_10_15.models.Fleet - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-10-15")) - cls: ClsType[_models.Fleet] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Fleet", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - fleet_name: str, - resource: Union[_models.Fleet, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-10-15")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "Fleet") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - resource: _models.Fleet, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Fleet]: - """Creates or updates a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param resource: Resource create parameters. Required. - :type resource: ~azure.mgmt.containerservicefleet.v2023_10_15.models.Fleet - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either Fleet or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2023_10_15.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - resource: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Fleet]: - """Creates or updates a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param resource: Resource create parameters. Required. - :type resource: IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either Fleet or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2023_10_15.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - resource: Union[_models.Fleet, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[_models.Fleet]: - """Creates or updates a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param resource: Resource create parameters. Is either a Fleet type or a IO[bytes] type. - Required. - :type resource: ~azure.mgmt.containerservicefleet.v2023_10_15.models.Fleet or IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :return: An instance of LROPoller that returns either Fleet or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2023_10_15.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-10-15")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Fleet] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - resource=resource, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Fleet", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.Fleet].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.Fleet]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_initial( - self, - resource_group_name: str, - fleet_name: str, - properties: Union[_models.FleetPatch, IO[bytes]], - if_match: Optional[str] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-10-15")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties - else: - _json = self._serialize.body(properties, "FleetPatch") - - _request = build_update_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - fleet_name: str, - properties: _models.FleetPatch, - if_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Fleet]: - """Update a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param properties: The resource properties to be updated. Required. - :type properties: ~azure.mgmt.containerservicefleet.v2023_10_15.models.FleetPatch - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either Fleet or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2023_10_15.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - fleet_name: str, - properties: IO[bytes], - if_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Fleet]: - """Update a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param properties: The resource properties to be updated. Required. - :type properties: IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either Fleet or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2023_10_15.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - fleet_name: str, - properties: Union[_models.FleetPatch, IO[bytes]], - if_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[_models.Fleet]: - """Update a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param properties: The resource properties to be updated. Is either a FleetPatch type or a - IO[bytes] type. Required. - :type properties: ~azure.mgmt.containerservicefleet.v2023_10_15.models.FleetPatch or IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :return: An instance of LROPoller that returns either Fleet or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2023_10_15.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-10-15")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Fleet] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - properties=properties, - if_match=if_match, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Fleet", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.Fleet].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.Fleet]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, fleet_name: str, if_match: Optional[str] = None, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-10-15")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, resource_group_name: str, fleet_name: str, if_match: Optional[str] = None, **kwargs: Any - ) -> LROPoller[None]: - """Delete a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-10-15")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - if_match=if_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list_credentials( - self, resource_group_name: str, fleet_name: str, **kwargs: Any - ) -> _models.FleetCredentialResults: - """Lists the user credentials of a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :return: FleetCredentialResults or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2023_10_15.models.FleetCredentialResults - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-10-15")) - cls: ClsType[_models.FleetCredentialResults] = kwargs.pop("cls", None) - - _request = build_list_credentials_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("FleetCredentialResults", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/operations/_operations.py deleted file mode 100644 index bad1788d274e7..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/operations/_operations.py +++ /dev/null @@ -1,154 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-15")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.ContainerService/operations") - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class Operations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.containerservicefleet.v2023_10_15.ContainerServiceFleetMgmtClient`'s - :attr:`operations` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: - """List the operations for the provider. - - :return: An iterator like instance of either Operation or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservicefleet.v2023_10_15.models.Operation] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-10-15")) - cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - 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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/operations/_patch.py deleted file mode 100644 index f7dd32510333d..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/operations/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/operations/_update_runs_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/operations/_update_runs_operations.py deleted file mode 100644 index 6d477b8466b9f..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/operations/_update_runs_operations.py +++ /dev/null @@ -1,1142 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_fleet_request( - resource_group_name: str, fleet_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-15")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, fleet_name: str, update_run_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-15")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - "updateRunName": _SERIALIZER.url( - "update_run_name", - update_run_name, - "str", - max_length=50, - min_length=1, - pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - fleet_name: str, - update_run_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-15")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - "updateRunName": _SERIALIZER.url( - "update_run_name", - update_run_name, - "str", - max_length=50, - min_length=1, - pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if if_none_match is not None: - _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - fleet_name: str, - update_run_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-15")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - "updateRunName": _SERIALIZER.url( - "update_run_name", - update_run_name, - "str", - max_length=50, - min_length=1, - pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_start_request( - resource_group_name: str, - fleet_name: str, - update_run_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-15")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName}/start", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - "updateRunName": _SERIALIZER.url( - "update_run_name", - update_run_name, - "str", - max_length=50, - min_length=1, - pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_stop_request( - resource_group_name: str, - fleet_name: str, - update_run_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2023-10-15")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName}/stop", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - "updateRunName": _SERIALIZER.url( - "update_run_name", - update_run_name, - "str", - max_length=50, - min_length=1, - pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class UpdateRunsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.containerservicefleet.v2023_10_15.ContainerServiceFleetMgmtClient`'s - :attr:`update_runs` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_by_fleet(self, resource_group_name: str, fleet_name: str, **kwargs: Any) -> Iterable["_models.UpdateRun"]: - """List UpdateRun resources by Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :return: An iterator like instance of either UpdateRun or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservicefleet.v2023_10_15.models.UpdateRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-10-15")) - cls: ClsType[_models.UpdateRunListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_fleet_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("UpdateRunListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get(self, resource_group_name: str, fleet_name: str, update_run_name: str, **kwargs: Any) -> _models.UpdateRun: - """Get a UpdateRun. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_run_name: The name of the UpdateRun resource. Required. - :type update_run_name: str - :return: UpdateRun or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2023_10_15.models.UpdateRun - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-10-15")) - cls: ClsType[_models.UpdateRun] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("UpdateRun", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - resource: Union[_models.UpdateRun, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-10-15")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "UpdateRun") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - resource: _models.UpdateRun, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.UpdateRun]: - """Create a UpdateRun. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_run_name: The name of the UpdateRun resource. Required. - :type update_run_name: str - :param resource: Resource create parameters. Required. - :type resource: ~azure.mgmt.containerservicefleet.v2023_10_15.models.UpdateRun - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either UpdateRun or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2023_10_15.models.UpdateRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - resource: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.UpdateRun]: - """Create a UpdateRun. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_run_name: The name of the UpdateRun resource. Required. - :type update_run_name: str - :param resource: Resource create parameters. Required. - :type resource: IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either UpdateRun or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2023_10_15.models.UpdateRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - resource: Union[_models.UpdateRun, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[_models.UpdateRun]: - """Create a UpdateRun. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_run_name: The name of the UpdateRun resource. Required. - :type update_run_name: str - :param resource: Resource create parameters. Is either a UpdateRun type or a IO[bytes] type. - Required. - :type resource: ~azure.mgmt.containerservicefleet.v2023_10_15.models.UpdateRun or IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :return: An instance of LROPoller that returns either UpdateRun or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2023_10_15.models.UpdateRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-10-15")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.UpdateRun] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - resource=resource, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("UpdateRun", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.UpdateRun].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.UpdateRun]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-10-15")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[None]: - """Delete a UpdateRun. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_run_name: The name of the UpdateRun resource. Required. - :type update_run_name: str - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-10-15")) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - if_match=if_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _start_initial( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-10-15")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_start_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_start( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[_models.UpdateRun]: - """Starts an UpdateRun. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_run_name: The name of the UpdateRun resource. Required. - :type update_run_name: str - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :return: An instance of LROPoller that returns either UpdateRun or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2023_10_15.models.UpdateRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-10-15")) - cls: ClsType[_models.UpdateRun] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._start_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - if_match=if_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("UpdateRun", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.UpdateRun].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.UpdateRun]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _stop_initial( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-10-15")) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_stop_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_stop( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[_models.UpdateRun]: - """Stops an UpdateRun. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_run_name: The name of the UpdateRun resource. Required. - :type update_run_name: str - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :return: An instance of LROPoller that returns either UpdateRun or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2023_10_15.models.UpdateRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2023-10-15")) - cls: ClsType[_models.UpdateRun] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._stop_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - if_match=if_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("UpdateRun", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.UpdateRun].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.UpdateRun]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/py.typed b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/py.typed deleted file mode 100644 index e5aff4f83af86..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/py.typed +++ /dev/null @@ -1 +0,0 @@ -# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/__init__.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/__init__.py deleted file mode 100644 index 78b8b4b91a49e..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/__init__.py +++ /dev/null @@ -1,26 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._container_service_fleet_mgmt_client import ContainerServiceFleetMgmtClient -from ._version import VERSION - -__version__ = VERSION - -try: - from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ContainerServiceFleetMgmtClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) - -_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/_configuration.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/_configuration.py deleted file mode 100644 index a9013485f6157..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/_configuration.py +++ /dev/null @@ -1,65 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any, TYPE_CHECKING - -from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy - -from ._version import VERSION - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials import TokenCredential - - -class ContainerServiceFleetMgmtClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long - """Configuration for ContainerServiceFleetMgmtClient. - - 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. Required. - :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :keyword api_version: Api Version. Default value is "2024-02-02-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2024-02-02-preview") - - if credential is None: - raise ValueError("Parameter 'credential' must not be None.") - if subscription_id is None: - raise ValueError("Parameter 'subscription_id' must not be None.") - - self.credential = credential - self.subscription_id = subscription_id - self.api_version = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-containerservicefleet/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - 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.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") - if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/_container_service_fleet_mgmt_client.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/_container_service_fleet_mgmt_client.py deleted file mode 100644 index d0c4a930235d1..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/_container_service_fleet_mgmt_client.py +++ /dev/null @@ -1,144 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, TYPE_CHECKING -from typing_extensions import Self - -from azure.core.pipeline import policies -from azure.core.rest import HttpRequest, HttpResponse -from azure.mgmt.core import ARMPipelineClient -from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy - -from . import models as _models -from .._serialization import Deserializer, Serializer -from ._configuration import ContainerServiceFleetMgmtClientConfiguration -from .operations import ( - FleetMembersOperations, - FleetUpdateStrategiesOperations, - FleetsOperations, - Operations, - UpdateRunsOperations, -) - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials import TokenCredential - - -class ContainerServiceFleetMgmtClient: # pylint: disable=client-accepts-api-version-keyword - """Azure Kubernetes Fleet Manager api client. - - :ivar operations: Operations operations - :vartype operations: azure.mgmt.containerservicefleet.v2024_02_02_preview.operations.Operations - :ivar fleets: FleetsOperations operations - :vartype fleets: - azure.mgmt.containerservicefleet.v2024_02_02_preview.operations.FleetsOperations - :ivar fleet_members: FleetMembersOperations operations - :vartype fleet_members: - azure.mgmt.containerservicefleet.v2024_02_02_preview.operations.FleetMembersOperations - :ivar update_runs: UpdateRunsOperations operations - :vartype update_runs: - azure.mgmt.containerservicefleet.v2024_02_02_preview.operations.UpdateRunsOperations - :ivar fleet_update_strategies: FleetUpdateStrategiesOperations operations - :vartype fleet_update_strategies: - azure.mgmt.containerservicefleet.v2024_02_02_preview.operations.FleetUpdateStrategiesOperations - :param credential: Credential needed for the client to connect to Azure. Required. - :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". - :type base_url: str - :keyword api_version: Api Version. Default value is "2024-02-02-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - """ - - def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any - ) -> None: - self._config = ContainerServiceFleetMgmtClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs - ) - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - ARMAutoResourceProviderRegistrationPolicy(), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) - - client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer(client_models) - self._deserialize = Deserializer(client_models) - self._serialize.client_side_validation = False - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize, "2024-02-02-preview" - ) - self.fleets = FleetsOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-02-02-preview" - ) - self.fleet_members = FleetMembersOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-02-02-preview" - ) - self.update_runs = UpdateRunsOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-02-02-preview" - ) - self.fleet_update_strategies = FleetUpdateStrategiesOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-02-02-preview" - ) - - def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.HttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore - - def close(self) -> None: - self._client.close() - - def __enter__(self) -> Self: - self._client.__enter__() - return self - - def __exit__(self, *exc_details: Any) -> None: - self._client.__exit__(*exc_details) diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/_metadata.json b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/_metadata.json deleted file mode 100644 index c8f084156e160..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/_metadata.json +++ /dev/null @@ -1,114 +0,0 @@ -{ - "chosen_version": "2024-02-02-preview", - "total_api_version_list": ["2024-02-02-preview"], - "client": { - "name": "ContainerServiceFleetMgmtClient", - "filename": "_container_service_fleet_mgmt_client", - "description": "Azure Kubernetes Fleet Manager api client.", - "host_value": "\"https://management.azure.com\"", - "parameterized_host_template": null, - "azure_arm": true, - "has_public_lro_operations": true, - "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ContainerServiceFleetMgmtClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ContainerServiceFleetMgmtClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" - }, - "global_parameters": { - "sync": { - "credential": { - "signature": "credential: \"TokenCredential\",", - "description": "Credential needed for the client to connect to Azure. Required.", - "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true, - "method_location": "positional" - }, - "subscription_id": { - "signature": "subscription_id: str,", - "description": "The ID of the target subscription. Required.", - "docstring_type": "str", - "required": true, - "method_location": "positional" - } - }, - "async": { - "credential": { - "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure. Required.", - "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", - "required": true - }, - "subscription_id": { - "signature": "subscription_id: str,", - "description": "The ID of the target subscription. Required.", - "docstring_type": "str", - "required": true - } - }, - "constant": { - }, - "call": "credential, subscription_id", - "service_client_specific": { - "sync": { - "api_version": { - "signature": "api_version: Optional[str]=None,", - "description": "API version to use if no profile is provided, or if missing in profile.", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", - "description": "Service URL", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "profile": { - "signature": "profile: KnownProfiles=KnownProfiles.default,", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false, - "method_location": "positional" - } - }, - "async": { - "api_version": { - "signature": "api_version: Optional[str] = None,", - "description": "API version to use if no profile is provided, or if missing in profile.", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", - "description": "Service URL", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "profile": { - "signature": "profile: KnownProfiles = KnownProfiles.default,", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false, - "method_location": "positional" - } - } - } - }, - "config": { - "credential": true, - "credential_scopes": ["https://management.azure.com/.default"], - "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", - "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", - "sync_imports": "{\"regular\": {\"sdkcore\": {\"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"sdkcore\": {\"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" - }, - "operation_groups": { - "operations": "Operations", - "fleets": "FleetsOperations", - "fleet_members": "FleetMembersOperations", - "update_runs": "UpdateRunsOperations", - "fleet_update_strategies": "FleetUpdateStrategiesOperations" - } -} diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/_patch.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/_patch.py deleted file mode 100644 index f7dd32510333d..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/_version.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/_version.py deleted file mode 100644 index 83f24ab509461..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/_version.py +++ /dev/null @@ -1,9 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -VERSION = "2.1.0" diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/aio/__init__.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/aio/__init__.py deleted file mode 100644 index af1d7b0b47fe9..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/aio/__init__.py +++ /dev/null @@ -1,23 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._container_service_fleet_mgmt_client import ContainerServiceFleetMgmtClient - -try: - from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ContainerServiceFleetMgmtClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) - -_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/aio/_configuration.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/aio/_configuration.py deleted file mode 100644 index b26ac26d42f61..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/aio/_configuration.py +++ /dev/null @@ -1,65 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any, TYPE_CHECKING - -from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy - -from .._version import VERSION - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential - - -class ContainerServiceFleetMgmtClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long - """Configuration for ContainerServiceFleetMgmtClient. - - 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. Required. - :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :keyword api_version: Api Version. Default value is "2024-02-02-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2024-02-02-preview") - - if credential is None: - raise ValueError("Parameter 'credential' must not be None.") - if subscription_id is None: - raise ValueError("Parameter 'subscription_id' must not be None.") - - self.credential = credential - self.subscription_id = subscription_id - self.api_version = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-containerservicefleet/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - 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.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") - if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/aio/_container_service_fleet_mgmt_client.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/aio/_container_service_fleet_mgmt_client.py deleted file mode 100644 index 0bfdb35fdca31..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/aio/_container_service_fleet_mgmt_client.py +++ /dev/null @@ -1,147 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING -from typing_extensions import Self - -from azure.core.pipeline import policies -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.mgmt.core import AsyncARMPipelineClient -from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy - -from .. import models as _models -from ..._serialization import Deserializer, Serializer -from ._configuration import ContainerServiceFleetMgmtClientConfiguration -from .operations import ( - FleetMembersOperations, - FleetUpdateStrategiesOperations, - FleetsOperations, - Operations, - UpdateRunsOperations, -) - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential - - -class ContainerServiceFleetMgmtClient: # pylint: disable=client-accepts-api-version-keyword - """Azure Kubernetes Fleet Manager api client. - - :ivar operations: Operations operations - :vartype operations: - azure.mgmt.containerservicefleet.v2024_02_02_preview.aio.operations.Operations - :ivar fleets: FleetsOperations operations - :vartype fleets: - azure.mgmt.containerservicefleet.v2024_02_02_preview.aio.operations.FleetsOperations - :ivar fleet_members: FleetMembersOperations operations - :vartype fleet_members: - azure.mgmt.containerservicefleet.v2024_02_02_preview.aio.operations.FleetMembersOperations - :ivar update_runs: UpdateRunsOperations operations - :vartype update_runs: - azure.mgmt.containerservicefleet.v2024_02_02_preview.aio.operations.UpdateRunsOperations - :ivar fleet_update_strategies: FleetUpdateStrategiesOperations operations - :vartype fleet_update_strategies: - azure.mgmt.containerservicefleet.v2024_02_02_preview.aio.operations.FleetUpdateStrategiesOperations - :param credential: Credential needed for the client to connect to Azure. Required. - :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". - :type base_url: str - :keyword api_version: Api Version. Default value is "2024-02-02-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - """ - - def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any - ) -> None: - self._config = ContainerServiceFleetMgmtClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs - ) - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - AsyncARMAutoResourceProviderRegistrationPolicy(), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) - - client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer(client_models) - self._deserialize = Deserializer(client_models) - self._serialize.client_side_validation = False - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize, "2024-02-02-preview" - ) - self.fleets = FleetsOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-02-02-preview" - ) - self.fleet_members = FleetMembersOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-02-02-preview" - ) - self.update_runs = UpdateRunsOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-02-02-preview" - ) - self.fleet_update_strategies = FleetUpdateStrategiesOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-02-02-preview" - ) - - def _send_request( - self, request: HttpRequest, *, stream: bool = False, **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = await client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.AsyncHttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore - - async def close(self) -> None: - await self._client.close() - - async def __aenter__(self) -> Self: - await self._client.__aenter__() - return self - - async def __aexit__(self, *exc_details: Any) -> None: - await self._client.__aexit__(*exc_details) diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/aio/_patch.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/aio/_patch.py deleted file mode 100644 index f7dd32510333d..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/aio/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/aio/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/aio/operations/__init__.py deleted file mode 100644 index 2233c34e005ae..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/aio/operations/__init__.py +++ /dev/null @@ -1,27 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._operations import Operations -from ._fleets_operations import FleetsOperations -from ._fleet_members_operations import FleetMembersOperations -from ._update_runs_operations import UpdateRunsOperations -from ._fleet_update_strategies_operations import FleetUpdateStrategiesOperations - -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "Operations", - "FleetsOperations", - "FleetMembersOperations", - "UpdateRunsOperations", - "FleetUpdateStrategiesOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/aio/operations/_fleet_members_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/aio/operations/_fleet_members_operations.py deleted file mode 100644 index e054b83917323..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/aio/operations/_fleet_members_operations.py +++ /dev/null @@ -1,842 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._fleet_members_operations import ( - build_create_request, - build_delete_request, - build_get_request, - build_list_by_fleet_request, - build_update_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class FleetMembersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.containerservicefleet.v2024_02_02_preview.aio.ContainerServiceFleetMgmtClient`'s - :attr:`fleet_members` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_by_fleet( - self, resource_group_name: str, fleet_name: str, **kwargs: Any - ) -> AsyncIterable["_models.FleetMember"]: - """List FleetMember resources by Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :return: An iterator like instance of either FleetMember or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.FleetMember] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-02-02-preview") - ) - cls: ClsType[_models.FleetMemberListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_fleet_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("FleetMemberListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get( - self, resource_group_name: str, fleet_name: str, fleet_member_name: str, **kwargs: Any - ) -> _models.FleetMember: - """Get a FleetMember. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :return: FleetMember or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.FleetMember - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-02-02-preview") - ) - cls: ClsType[_models.FleetMember] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - fleet_member_name=fleet_member_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("FleetMember", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_initial( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - resource: Union[_models.FleetMember, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-02-02-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "FleetMember") - - _request = build_create_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - fleet_member_name=fleet_member_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - resource: _models.FleetMember, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.FleetMember]: - """Create a FleetMember. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :param resource: Resource create parameters. Required. - :type resource: ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.FleetMember - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either FleetMember or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.FleetMember] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - resource: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.FleetMember]: - """Create a FleetMember. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :param resource: Resource create parameters. Required. - :type resource: IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either FleetMember or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.FleetMember] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - resource: Union[_models.FleetMember, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.FleetMember]: - """Create a FleetMember. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :param resource: Resource create parameters. Is either a FleetMember type or a IO[bytes] type. - Required. - :type resource: ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.FleetMember or - IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :return: An instance of AsyncLROPoller that returns either FleetMember or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.FleetMember] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-02-02-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FleetMember] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - fleet_member_name=fleet_member_name, - resource=resource, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FleetMember", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.FleetMember].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.FleetMember]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_initial( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - properties: Union[_models.FleetMemberUpdate, IO[bytes]], - if_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-02-02-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties - else: - _json = self._serialize.body(properties, "FleetMemberUpdate") - - _request = build_update_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - fleet_member_name=fleet_member_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - properties: _models.FleetMemberUpdate, - if_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.FleetMember]: - """Update a FleetMember. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :param properties: The resource properties to be updated. Required. - :type properties: - ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.FleetMemberUpdate - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either FleetMember or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.FleetMember] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - properties: IO[bytes], - if_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.FleetMember]: - """Update a FleetMember. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :param properties: The resource properties to be updated. Required. - :type properties: IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either FleetMember or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.FleetMember] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - properties: Union[_models.FleetMemberUpdate, IO[bytes]], - if_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.FleetMember]: - """Update a FleetMember. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :param properties: The resource properties to be updated. Is either a FleetMemberUpdate type or - a IO[bytes] type. Required. - :type properties: - ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.FleetMemberUpdate or IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :return: An instance of AsyncLROPoller that returns either FleetMember or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.FleetMember] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-02-02-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FleetMember] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - fleet_member_name=fleet_member_name, - properties=properties, - if_match=if_match, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FleetMember", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.FleetMember].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.FleetMember]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-02-02-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - fleet_member_name=fleet_member_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Delete a FleetMember. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-02-02-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - fleet_member_name=fleet_member_name, - if_match=if_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/aio/operations/_fleet_update_strategies_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/aio/operations/_fleet_update_strategies_operations.py deleted file mode 100644 index 103d7082c69e4..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/aio/operations/_fleet_update_strategies_operations.py +++ /dev/null @@ -1,606 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._fleet_update_strategies_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_by_fleet_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class FleetUpdateStrategiesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.containerservicefleet.v2024_02_02_preview.aio.ContainerServiceFleetMgmtClient`'s - :attr:`fleet_update_strategies` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_by_fleet( - self, resource_group_name: str, fleet_name: str, **kwargs: Any - ) -> AsyncIterable["_models.FleetUpdateStrategy"]: - """List FleetUpdateStrategy resources by Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :return: An iterator like instance of either FleetUpdateStrategy or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.FleetUpdateStrategy] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-02-02-preview") - ) - cls: ClsType[_models.FleetUpdateStrategyListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_fleet_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("FleetUpdateStrategyListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get( - self, resource_group_name: str, fleet_name: str, update_strategy_name: str, **kwargs: Any - ) -> _models.FleetUpdateStrategy: - """Get a FleetUpdateStrategy. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_strategy_name: The name of the UpdateStrategy resource. Required. - :type update_strategy_name: str - :return: FleetUpdateStrategy or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.FleetUpdateStrategy - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-02-02-preview") - ) - cls: ClsType[_models.FleetUpdateStrategy] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_strategy_name=update_strategy_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("FleetUpdateStrategy", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - fleet_name: str, - update_strategy_name: str, - resource: Union[_models.FleetUpdateStrategy, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-02-02-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "FleetUpdateStrategy") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_strategy_name=update_strategy_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - update_strategy_name: str, - resource: _models.FleetUpdateStrategy, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.FleetUpdateStrategy]: - """Create a FleetUpdateStrategy. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_strategy_name: The name of the UpdateStrategy resource. Required. - :type update_strategy_name: str - :param resource: Resource create parameters. Required. - :type resource: - ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.FleetUpdateStrategy - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either FleetUpdateStrategy or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.FleetUpdateStrategy] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - update_strategy_name: str, - resource: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.FleetUpdateStrategy]: - """Create a FleetUpdateStrategy. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_strategy_name: The name of the UpdateStrategy resource. Required. - :type update_strategy_name: str - :param resource: Resource create parameters. Required. - :type resource: IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either FleetUpdateStrategy or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.FleetUpdateStrategy] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - update_strategy_name: str, - resource: Union[_models.FleetUpdateStrategy, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.FleetUpdateStrategy]: - """Create a FleetUpdateStrategy. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_strategy_name: The name of the UpdateStrategy resource. Required. - :type update_strategy_name: str - :param resource: Resource create parameters. Is either a FleetUpdateStrategy type or a - IO[bytes] type. Required. - :type resource: - ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.FleetUpdateStrategy or IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :return: An instance of AsyncLROPoller that returns either FleetUpdateStrategy or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.FleetUpdateStrategy] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-02-02-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FleetUpdateStrategy] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_strategy_name=update_strategy_name, - resource=resource, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FleetUpdateStrategy", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.FleetUpdateStrategy].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.FleetUpdateStrategy]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, - resource_group_name: str, - fleet_name: str, - update_strategy_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-02-02-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_strategy_name=update_strategy_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, - resource_group_name: str, - fleet_name: str, - update_strategy_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Delete a FleetUpdateStrategy. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_strategy_name: The name of the UpdateStrategy resource. Required. - :type update_strategy_name: str - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-02-02-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_strategy_name=update_strategy_name, - if_match=if_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/aio/operations/_fleets_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/aio/operations/_fleets_operations.py deleted file mode 100644 index f462ec2077cd8..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/aio/operations/_fleets_operations.py +++ /dev/null @@ -1,926 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._fleets_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_by_resource_group_request, - build_list_by_subscription_request, - build_list_credentials_request, - build_update_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class FleetsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.containerservicefleet.v2024_02_02_preview.aio.ContainerServiceFleetMgmtClient`'s - :attr:`fleets` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.Fleet"]: - """Lists fleets in the specified subscription. - - :return: An iterator like instance of either Fleet or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-02-02-preview") - ) - cls: ClsType[_models.FleetListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("FleetListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace - def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.Fleet"]: - """Lists fleets in the specified subscription and resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :return: An iterator like instance of either Fleet or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-02-02-preview") - ) - cls: ClsType[_models.FleetListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("FleetListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get(self, resource_group_name: str, fleet_name: str, **kwargs: Any) -> _models.Fleet: - """Gets a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :return: Fleet or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.Fleet - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-02-02-preview") - ) - cls: ClsType[_models.Fleet] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Fleet", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - fleet_name: str, - resource: Union[_models.Fleet, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-02-02-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "Fleet") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - resource: _models.Fleet, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.Fleet]: - """Creates or updates a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param resource: Resource create parameters. Required. - :type resource: ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.Fleet - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either Fleet or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - resource: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.Fleet]: - """Creates or updates a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param resource: Resource create parameters. Required. - :type resource: IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either Fleet or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - resource: Union[_models.Fleet, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.Fleet]: - """Creates or updates a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param resource: Resource create parameters. Is either a Fleet type or a IO[bytes] type. - Required. - :type resource: ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.Fleet or IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :return: An instance of AsyncLROPoller that returns either Fleet or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-02-02-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Fleet] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - resource=resource, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Fleet", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.Fleet].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.Fleet]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_initial( - self, - resource_group_name: str, - fleet_name: str, - properties: Union[_models.FleetPatch, IO[bytes]], - if_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-02-02-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties - else: - _json = self._serialize.body(properties, "FleetPatch") - - _request = build_update_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - fleet_name: str, - properties: _models.FleetPatch, - if_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.Fleet]: - """Update a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param properties: The resource properties to be updated. Required. - :type properties: ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.FleetPatch - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either Fleet or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - fleet_name: str, - properties: IO[bytes], - if_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.Fleet]: - """Update a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param properties: The resource properties to be updated. Required. - :type properties: IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either Fleet or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - fleet_name: str, - properties: Union[_models.FleetPatch, IO[bytes]], - if_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.Fleet]: - """Update a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param properties: The resource properties to be updated. Is either a FleetPatch type or a - IO[bytes] type. Required. - :type properties: ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.FleetPatch or - IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :return: An instance of AsyncLROPoller that returns either Fleet or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-02-02-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Fleet] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - properties=properties, - if_match=if_match, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Fleet", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.Fleet].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.Fleet]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, fleet_name: str, if_match: Optional[str] = None, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-02-02-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, fleet_name: str, if_match: Optional[str] = None, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Delete a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-02-02-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - if_match=if_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace_async - async def list_credentials( - self, resource_group_name: str, fleet_name: str, **kwargs: Any - ) -> _models.FleetCredentialResults: - """Lists the user credentials of a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :return: FleetCredentialResults or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.FleetCredentialResults - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-02-02-preview") - ) - cls: ClsType[_models.FleetCredentialResults] = kwargs.pop("cls", None) - - _request = build_list_credentials_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("FleetCredentialResults", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/aio/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/aio/operations/_operations.py deleted file mode 100644 index 2038977552b8f..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/aio/operations/_operations.py +++ /dev/null @@ -1,134 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ...operations._operations import build_list_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class Operations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.containerservicefleet.v2024_02_02_preview.aio.ContainerServiceFleetMgmtClient`'s - :attr:`operations` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: - """List the operations for the provider. - - :return: An iterator like instance of either Operation or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.Operation] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-02-02-preview") - ) - cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("OperationListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/aio/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/aio/operations/_patch.py deleted file mode 100644 index f7dd32510333d..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/aio/operations/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/aio/operations/_update_runs_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/aio/operations/_update_runs_operations.py deleted file mode 100644 index 0b68ce53cb705..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/aio/operations/_update_runs_operations.py +++ /dev/null @@ -1,1126 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._update_runs_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_by_fleet_request, - build_skip_request, - build_start_request, - build_stop_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class UpdateRunsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.containerservicefleet.v2024_02_02_preview.aio.ContainerServiceFleetMgmtClient`'s - :attr:`update_runs` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_by_fleet( - self, resource_group_name: str, fleet_name: str, **kwargs: Any - ) -> AsyncIterable["_models.UpdateRun"]: - """List UpdateRun resources by Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :return: An iterator like instance of either UpdateRun or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.UpdateRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-02-02-preview") - ) - cls: ClsType[_models.UpdateRunListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_fleet_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("UpdateRunListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get( - self, resource_group_name: str, fleet_name: str, update_run_name: str, **kwargs: Any - ) -> _models.UpdateRun: - """Get a UpdateRun. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_run_name: The name of the UpdateRun resource. Required. - :type update_run_name: str - :return: UpdateRun or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.UpdateRun - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-02-02-preview") - ) - cls: ClsType[_models.UpdateRun] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("UpdateRun", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - resource: Union[_models.UpdateRun, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-02-02-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "UpdateRun") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - resource: _models.UpdateRun, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.UpdateRun]: - """Create a UpdateRun. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_run_name: The name of the UpdateRun resource. Required. - :type update_run_name: str - :param resource: Resource create parameters. Required. - :type resource: ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.UpdateRun - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either UpdateRun or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.UpdateRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - resource: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.UpdateRun]: - """Create a UpdateRun. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_run_name: The name of the UpdateRun resource. Required. - :type update_run_name: str - :param resource: Resource create parameters. Required. - :type resource: IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either UpdateRun or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.UpdateRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - resource: Union[_models.UpdateRun, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.UpdateRun]: - """Create a UpdateRun. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_run_name: The name of the UpdateRun resource. Required. - :type update_run_name: str - :param resource: Resource create parameters. Is either a UpdateRun type or a IO[bytes] type. - Required. - :type resource: ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.UpdateRun or - IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :return: An instance of AsyncLROPoller that returns either UpdateRun or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.UpdateRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-02-02-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.UpdateRun] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - resource=resource, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("UpdateRun", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.UpdateRun].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.UpdateRun]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-02-02-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Delete a UpdateRun. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_run_name: The name of the UpdateRun resource. Required. - :type update_run_name: str - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-02-02-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - if_match=if_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _skip_initial( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - body: Union[_models.SkipProperties, IO[bytes]], - if_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-02-02-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _json = self._serialize.body(body, "SkipProperties") - - _request = build_skip_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_skip( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - body: _models.SkipProperties, - if_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.UpdateRun]: - """Skips one or a combination of member/group/stage/afterStageWait(s) of an update run. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_run_name: The name of the UpdateRun resource. Required. - :type update_run_name: str - :param body: The content of the action request. Required. - :type body: ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.SkipProperties - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either UpdateRun or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.UpdateRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_skip( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - body: IO[bytes], - if_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.UpdateRun]: - """Skips one or a combination of member/group/stage/afterStageWait(s) of an update run. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_run_name: The name of the UpdateRun resource. Required. - :type update_run_name: str - :param body: The content of the action request. Required. - :type body: IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either UpdateRun or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.UpdateRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_skip( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - body: Union[_models.SkipProperties, IO[bytes]], - if_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.UpdateRun]: - """Skips one or a combination of member/group/stage/afterStageWait(s) of an update run. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_run_name: The name of the UpdateRun resource. Required. - :type update_run_name: str - :param body: The content of the action request. Is either a SkipProperties type or a IO[bytes] - type. Required. - :type body: ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.SkipProperties or - IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :return: An instance of AsyncLROPoller that returns either UpdateRun or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.UpdateRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-02-02-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.UpdateRun] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._skip_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - body=body, - if_match=if_match, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("UpdateRun", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.UpdateRun].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.UpdateRun]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _start_initial( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-02-02-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_start_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_start( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.UpdateRun]: - """Starts an UpdateRun. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_run_name: The name of the UpdateRun resource. Required. - :type update_run_name: str - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :return: An instance of AsyncLROPoller that returns either UpdateRun or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.UpdateRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-02-02-preview") - ) - cls: ClsType[_models.UpdateRun] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._start_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - if_match=if_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("UpdateRun", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.UpdateRun].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.UpdateRun]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _stop_initial( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-02-02-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_stop_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_stop( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.UpdateRun]: - """Stops an UpdateRun. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_run_name: The name of the UpdateRun resource. Required. - :type update_run_name: str - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :return: An instance of AsyncLROPoller that returns either UpdateRun or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.UpdateRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-02-02-preview") - ) - cls: ClsType[_models.UpdateRun] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._stop_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - if_match=if_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("UpdateRun", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.UpdateRun].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.UpdateRun]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/models/_models_py3.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/models/_models_py3.py deleted file mode 100644 index 8cce79cea8c74..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/models/_models_py3.py +++ /dev/null @@ -1,1805 +0,0 @@ -# coding=utf-8 -# pylint: disable=too-many-lines -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights 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 Any, Dict, List, Optional, TYPE_CHECKING, Union - -from ... import _serialization - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from .. import models as _models - - -class AgentProfile(_serialization.Model): - """Agent profile for the Fleet hub. - - :ivar subnet_id: The ID of the subnet which the Fleet hub node will join on startup. If this is - not specified, a vnet and subnet will be generated and used. - :vartype subnet_id: str - :ivar vm_size: The virtual machine size of the Fleet hub. - :vartype vm_size: str - """ - - _attribute_map = { - "subnet_id": {"key": "subnetId", "type": "str"}, - "vm_size": {"key": "vmSize", "type": "str"}, - } - - def __init__(self, *, subnet_id: Optional[str] = None, vm_size: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword subnet_id: The ID of the subnet which the Fleet hub node will join on startup. If this - is not specified, a vnet and subnet will be generated and used. - :paramtype subnet_id: str - :keyword vm_size: The virtual machine size of the Fleet hub. - :paramtype vm_size: str - """ - super().__init__(**kwargs) - self.subnet_id = subnet_id - self.vm_size = vm_size - - -class APIServerAccessProfile(_serialization.Model): - """Access profile for the Fleet hub API server. - - :ivar enable_private_cluster: Whether to create the Fleet hub as a private cluster or not. - :vartype enable_private_cluster: bool - :ivar enable_vnet_integration: Whether to enable apiserver vnet integration for the Fleet hub - or not. - :vartype enable_vnet_integration: bool - :ivar subnet_id: The subnet to be used when apiserver vnet integration is enabled. It is - required when creating a new Fleet with BYO vnet. - :vartype subnet_id: str - """ - - _attribute_map = { - "enable_private_cluster": {"key": "enablePrivateCluster", "type": "bool"}, - "enable_vnet_integration": {"key": "enableVnetIntegration", "type": "bool"}, - "subnet_id": {"key": "subnetId", "type": "str"}, - } - - def __init__( - self, - *, - enable_private_cluster: Optional[bool] = None, - enable_vnet_integration: Optional[bool] = None, - subnet_id: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword enable_private_cluster: Whether to create the Fleet hub as a private cluster or not. - :paramtype enable_private_cluster: bool - :keyword enable_vnet_integration: Whether to enable apiserver vnet integration for the Fleet - hub or not. - :paramtype enable_vnet_integration: bool - :keyword subnet_id: The subnet to be used when apiserver vnet integration is enabled. It is - required when creating a new Fleet with BYO vnet. - :paramtype subnet_id: str - """ - super().__init__(**kwargs) - self.enable_private_cluster = enable_private_cluster - self.enable_vnet_integration = enable_vnet_integration - self.subnet_id = subnet_id - - -class ErrorAdditionalInfo(_serialization.Model): - """The resource management error additional info. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar type: The additional info type. - :vartype type: str - :ivar info: The additional info. - :vartype info: JSON - """ - - _validation = { - "type": {"readonly": True}, - "info": {"readonly": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "info": {"key": "info", "type": "object"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.type = None - self.info = None - - -class ErrorDetail(_serialization.Model): - """The error detail. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar code: The error code. - :vartype code: str - :ivar message: The error message. - :vartype message: str - :ivar target: The error target. - :vartype target: str - :ivar details: The error details. - :vartype details: - list[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.ErrorDetail] - :ivar additional_info: The error additional info. - :vartype additional_info: - list[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.ErrorAdditionalInfo] - """ - - _validation = { - "code": {"readonly": True}, - "message": {"readonly": True}, - "target": {"readonly": True}, - "details": {"readonly": True}, - "additional_info": {"readonly": True}, - } - - _attribute_map = { - "code": {"key": "code", "type": "str"}, - "message": {"key": "message", "type": "str"}, - "target": {"key": "target", "type": "str"}, - "details": {"key": "details", "type": "[ErrorDetail]"}, - "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.code = None - self.message = None - self.target = None - self.details = None - self.additional_info = None - - -class ErrorResponse(_serialization.Model): - """Common error response for all Azure Resource Manager APIs to return error details for failed - operations. (This also follows the OData error response format.). - - :ivar error: The error object. - :vartype error: ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.ErrorDetail - """ - - _attribute_map = { - "error": {"key": "error", "type": "ErrorDetail"}, - } - - def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: Any) -> None: - """ - :keyword error: The error object. - :paramtype error: ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.ErrorDetail - """ - super().__init__(**kwargs) - self.error = error - - -class Resource(_serialization.Model): - """Common fields that are returned in the response for all Azure Resource Manager resources. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.SystemData - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.system_data = None - - -class TrackedResource(Resource): - """The resource model definition for an Azure Resource Manager tracked top level resource which - has 'tags' and a 'location'. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.SystemData - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "location": {"required": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - } - - def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - """ - super().__init__(**kwargs) - self.tags = tags - self.location = location - - -class Fleet(TrackedResource): - """The Fleet 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 server. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.SystemData - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - :ivar e_tag: If eTag is provided in the response body, it may also be provided as a header per - the normal etag convention. Entity tags are used for comparing two or more entities from the - same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match - (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. - :vartype e_tag: str - :ivar identity: Managed identity. - :vartype identity: - ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.ManagedServiceIdentity - :ivar provisioning_state: The status of the last operation. Known values are: "Succeeded", - "Failed", "Canceled", "Creating", "Updating", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.FleetProvisioningState - :ivar hub_profile: The FleetHubProfile configures the Fleet's hub. - :vartype hub_profile: - ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.FleetHubProfile - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "location": {"required": True}, - "e_tag": {"readonly": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - "e_tag": {"key": "eTag", "type": "str"}, - "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "hub_profile": {"key": "properties.hubProfile", "type": "FleetHubProfile"}, - } - - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - identity: Optional["_models.ManagedServiceIdentity"] = None, - hub_profile: Optional["_models.FleetHubProfile"] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - :keyword identity: Managed identity. - :paramtype identity: - ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.ManagedServiceIdentity - :keyword hub_profile: The FleetHubProfile configures the Fleet's hub. - :paramtype hub_profile: - ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.FleetHubProfile - """ - super().__init__(tags=tags, location=location, **kwargs) - self.e_tag = None - self.identity = identity - self.provisioning_state = None - self.hub_profile = hub_profile - - -class FleetCredentialResult(_serialization.Model): - """One credential result item. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: The name of the credential. - :vartype name: str - :ivar value: Base64-encoded Kubernetes configuration file. - :vartype value: bytes - """ - - _validation = { - "name": {"readonly": True}, - "value": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "value": {"key": "value", "type": "bytearray"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.value = None - - -class FleetCredentialResults(_serialization.Model): - """The Credential results response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar kubeconfigs: Array of base64-encoded Kubernetes configuration files. - :vartype kubeconfigs: - list[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.FleetCredentialResult] - """ - - _validation = { - "kubeconfigs": {"readonly": True}, - } - - _attribute_map = { - "kubeconfigs": {"key": "kubeconfigs", "type": "[FleetCredentialResult]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.kubeconfigs = None - - -class FleetHubProfile(_serialization.Model): - """The FleetHubProfile configures the fleet hub. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar dns_prefix: DNS prefix used to create the FQDN for the Fleet hub. - :vartype dns_prefix: str - :ivar api_server_access_profile: The access profile for the Fleet hub API server. - :vartype api_server_access_profile: - ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.APIServerAccessProfile - :ivar agent_profile: The agent profile for the Fleet hub. - :vartype agent_profile: - ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.AgentProfile - :ivar fqdn: The FQDN of the Fleet hub. - :vartype fqdn: str - :ivar kubernetes_version: The Kubernetes version of the Fleet hub. - :vartype kubernetes_version: str - :ivar portal_fqdn: The Azure Portal FQDN of the Fleet hub. - :vartype portal_fqdn: str - """ - - _validation = { - "dns_prefix": { - "max_length": 54, - "min_length": 1, - "pattern": r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][a-zA-Z0-9-]{0,52}[a-zA-Z0-9]$", - }, - "fqdn": {"readonly": True}, - "kubernetes_version": {"readonly": True}, - "portal_fqdn": {"readonly": True}, - } - - _attribute_map = { - "dns_prefix": {"key": "dnsPrefix", "type": "str"}, - "api_server_access_profile": {"key": "apiServerAccessProfile", "type": "APIServerAccessProfile"}, - "agent_profile": {"key": "agentProfile", "type": "AgentProfile"}, - "fqdn": {"key": "fqdn", "type": "str"}, - "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, - "portal_fqdn": {"key": "portalFqdn", "type": "str"}, - } - - def __init__( - self, - *, - dns_prefix: Optional[str] = None, - api_server_access_profile: Optional["_models.APIServerAccessProfile"] = None, - agent_profile: Optional["_models.AgentProfile"] = None, - **kwargs: Any - ) -> None: - """ - :keyword dns_prefix: DNS prefix used to create the FQDN for the Fleet hub. - :paramtype dns_prefix: str - :keyword api_server_access_profile: The access profile for the Fleet hub API server. - :paramtype api_server_access_profile: - ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.APIServerAccessProfile - :keyword agent_profile: The agent profile for the Fleet hub. - :paramtype agent_profile: - ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.AgentProfile - """ - super().__init__(**kwargs) - self.dns_prefix = dns_prefix - self.api_server_access_profile = api_server_access_profile - self.agent_profile = agent_profile - self.fqdn = None - self.kubernetes_version = None - self.portal_fqdn = None - - -class FleetListResult(_serialization.Model): - """The response of a Fleet list operation. - - All required parameters must be populated in order to send to server. - - :ivar value: The Fleet items on this page. Required. - :vartype value: list[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.Fleet] - :ivar next_link: The link to the next page of items. - :vartype next_link: str - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[Fleet]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, *, value: List["_models.Fleet"], next_link: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword value: The Fleet items on this page. Required. - :paramtype value: list[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.Fleet] - :keyword next_link: The link to the next page of items. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ProxyResource(Resource): - """The resource model definition for a Azure Resource Manager proxy resource. It will not have - tags and a location. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.SystemData - """ - - -class FleetMember(ProxyResource): - """A member of the Fleet. It contains a reference to an existing Kubernetes cluster on Azure. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.SystemData - :ivar e_tag: If eTag is provided in the response body, it may also be provided as a header per - the normal etag convention. Entity tags are used for comparing two or more entities from the - same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match - (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. - :vartype e_tag: str - :ivar cluster_resource_id: The ARM resource id of the cluster that joins the Fleet. Must be a - valid Azure resource id. e.g.: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{clusterName}'. # pylint: disable=line-too-long - :vartype cluster_resource_id: str - :ivar group: The group this member belongs to for multi-cluster update management. - :vartype group: str - :ivar provisioning_state: The status of the last operation. Known values are: "Succeeded", - "Failed", "Canceled", "Joining", "Leaving", and "Updating". - :vartype provisioning_state: str or - ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.FleetMemberProvisioningState - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "e_tag": {"readonly": True}, - "group": {"max_length": 50, "min_length": 1, "pattern": r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$"}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "e_tag": {"key": "eTag", "type": "str"}, - "cluster_resource_id": {"key": "properties.clusterResourceId", "type": "str"}, - "group": {"key": "properties.group", "type": "str"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - } - - def __init__( - self, *, cluster_resource_id: Optional[str] = None, group: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword cluster_resource_id: The ARM resource id of the cluster that joins the Fleet. Must be - a valid Azure resource id. e.g.: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{clusterName}'. # pylint: disable=line-too-long - :paramtype cluster_resource_id: str - :keyword group: The group this member belongs to for multi-cluster update management. - :paramtype group: str - """ - super().__init__(**kwargs) - self.e_tag = None - self.cluster_resource_id = cluster_resource_id - self.group = group - self.provisioning_state = None - - -class FleetMemberListResult(_serialization.Model): - """The response of a FleetMember list operation. - - All required parameters must be populated in order to send to server. - - :ivar value: The FleetMember items on this page. Required. - :vartype value: list[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.FleetMember] - :ivar next_link: The link to the next page of items. - :vartype next_link: str - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[FleetMember]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, *, value: List["_models.FleetMember"], next_link: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword value: The FleetMember items on this page. Required. - :paramtype value: - list[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.FleetMember] - :keyword next_link: The link to the next page of items. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class FleetMemberUpdate(_serialization.Model): - """The type used for update operations of the FleetMember. - - :ivar group: The group this member belongs to for multi-cluster update management. - :vartype group: str - """ - - _validation = { - "group": {"max_length": 50, "min_length": 1, "pattern": r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$"}, - } - - _attribute_map = { - "group": {"key": "properties.group", "type": "str"}, - } - - def __init__(self, *, group: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword group: The group this member belongs to for multi-cluster update management. - :paramtype group: str - """ - super().__init__(**kwargs) - self.group = group - - -class FleetPatch(_serialization.Model): - """Properties of a Fleet that can be patched. - - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar identity: Managed identity. - :vartype identity: - ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.ManagedServiceIdentity - """ - - _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, - } - - def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - identity: Optional["_models.ManagedServiceIdentity"] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword identity: Managed identity. - :paramtype identity: - ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.ManagedServiceIdentity - """ - super().__init__(**kwargs) - self.tags = tags - self.identity = identity - - -class FleetUpdateStrategy(ProxyResource): - """Defines a multi-stage process to perform update operations across members of a Fleet. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.SystemData - :ivar e_tag: If eTag is provided in the response body, it may also be provided as a header per - the normal etag convention. Entity tags are used for comparing two or more entities from the - same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match - (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. - :vartype e_tag: str - :ivar provisioning_state: The provisioning state of the UpdateStrategy resource. Known values - are: "Succeeded", "Failed", and "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.FleetUpdateStrategyProvisioningState - :ivar strategy: Defines the update sequence of the clusters. - :vartype strategy: - ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.UpdateRunStrategy - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "e_tag": {"readonly": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "e_tag": {"key": "eTag", "type": "str"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "strategy": {"key": "properties.strategy", "type": "UpdateRunStrategy"}, - } - - def __init__(self, *, strategy: Optional["_models.UpdateRunStrategy"] = None, **kwargs: Any) -> None: - """ - :keyword strategy: Defines the update sequence of the clusters. - :paramtype strategy: - ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.UpdateRunStrategy - """ - super().__init__(**kwargs) - self.e_tag = None - self.provisioning_state = None - self.strategy = strategy - - -class FleetUpdateStrategyListResult(_serialization.Model): - """The response of a FleetUpdateStrategy list operation. - - All required parameters must be populated in order to send to server. - - :ivar value: The FleetUpdateStrategy items on this page. Required. - :vartype value: - list[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.FleetUpdateStrategy] - :ivar next_link: The link to the next page of items. - :vartype next_link: str - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[FleetUpdateStrategy]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: List["_models.FleetUpdateStrategy"], next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: The FleetUpdateStrategy items on this page. Required. - :paramtype value: - list[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.FleetUpdateStrategy] - :keyword next_link: The link to the next page of items. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ManagedClusterUpdate(_serialization.Model): - """The update to be applied to the ManagedClusters. - - All required parameters must be populated in order to send to server. - - :ivar upgrade: The upgrade to apply to the ManagedClusters. Required. - :vartype upgrade: - ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.ManagedClusterUpgradeSpec - :ivar node_image_selection: The node image upgrade to be applied to the target nodes in update - run. - :vartype node_image_selection: - ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.NodeImageSelection - """ - - _validation = { - "upgrade": {"required": True}, - } - - _attribute_map = { - "upgrade": {"key": "upgrade", "type": "ManagedClusterUpgradeSpec"}, - "node_image_selection": {"key": "nodeImageSelection", "type": "NodeImageSelection"}, - } - - def __init__( - self, - *, - upgrade: "_models.ManagedClusterUpgradeSpec", - node_image_selection: Optional["_models.NodeImageSelection"] = None, - **kwargs: Any - ) -> None: - """ - :keyword upgrade: The upgrade to apply to the ManagedClusters. Required. - :paramtype upgrade: - ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.ManagedClusterUpgradeSpec - :keyword node_image_selection: The node image upgrade to be applied to the target nodes in - update run. - :paramtype node_image_selection: - ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.NodeImageSelection - """ - super().__init__(**kwargs) - self.upgrade = upgrade - self.node_image_selection = node_image_selection - - -class ManagedClusterUpgradeSpec(_serialization.Model): - """The upgrade to apply to a ManagedCluster. - - All required parameters must be populated in order to send to server. - - :ivar type: ManagedClusterUpgradeType is the type of upgrade to be applied. Required. Known - values are: "Full", "NodeImageOnly", and "ControlPlaneOnly". - :vartype type: str or - ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.ManagedClusterUpgradeType - :ivar kubernetes_version: The Kubernetes version to upgrade the member clusters to. - :vartype kubernetes_version: str - """ - - _validation = { - "type": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, - } - - def __init__( - self, - *, - type: Union[str, "_models.ManagedClusterUpgradeType"], - kubernetes_version: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword type: ManagedClusterUpgradeType is the type of upgrade to be applied. Required. Known - values are: "Full", "NodeImageOnly", and "ControlPlaneOnly". - :paramtype type: str or - ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.ManagedClusterUpgradeType - :keyword kubernetes_version: The Kubernetes version to upgrade the member clusters to. - :paramtype kubernetes_version: str - """ - super().__init__(**kwargs) - self.type = type - self.kubernetes_version = kubernetes_version - - -class ManagedServiceIdentity(_serialization.Model): - """Managed service identity (system assigned and/or user assigned identities). - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar principal_id: The service principal ID of the system assigned identity. This property - will only be provided for a system assigned identity. - :vartype principal_id: str - :ivar tenant_id: The tenant ID of the system assigned identity. This property will only be - provided for a system assigned identity. - :vartype tenant_id: str - :ivar type: Type of managed service identity (where both SystemAssigned and UserAssigned types - are allowed). Required. Known values are: "None", "SystemAssigned", "UserAssigned", and - "SystemAssigned, UserAssigned". - :vartype type: str or - ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.ManagedServiceIdentityType - :ivar user_assigned_identities: The set of user assigned identities associated with the - resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. # pylint: disable=line-too-long - The dictionary values can be empty objects ({}) in requests. - :vartype user_assigned_identities: dict[str, - ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.UserAssignedIdentity] - """ - - _validation = { - "principal_id": {"readonly": True}, - "tenant_id": {"readonly": True}, - "type": {"required": True}, - } - - _attribute_map = { - "principal_id": {"key": "principalId", "type": "str"}, - "tenant_id": {"key": "tenantId", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "user_assigned_identities": {"key": "userAssignedIdentities", "type": "{UserAssignedIdentity}"}, - } - - def __init__( - self, - *, - type: Union[str, "_models.ManagedServiceIdentityType"], - user_assigned_identities: Optional[Dict[str, "_models.UserAssignedIdentity"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword type: Type of managed service identity (where both SystemAssigned and UserAssigned - types are allowed). Required. Known values are: "None", "SystemAssigned", "UserAssigned", and - "SystemAssigned, UserAssigned". - :paramtype type: str or - ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.ManagedServiceIdentityType - :keyword user_assigned_identities: The set of user assigned identities associated with the - resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. # pylint: disable=line-too-long - The dictionary values can be empty objects ({}) in requests. - :paramtype user_assigned_identities: dict[str, - ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.UserAssignedIdentity] - """ - super().__init__(**kwargs) - self.principal_id = None - self.tenant_id = None - self.type = type - self.user_assigned_identities = user_assigned_identities - - -class MemberUpdateStatus(_serialization.Model): - """The status of a member update operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar status: The status of the MemberUpdate operation. - :vartype status: ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.UpdateStatus - :ivar name: The name of the FleetMember. - :vartype name: str - :ivar cluster_resource_id: The Azure resource id of the target Kubernetes cluster. - :vartype cluster_resource_id: str - :ivar operation_id: The operation resource id of the latest attempt to perform the operation. - :vartype operation_id: str - :ivar message: The status message after processing the member update operation. - :vartype message: str - """ - - _validation = { - "status": {"readonly": True}, - "name": {"readonly": True}, - "cluster_resource_id": {"readonly": True}, - "operation_id": {"readonly": True}, - "message": {"readonly": True}, - } - - _attribute_map = { - "status": {"key": "status", "type": "UpdateStatus"}, - "name": {"key": "name", "type": "str"}, - "cluster_resource_id": {"key": "clusterResourceId", "type": "str"}, - "operation_id": {"key": "operationId", "type": "str"}, - "message": {"key": "message", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.status = None - self.name = None - self.cluster_resource_id = None - self.operation_id = None - self.message = None - - -class NodeImageSelection(_serialization.Model): - """The node image upgrade to be applied to the target nodes in update run. - - All required parameters must be populated in order to send to server. - - :ivar type: The node image upgrade type. Required. Known values are: "Latest" and "Consistent". - :vartype type: str or - ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.NodeImageSelectionType - """ - - _validation = { - "type": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - } - - def __init__(self, *, type: Union[str, "_models.NodeImageSelectionType"], **kwargs: Any) -> None: - """ - :keyword type: The node image upgrade type. Required. Known values are: "Latest" and - "Consistent". - :paramtype type: str or - ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.NodeImageSelectionType - """ - super().__init__(**kwargs) - self.type = type - - -class NodeImageSelectionStatus(_serialization.Model): - """The node image upgrade specs for the update run. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar selected_node_image_versions: The image versions to upgrade the nodes to. - :vartype selected_node_image_versions: - list[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.NodeImageVersion] - """ - - _validation = { - "selected_node_image_versions": {"readonly": True}, - } - - _attribute_map = { - "selected_node_image_versions": {"key": "selectedNodeImageVersions", "type": "[NodeImageVersion]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.selected_node_image_versions = None - - -class NodeImageVersion(_serialization.Model): - """The node upgrade image version. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar version: The image version to upgrade the nodes to (e.g., - 'AKSUbuntu-1804gen2containerd-2022.12.13'). - :vartype version: str - """ - - _validation = { - "version": {"readonly": True}, - } - - _attribute_map = { - "version": {"key": "version", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.version = None - - -class Operation(_serialization.Model): - """Details of a REST API operation, returned from the Resource Provider Operations API. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: - "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". - :vartype name: str - :ivar is_data_action: Whether the operation applies to data-plane. This is "true" for - data-plane operations and "false" for ARM/control-plane operations. - :vartype is_data_action: bool - :ivar display: Localized display information for this particular operation. - :vartype display: ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.OperationDisplay - :ivar origin: The intended executor of the operation; as in Resource Based Access Control - (RBAC) and audit logs UX. Default value is "user,system". Known values are: "user", "system", - and "user,system". - :vartype origin: str or ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.Origin - :ivar action_type: Enum. Indicates the action type. "Internal" refers to actions that are for - internal only APIs. "Internal" - :vartype action_type: str or - ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.ActionType - """ - - _validation = { - "name": {"readonly": True}, - "is_data_action": {"readonly": True}, - "origin": {"readonly": True}, - "action_type": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "is_data_action": {"key": "isDataAction", "type": "bool"}, - "display": {"key": "display", "type": "OperationDisplay"}, - "origin": {"key": "origin", "type": "str"}, - "action_type": {"key": "actionType", "type": "str"}, - } - - def __init__(self, *, display: Optional["_models.OperationDisplay"] = None, **kwargs: Any) -> None: - """ - :keyword display: Localized display information for this particular operation. - :paramtype display: - ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.OperationDisplay - """ - super().__init__(**kwargs) - self.name = None - self.is_data_action = None - self.display = display - self.origin = None - self.action_type = None - - -class OperationDisplay(_serialization.Model): - """Localized display information for this particular operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provider: The localized friendly form of the resource provider name, e.g. "Microsoft - Monitoring Insights" or "Microsoft Compute". - :vartype provider: str - :ivar resource: The localized friendly name of the resource type related to this operation. - E.g. "Virtual Machines" or "Job Schedule Collections". - :vartype resource: str - :ivar operation: The concise, localized friendly name for the operation; suitable for - dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual Machine". - :vartype operation: str - :ivar description: The short, localized friendly description of the operation; suitable for - tool tips and detailed views. - :vartype description: str - """ - - _validation = { - "provider": {"readonly": True}, - "resource": {"readonly": True}, - "operation": {"readonly": True}, - "description": {"readonly": True}, - } - - _attribute_map = { - "provider": {"key": "provider", "type": "str"}, - "resource": {"key": "resource", "type": "str"}, - "operation": {"key": "operation", "type": "str"}, - "description": {"key": "description", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.provider = None - self.resource = None - self.operation = None - self.description = None - - -class OperationListResult(_serialization.Model): - """A list of REST API operations supported by an Azure Resource Provider. It contains an URL link - to get the next set of results. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of operations supported by the resource provider. - :vartype value: list[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.Operation] - :ivar next_link: URL to get the next set of operation list results (if there are any). - :vartype next_link: str - """ - - _validation = { - "value": {"readonly": True}, - "next_link": {"readonly": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[Operation]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.value = None - self.next_link = None - - -class SkipProperties(_serialization.Model): - """The properties of a skip operation containing multiple skip requests. - - All required parameters must be populated in order to send to server. - - :ivar targets: The targets to skip. Required. - :vartype targets: list[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.SkipTarget] - """ - - _validation = { - "targets": {"required": True}, - } - - _attribute_map = { - "targets": {"key": "targets", "type": "[SkipTarget]"}, - } - - def __init__(self, *, targets: List["_models.SkipTarget"], **kwargs: Any) -> None: - """ - :keyword targets: The targets to skip. Required. - :paramtype targets: - list[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.SkipTarget] - """ - super().__init__(**kwargs) - self.targets = targets - - -class SkipTarget(_serialization.Model): - """The definition of a single skip request. - - All required parameters must be populated in order to send to server. - - :ivar type: The skip target type. Required. Known values are: "Member", "Group", "Stage", and - "AfterStageWait". - :vartype type: str or ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.TargetType - :ivar name: The skip target's name. - To skip a member/group/stage, use the member/group/stage's name; - Tp skip an after stage wait, use the parent stage's name. Required. - :vartype name: str - """ - - _validation = { - "type": {"required": True}, - "name": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "name": {"key": "name", "type": "str"}, - } - - def __init__(self, *, type: Union[str, "_models.TargetType"], name: str, **kwargs: Any) -> None: - """ - :keyword type: The skip target type. Required. Known values are: "Member", "Group", "Stage", - and "AfterStageWait". - :paramtype type: str or ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.TargetType - :keyword name: The skip target's name. - To skip a member/group/stage, use the member/group/stage's name; - Tp skip an after stage wait, use the parent stage's name. Required. - :paramtype name: str - """ - super().__init__(**kwargs) - self.type = type - self.name = name - - -class SystemData(_serialization.Model): - """Metadata pertaining to creation and last modification of the resource. - - :ivar created_by: The identity that created the resource. - :vartype created_by: str - :ivar created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", and "Key". - :vartype created_by_type: str or - ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.CreatedByType - :ivar created_at: The timestamp of resource creation (UTC). - :vartype created_at: ~datetime.datetime - :ivar last_modified_by: The identity that last modified the resource. - :vartype last_modified_by: str - :ivar last_modified_by_type: The type of identity that last modified the resource. Known values - are: "User", "Application", "ManagedIdentity", and "Key". - :vartype last_modified_by_type: str or - ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.CreatedByType - :ivar last_modified_at: The timestamp of resource last modification (UTC). - :vartype last_modified_at: ~datetime.datetime - """ - - _attribute_map = { - "created_by": {"key": "createdBy", "type": "str"}, - "created_by_type": {"key": "createdByType", "type": "str"}, - "created_at": {"key": "createdAt", "type": "iso-8601"}, - "last_modified_by": {"key": "lastModifiedBy", "type": "str"}, - "last_modified_by_type": {"key": "lastModifiedByType", "type": "str"}, - "last_modified_at": {"key": "lastModifiedAt", "type": "iso-8601"}, - } - - def __init__( - self, - *, - created_by: Optional[str] = None, - created_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, - created_at: Optional[datetime.datetime] = None, - last_modified_by: Optional[str] = None, - last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, - last_modified_at: Optional[datetime.datetime] = None, - **kwargs: Any - ) -> None: - """ - :keyword created_by: The identity that created the resource. - :paramtype created_by: str - :keyword created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", and "Key". - :paramtype created_by_type: str or - ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.CreatedByType - :keyword created_at: The timestamp of resource creation (UTC). - :paramtype created_at: ~datetime.datetime - :keyword last_modified_by: The identity that last modified the resource. - :paramtype last_modified_by: str - :keyword last_modified_by_type: The type of identity that last modified the resource. Known - values are: "User", "Application", "ManagedIdentity", and "Key". - :paramtype last_modified_by_type: str or - ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.CreatedByType - :keyword last_modified_at: The timestamp of resource last modification (UTC). - :paramtype last_modified_at: ~datetime.datetime - """ - super().__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 UpdateGroup(_serialization.Model): - """A group to be updated. - - All required parameters must be populated in order to send to server. - - :ivar name: Name of the group. - It must match a group name of an existing fleet member. Required. - :vartype name: str - """ - - _validation = { - "name": {"required": True, "max_length": 50, "min_length": 1, "pattern": r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$"}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - } - - def __init__(self, *, name: str, **kwargs: Any) -> None: - """ - :keyword name: Name of the group. - It must match a group name of an existing fleet member. Required. - :paramtype name: str - """ - super().__init__(**kwargs) - self.name = name - - -class UpdateGroupStatus(_serialization.Model): - """The status of a UpdateGroup. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar status: The status of the UpdateGroup. - :vartype status: ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.UpdateStatus - :ivar name: The name of the UpdateGroup. - :vartype name: str - :ivar members: The list of member this UpdateGroup updates. - :vartype members: - list[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.MemberUpdateStatus] - """ - - _validation = { - "status": {"readonly": True}, - "name": {"readonly": True}, - "members": {"readonly": True}, - } - - _attribute_map = { - "status": {"key": "status", "type": "UpdateStatus"}, - "name": {"key": "name", "type": "str"}, - "members": {"key": "members", "type": "[MemberUpdateStatus]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.status = None - self.name = None - self.members = None - - -class UpdateRun(ProxyResource): - """A multi-stage process to perform update operations across members of a Fleet. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.SystemData - :ivar e_tag: If eTag is provided in the response body, it may also be provided as a header per - the normal etag convention. Entity tags are used for comparing two or more entities from the - same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match - (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. - :vartype e_tag: str - :ivar provisioning_state: The provisioning state of the UpdateRun resource. Known values are: - "Succeeded", "Failed", and "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.UpdateRunProvisioningState - :ivar update_strategy_id: The resource id of the FleetUpdateStrategy resource to reference. - - When creating a new run, there are three ways to define a strategy for the run: - - - #. Define a new strategy in place: Set the "strategy" field. - #. Use an existing strategy: Set the "updateStrategyId" field. (since 2023-08-15-preview) - #. Use the default strategy to update all the members one by one: Leave both - "updateStrategyId" and "strategy" unset. (since 2023-08-15-preview) - - Setting both "updateStrategyId" and "strategy" is invalid. - - UpdateRuns created by "updateStrategyId" snapshot the referenced UpdateStrategy at the time of - creation and store it in the "strategy" field. - Subsequent changes to the referenced FleetUpdateStrategy resource do not propagate. - UpdateRunStrategy changes can be made directly on the "strategy" field before launching the - UpdateRun. - :vartype update_strategy_id: str - :ivar strategy: The strategy defines the order in which the clusters will be updated. - If not set, all members will be updated sequentially. The UpdateRun status will show a single - UpdateStage and a single UpdateGroup targeting all members. - The strategy of the UpdateRun can be modified until the run is started. - :vartype strategy: - ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.UpdateRunStrategy - :ivar managed_cluster_update: The update to be applied to all clusters in the UpdateRun. The - managedClusterUpdate can be modified until the run is started. - :vartype managed_cluster_update: - ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.ManagedClusterUpdate - :ivar status: The status of the UpdateRun. - :vartype status: ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.UpdateRunStatus - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "e_tag": {"readonly": True}, - "provisioning_state": {"readonly": True}, - "status": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "e_tag": {"key": "eTag", "type": "str"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "update_strategy_id": {"key": "properties.updateStrategyId", "type": "str"}, - "strategy": {"key": "properties.strategy", "type": "UpdateRunStrategy"}, - "managed_cluster_update": {"key": "properties.managedClusterUpdate", "type": "ManagedClusterUpdate"}, - "status": {"key": "properties.status", "type": "UpdateRunStatus"}, - } - - def __init__( - self, - *, - update_strategy_id: Optional[str] = None, - strategy: Optional["_models.UpdateRunStrategy"] = None, - managed_cluster_update: Optional["_models.ManagedClusterUpdate"] = None, - **kwargs: Any - ) -> None: - """ - :keyword update_strategy_id: The resource id of the FleetUpdateStrategy resource to reference. - - When creating a new run, there are three ways to define a strategy for the run: - - - #. Define a new strategy in place: Set the "strategy" field. - #. Use an existing strategy: Set the "updateStrategyId" field. (since 2023-08-15-preview) - #. Use the default strategy to update all the members one by one: Leave both - "updateStrategyId" and "strategy" unset. (since 2023-08-15-preview) - - Setting both "updateStrategyId" and "strategy" is invalid. - - UpdateRuns created by "updateStrategyId" snapshot the referenced UpdateStrategy at the time of - creation and store it in the "strategy" field. - Subsequent changes to the referenced FleetUpdateStrategy resource do not propagate. - UpdateRunStrategy changes can be made directly on the "strategy" field before launching the - UpdateRun. - :paramtype update_strategy_id: str - :keyword strategy: The strategy defines the order in which the clusters will be updated. - If not set, all members will be updated sequentially. The UpdateRun status will show a single - UpdateStage and a single UpdateGroup targeting all members. - The strategy of the UpdateRun can be modified until the run is started. - :paramtype strategy: - ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.UpdateRunStrategy - :keyword managed_cluster_update: The update to be applied to all clusters in the UpdateRun. The - managedClusterUpdate can be modified until the run is started. - :paramtype managed_cluster_update: - ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.ManagedClusterUpdate - """ - super().__init__(**kwargs) - self.e_tag = None - self.provisioning_state = None - self.update_strategy_id = update_strategy_id - self.strategy = strategy - self.managed_cluster_update = managed_cluster_update - self.status = None - - -class UpdateRunListResult(_serialization.Model): - """The response of a UpdateRun list operation. - - All required parameters must be populated in order to send to server. - - :ivar value: The UpdateRun items on this page. Required. - :vartype value: list[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.UpdateRun] - :ivar next_link: The link to the next page of items. - :vartype next_link: str - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[UpdateRun]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, *, value: List["_models.UpdateRun"], next_link: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword value: The UpdateRun items on this page. Required. - :paramtype value: list[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.UpdateRun] - :keyword next_link: The link to the next page of items. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class UpdateRunStatus(_serialization.Model): - """The status of a UpdateRun. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar status: The status of the UpdateRun. - :vartype status: ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.UpdateStatus - :ivar stages: The stages composing an update run. Stages are run sequentially withing an - UpdateRun. - :vartype stages: - list[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.UpdateStageStatus] - :ivar node_image_selection: The node image upgrade specs for the update run. It is only set in - update run when ``NodeImageSelection.type`` is ``Consistent``. - :vartype node_image_selection: - ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.NodeImageSelectionStatus - """ - - _validation = { - "status": {"readonly": True}, - "stages": {"readonly": True}, - "node_image_selection": {"readonly": True}, - } - - _attribute_map = { - "status": {"key": "status", "type": "UpdateStatus"}, - "stages": {"key": "stages", "type": "[UpdateStageStatus]"}, - "node_image_selection": {"key": "nodeImageSelection", "type": "NodeImageSelectionStatus"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.status = None - self.stages = None - self.node_image_selection = None - - -class UpdateRunStrategy(_serialization.Model): - """Defines the update sequence of the clusters via stages and groups. - - Stages within a run are executed sequentially one after another. - Groups within a stage are executed in parallel. - Member clusters within a group are updated sequentially one after another. - - A valid strategy contains no duplicate groups within or across stages. - - All required parameters must be populated in order to send to server. - - :ivar stages: The list of stages that compose this update run. Min size: 1. Required. - :vartype stages: list[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.UpdateStage] - """ - - _validation = { - "stages": {"required": True}, - } - - _attribute_map = { - "stages": {"key": "stages", "type": "[UpdateStage]"}, - } - - def __init__(self, *, stages: List["_models.UpdateStage"], **kwargs: Any) -> None: - """ - :keyword stages: The list of stages that compose this update run. Min size: 1. Required. - :paramtype stages: - list[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.UpdateStage] - """ - super().__init__(**kwargs) - self.stages = stages - - -class UpdateStage(_serialization.Model): - """Defines a stage which contains the groups to update and the steps to take (e.g., wait for a - time period) before starting the next stage. - - All required parameters must be populated in order to send to server. - - :ivar name: The name of the stage. Must be unique within the UpdateRun. Required. - :vartype name: str - :ivar groups: Defines the groups to be executed in parallel in this stage. Duplicate groups are - not allowed. Min size: 1. - :vartype groups: list[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.UpdateGroup] - :ivar after_stage_wait_in_seconds: The time in seconds to wait at the end of this stage before - starting the next one. Defaults to 0 seconds if unspecified. - :vartype after_stage_wait_in_seconds: int - """ - - _validation = { - "name": {"required": True, "max_length": 50, "min_length": 1, "pattern": r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$"}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "groups": {"key": "groups", "type": "[UpdateGroup]"}, - "after_stage_wait_in_seconds": {"key": "afterStageWaitInSeconds", "type": "int"}, - } - - def __init__( - self, - *, - name: str, - groups: Optional[List["_models.UpdateGroup"]] = None, - after_stage_wait_in_seconds: Optional[int] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: The name of the stage. Must be unique within the UpdateRun. Required. - :paramtype name: str - :keyword groups: Defines the groups to be executed in parallel in this stage. Duplicate groups - are not allowed. Min size: 1. - :paramtype groups: - list[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.UpdateGroup] - :keyword after_stage_wait_in_seconds: The time in seconds to wait at the end of this stage - before starting the next one. Defaults to 0 seconds if unspecified. - :paramtype after_stage_wait_in_seconds: int - """ - super().__init__(**kwargs) - self.name = name - self.groups = groups - self.after_stage_wait_in_seconds = after_stage_wait_in_seconds - - -class UpdateStageStatus(_serialization.Model): - """The status of a UpdateStage. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar status: The status of the UpdateStage. - :vartype status: ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.UpdateStatus - :ivar name: The name of the UpdateStage. - :vartype name: str - :ivar groups: The list of groups to be updated as part of this UpdateStage. - :vartype groups: - list[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.UpdateGroupStatus] - :ivar after_stage_wait_status: The status of the wait period configured on the UpdateStage. - :vartype after_stage_wait_status: - ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.WaitStatus - """ - - _validation = { - "status": {"readonly": True}, - "name": {"readonly": True}, - "groups": {"readonly": True}, - "after_stage_wait_status": {"readonly": True}, - } - - _attribute_map = { - "status": {"key": "status", "type": "UpdateStatus"}, - "name": {"key": "name", "type": "str"}, - "groups": {"key": "groups", "type": "[UpdateGroupStatus]"}, - "after_stage_wait_status": {"key": "afterStageWaitStatus", "type": "WaitStatus"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.status = None - self.name = None - self.groups = None - self.after_stage_wait_status = None - - -class UpdateStatus(_serialization.Model): - """The status for an operation or group of operations. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar start_time: The time the operation or group was started. - :vartype start_time: ~datetime.datetime - :ivar completed_time: The time the operation or group was completed. - :vartype completed_time: ~datetime.datetime - :ivar state: The State of the operation or group. Known values are: "NotStarted", "Running", - "Stopping", "Stopped", "Skipped", "Failed", and "Completed". - :vartype state: str or ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.UpdateState - :ivar error: The error details when a failure is encountered. - :vartype error: ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.ErrorDetail - """ - - _validation = { - "start_time": {"readonly": True}, - "completed_time": {"readonly": True}, - "state": {"readonly": True}, - "error": {"readonly": True}, - } - - _attribute_map = { - "start_time": {"key": "startTime", "type": "iso-8601"}, - "completed_time": {"key": "completedTime", "type": "iso-8601"}, - "state": {"key": "state", "type": "str"}, - "error": {"key": "error", "type": "ErrorDetail"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.start_time = None - self.completed_time = None - self.state = None - self.error = None - - -class UserAssignedIdentity(_serialization.Model): - """User assigned identity properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar principal_id: The principal ID of the assigned identity. - :vartype principal_id: str - :ivar client_id: The client ID of the assigned identity. - :vartype client_id: str - """ - - _validation = { - "principal_id": {"readonly": True}, - "client_id": {"readonly": True}, - } - - _attribute_map = { - "principal_id": {"key": "principalId", "type": "str"}, - "client_id": {"key": "clientId", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.principal_id = None - self.client_id = None - - -class WaitStatus(_serialization.Model): - """The status of the wait duration. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar status: The status of the wait duration. - :vartype status: ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.UpdateStatus - :ivar wait_duration_in_seconds: The wait duration configured in seconds. - :vartype wait_duration_in_seconds: int - """ - - _validation = { - "status": {"readonly": True}, - "wait_duration_in_seconds": {"readonly": True}, - } - - _attribute_map = { - "status": {"key": "status", "type": "UpdateStatus"}, - "wait_duration_in_seconds": {"key": "waitDurationInSeconds", "type": "int"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.status = None - self.wait_duration_in_seconds = None diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/models/_patch.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/models/_patch.py deleted file mode 100644 index f7dd32510333d..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/models/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/operations/__init__.py deleted file mode 100644 index 2233c34e005ae..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/operations/__init__.py +++ /dev/null @@ -1,27 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._operations import Operations -from ._fleets_operations import FleetsOperations -from ._fleet_members_operations import FleetMembersOperations -from ._update_runs_operations import UpdateRunsOperations -from ._fleet_update_strategies_operations import FleetUpdateStrategiesOperations - -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "Operations", - "FleetsOperations", - "FleetMembersOperations", - "UpdateRunsOperations", - "FleetUpdateStrategiesOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/operations/_fleet_members_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/operations/_fleet_members_operations.py deleted file mode 100644 index ff3559560b39b..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/operations/_fleet_members_operations.py +++ /dev/null @@ -1,1076 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_fleet_request( - resource_group_name: str, fleet_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-02-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, fleet_name: str, fleet_member_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-02-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - "fleetMemberName": _SERIALIZER.url( - "fleet_member_name", - fleet_member_name, - "str", - max_length=50, - min_length=1, - pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_request( - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-02-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - "fleetMemberName": _SERIALIZER.url( - "fleet_member_name", - fleet_member_name, - "str", - max_length=50, - min_length=1, - pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if if_none_match is not None: - _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-02-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - "fleetMemberName": _SERIALIZER.url( - "fleet_member_name", - fleet_member_name, - "str", - max_length=50, - min_length=1, - pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-02-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - "fleetMemberName": _SERIALIZER.url( - "fleet_member_name", - fleet_member_name, - "str", - max_length=50, - min_length=1, - pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -class FleetMembersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.containerservicefleet.v2024_02_02_preview.ContainerServiceFleetMgmtClient`'s - :attr:`fleet_members` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_by_fleet( - self, resource_group_name: str, fleet_name: str, **kwargs: Any - ) -> Iterable["_models.FleetMember"]: - """List FleetMember resources by Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :return: An iterator like instance of either FleetMember or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.FleetMember] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-02-02-preview") - ) - cls: ClsType[_models.FleetMemberListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_fleet_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("FleetMemberListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get( - self, resource_group_name: str, fleet_name: str, fleet_member_name: str, **kwargs: Any - ) -> _models.FleetMember: - """Get a FleetMember. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :return: FleetMember or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.FleetMember - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-02-02-preview") - ) - cls: ClsType[_models.FleetMember] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - fleet_member_name=fleet_member_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("FleetMember", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_initial( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - resource: Union[_models.FleetMember, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-02-02-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "FleetMember") - - _request = build_create_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - fleet_member_name=fleet_member_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - resource: _models.FleetMember, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.FleetMember]: - """Create a FleetMember. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :param resource: Resource create parameters. Required. - :type resource: ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.FleetMember - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either FleetMember or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.FleetMember] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - resource: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.FleetMember]: - """Create a FleetMember. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :param resource: Resource create parameters. Required. - :type resource: IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either FleetMember or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.FleetMember] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - resource: Union[_models.FleetMember, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[_models.FleetMember]: - """Create a FleetMember. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :param resource: Resource create parameters. Is either a FleetMember type or a IO[bytes] type. - Required. - :type resource: ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.FleetMember or - IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :return: An instance of LROPoller that returns either FleetMember or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.FleetMember] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-02-02-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FleetMember] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - fleet_member_name=fleet_member_name, - resource=resource, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FleetMember", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.FleetMember].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.FleetMember]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_initial( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - properties: Union[_models.FleetMemberUpdate, IO[bytes]], - if_match: Optional[str] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-02-02-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties - else: - _json = self._serialize.body(properties, "FleetMemberUpdate") - - _request = build_update_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - fleet_member_name=fleet_member_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - properties: _models.FleetMemberUpdate, - if_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.FleetMember]: - """Update a FleetMember. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :param properties: The resource properties to be updated. Required. - :type properties: - ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.FleetMemberUpdate - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either FleetMember or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.FleetMember] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - properties: IO[bytes], - if_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.FleetMember]: - """Update a FleetMember. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :param properties: The resource properties to be updated. Required. - :type properties: IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either FleetMember or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.FleetMember] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - properties: Union[_models.FleetMemberUpdate, IO[bytes]], - if_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[_models.FleetMember]: - """Update a FleetMember. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :param properties: The resource properties to be updated. Is either a FleetMemberUpdate type or - a IO[bytes] type. Required. - :type properties: - ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.FleetMemberUpdate or IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :return: An instance of LROPoller that returns either FleetMember or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.FleetMember] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-02-02-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FleetMember] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - fleet_member_name=fleet_member_name, - properties=properties, - if_match=if_match, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FleetMember", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.FleetMember].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.FleetMember]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-02-02-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - fleet_member_name=fleet_member_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[None]: - """Delete a FleetMember. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-02-02-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - fleet_member_name=fleet_member_name, - if_match=if_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/operations/_fleet_update_strategies_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/operations/_fleet_update_strategies_operations.py deleted file mode 100644 index 1327966b8c8d2..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/operations/_fleet_update_strategies_operations.py +++ /dev/null @@ -1,787 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_fleet_request( - resource_group_name: str, fleet_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-02-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateStrategies", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, fleet_name: str, update_strategy_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-02-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateStrategies/{updateStrategyName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - "updateStrategyName": _SERIALIZER.url( - "update_strategy_name", - update_strategy_name, - "str", - max_length=50, - min_length=1, - pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - fleet_name: str, - update_strategy_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-02-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateStrategies/{updateStrategyName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - "updateStrategyName": _SERIALIZER.url( - "update_strategy_name", - update_strategy_name, - "str", - max_length=50, - min_length=1, - pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if if_none_match is not None: - _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - fleet_name: str, - update_strategy_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-02-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateStrategies/{updateStrategyName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - "updateStrategyName": _SERIALIZER.url( - "update_strategy_name", - update_strategy_name, - "str", - max_length=50, - min_length=1, - pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -class FleetUpdateStrategiesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.containerservicefleet.v2024_02_02_preview.ContainerServiceFleetMgmtClient`'s - :attr:`fleet_update_strategies` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_by_fleet( - self, resource_group_name: str, fleet_name: str, **kwargs: Any - ) -> Iterable["_models.FleetUpdateStrategy"]: - """List FleetUpdateStrategy resources by Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :return: An iterator like instance of either FleetUpdateStrategy or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.FleetUpdateStrategy] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-02-02-preview") - ) - cls: ClsType[_models.FleetUpdateStrategyListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_fleet_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("FleetUpdateStrategyListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get( - self, resource_group_name: str, fleet_name: str, update_strategy_name: str, **kwargs: Any - ) -> _models.FleetUpdateStrategy: - """Get a FleetUpdateStrategy. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_strategy_name: The name of the UpdateStrategy resource. Required. - :type update_strategy_name: str - :return: FleetUpdateStrategy or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.FleetUpdateStrategy - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-02-02-preview") - ) - cls: ClsType[_models.FleetUpdateStrategy] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_strategy_name=update_strategy_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("FleetUpdateStrategy", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - fleet_name: str, - update_strategy_name: str, - resource: Union[_models.FleetUpdateStrategy, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-02-02-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "FleetUpdateStrategy") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_strategy_name=update_strategy_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - update_strategy_name: str, - resource: _models.FleetUpdateStrategy, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.FleetUpdateStrategy]: - """Create a FleetUpdateStrategy. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_strategy_name: The name of the UpdateStrategy resource. Required. - :type update_strategy_name: str - :param resource: Resource create parameters. Required. - :type resource: - ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.FleetUpdateStrategy - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either FleetUpdateStrategy or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.FleetUpdateStrategy] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - update_strategy_name: str, - resource: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.FleetUpdateStrategy]: - """Create a FleetUpdateStrategy. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_strategy_name: The name of the UpdateStrategy resource. Required. - :type update_strategy_name: str - :param resource: Resource create parameters. Required. - :type resource: IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either FleetUpdateStrategy or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.FleetUpdateStrategy] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - update_strategy_name: str, - resource: Union[_models.FleetUpdateStrategy, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[_models.FleetUpdateStrategy]: - """Create a FleetUpdateStrategy. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_strategy_name: The name of the UpdateStrategy resource. Required. - :type update_strategy_name: str - :param resource: Resource create parameters. Is either a FleetUpdateStrategy type or a - IO[bytes] type. Required. - :type resource: - ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.FleetUpdateStrategy or IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :return: An instance of LROPoller that returns either FleetUpdateStrategy or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.FleetUpdateStrategy] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-02-02-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FleetUpdateStrategy] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_strategy_name=update_strategy_name, - resource=resource, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FleetUpdateStrategy", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.FleetUpdateStrategy].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.FleetUpdateStrategy]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, - resource_group_name: str, - fleet_name: str, - update_strategy_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-02-02-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_strategy_name=update_strategy_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, - resource_group_name: str, - fleet_name: str, - update_strategy_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[None]: - """Delete a FleetUpdateStrategy. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_strategy_name: The name of the UpdateStrategy resource. Required. - :type update_strategy_name: str - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-02-02-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_strategy_name=update_strategy_name, - if_match=if_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/operations/_fleets_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/operations/_fleets_operations.py deleted file mode 100644 index 51a2b6e41bd81..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/operations/_fleets_operations.py +++ /dev/null @@ -1,1165 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-02-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/fleets") - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-02-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request(resource_group_name: str, fleet_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-02-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - fleet_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-02-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if if_none_match is not None: - _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, fleet_name: str, subscription_id: str, *, if_match: Optional[str] = None, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-02-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, fleet_name: str, subscription_id: str, *, if_match: Optional[str] = None, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-02-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_credentials_request( - resource_group_name: str, fleet_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-02-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/listCredentials", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class FleetsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.containerservicefleet.v2024_02_02_preview.ContainerServiceFleetMgmtClient`'s - :attr:`fleets` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.Fleet"]: - """Lists fleets in the specified subscription. - - :return: An iterator like instance of either Fleet or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-02-02-preview") - ) - cls: ClsType[_models.FleetListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("FleetListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Fleet"]: - """Lists fleets in the specified subscription and resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :return: An iterator like instance of either Fleet or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-02-02-preview") - ) - cls: ClsType[_models.FleetListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("FleetListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get(self, resource_group_name: str, fleet_name: str, **kwargs: Any) -> _models.Fleet: - """Gets a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :return: Fleet or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.Fleet - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-02-02-preview") - ) - cls: ClsType[_models.Fleet] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Fleet", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - fleet_name: str, - resource: Union[_models.Fleet, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-02-02-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "Fleet") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - resource: _models.Fleet, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Fleet]: - """Creates or updates a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param resource: Resource create parameters. Required. - :type resource: ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.Fleet - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either Fleet or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - resource: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Fleet]: - """Creates or updates a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param resource: Resource create parameters. Required. - :type resource: IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either Fleet or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - resource: Union[_models.Fleet, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[_models.Fleet]: - """Creates or updates a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param resource: Resource create parameters. Is either a Fleet type or a IO[bytes] type. - Required. - :type resource: ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.Fleet or IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :return: An instance of LROPoller that returns either Fleet or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-02-02-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Fleet] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - resource=resource, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Fleet", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.Fleet].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.Fleet]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_initial( - self, - resource_group_name: str, - fleet_name: str, - properties: Union[_models.FleetPatch, IO[bytes]], - if_match: Optional[str] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-02-02-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties - else: - _json = self._serialize.body(properties, "FleetPatch") - - _request = build_update_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - fleet_name: str, - properties: _models.FleetPatch, - if_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Fleet]: - """Update a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param properties: The resource properties to be updated. Required. - :type properties: ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.FleetPatch - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either Fleet or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - fleet_name: str, - properties: IO[bytes], - if_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Fleet]: - """Update a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param properties: The resource properties to be updated. Required. - :type properties: IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either Fleet or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - fleet_name: str, - properties: Union[_models.FleetPatch, IO[bytes]], - if_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[_models.Fleet]: - """Update a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param properties: The resource properties to be updated. Is either a FleetPatch type or a - IO[bytes] type. Required. - :type properties: ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.FleetPatch or - IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :return: An instance of LROPoller that returns either Fleet or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-02-02-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Fleet] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - properties=properties, - if_match=if_match, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Fleet", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.Fleet].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.Fleet]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, fleet_name: str, if_match: Optional[str] = None, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-02-02-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, resource_group_name: str, fleet_name: str, if_match: Optional[str] = None, **kwargs: Any - ) -> LROPoller[None]: - """Delete a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-02-02-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - if_match=if_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list_credentials( - self, resource_group_name: str, fleet_name: str, **kwargs: Any - ) -> _models.FleetCredentialResults: - """Lists the user credentials of a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :return: FleetCredentialResults or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.FleetCredentialResults - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-02-02-preview") - ) - cls: ClsType[_models.FleetCredentialResults] = kwargs.pop("cls", None) - - _request = build_list_credentials_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("FleetCredentialResults", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/operations/_operations.py deleted file mode 100644 index 3bd9476e431ad..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/operations/_operations.py +++ /dev/null @@ -1,156 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-02-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.ContainerService/operations") - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class Operations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.containerservicefleet.v2024_02_02_preview.ContainerServiceFleetMgmtClient`'s - :attr:`operations` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: - """List the operations for the provider. - - :return: An iterator like instance of either Operation or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.Operation] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-02-02-preview") - ) - cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - 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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/operations/_patch.py deleted file mode 100644 index f7dd32510333d..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/operations/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/operations/_update_runs_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/operations/_update_runs_operations.py deleted file mode 100644 index 011522c6739a9..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/operations/_update_runs_operations.py +++ /dev/null @@ -1,1449 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_fleet_request( - resource_group_name: str, fleet_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-02-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, fleet_name: str, update_run_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-02-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - "updateRunName": _SERIALIZER.url( - "update_run_name", - update_run_name, - "str", - max_length=50, - min_length=1, - pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - fleet_name: str, - update_run_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-02-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - "updateRunName": _SERIALIZER.url( - "update_run_name", - update_run_name, - "str", - max_length=50, - min_length=1, - pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if if_none_match is not None: - _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - fleet_name: str, - update_run_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-02-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - "updateRunName": _SERIALIZER.url( - "update_run_name", - update_run_name, - "str", - max_length=50, - min_length=1, - pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_skip_request( - resource_group_name: str, - fleet_name: str, - update_run_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-02-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName}/skip", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - "updateRunName": _SERIALIZER.url( - "update_run_name", - update_run_name, - "str", - max_length=50, - min_length=1, - pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_start_request( - resource_group_name: str, - fleet_name: str, - update_run_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-02-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName}/start", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - "updateRunName": _SERIALIZER.url( - "update_run_name", - update_run_name, - "str", - max_length=50, - min_length=1, - pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_stop_request( - resource_group_name: str, - fleet_name: str, - update_run_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-02-02-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName}/stop", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - "updateRunName": _SERIALIZER.url( - "update_run_name", - update_run_name, - "str", - max_length=50, - min_length=1, - pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class UpdateRunsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.containerservicefleet.v2024_02_02_preview.ContainerServiceFleetMgmtClient`'s - :attr:`update_runs` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_by_fleet(self, resource_group_name: str, fleet_name: str, **kwargs: Any) -> Iterable["_models.UpdateRun"]: - """List UpdateRun resources by Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :return: An iterator like instance of either UpdateRun or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.UpdateRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-02-02-preview") - ) - cls: ClsType[_models.UpdateRunListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_fleet_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("UpdateRunListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get(self, resource_group_name: str, fleet_name: str, update_run_name: str, **kwargs: Any) -> _models.UpdateRun: - """Get a UpdateRun. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_run_name: The name of the UpdateRun resource. Required. - :type update_run_name: str - :return: UpdateRun or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.UpdateRun - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-02-02-preview") - ) - cls: ClsType[_models.UpdateRun] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("UpdateRun", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - resource: Union[_models.UpdateRun, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-02-02-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "UpdateRun") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - resource: _models.UpdateRun, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.UpdateRun]: - """Create a UpdateRun. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_run_name: The name of the UpdateRun resource. Required. - :type update_run_name: str - :param resource: Resource create parameters. Required. - :type resource: ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.UpdateRun - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either UpdateRun or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.UpdateRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - resource: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.UpdateRun]: - """Create a UpdateRun. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_run_name: The name of the UpdateRun resource. Required. - :type update_run_name: str - :param resource: Resource create parameters. Required. - :type resource: IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either UpdateRun or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.UpdateRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - resource: Union[_models.UpdateRun, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[_models.UpdateRun]: - """Create a UpdateRun. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_run_name: The name of the UpdateRun resource. Required. - :type update_run_name: str - :param resource: Resource create parameters. Is either a UpdateRun type or a IO[bytes] type. - Required. - :type resource: ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.UpdateRun or - IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :return: An instance of LROPoller that returns either UpdateRun or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.UpdateRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-02-02-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.UpdateRun] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - resource=resource, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("UpdateRun", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.UpdateRun].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.UpdateRun]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-02-02-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[None]: - """Delete a UpdateRun. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_run_name: The name of the UpdateRun resource. Required. - :type update_run_name: str - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-02-02-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - if_match=if_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _skip_initial( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - body: Union[_models.SkipProperties, IO[bytes]], - if_match: Optional[str] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-02-02-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _json = self._serialize.body(body, "SkipProperties") - - _request = build_skip_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_skip( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - body: _models.SkipProperties, - if_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.UpdateRun]: - """Skips one or a combination of member/group/stage/afterStageWait(s) of an update run. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_run_name: The name of the UpdateRun resource. Required. - :type update_run_name: str - :param body: The content of the action request. Required. - :type body: ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.SkipProperties - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either UpdateRun or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.UpdateRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_skip( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - body: IO[bytes], - if_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.UpdateRun]: - """Skips one or a combination of member/group/stage/afterStageWait(s) of an update run. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_run_name: The name of the UpdateRun resource. Required. - :type update_run_name: str - :param body: The content of the action request. Required. - :type body: IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either UpdateRun or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.UpdateRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_skip( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - body: Union[_models.SkipProperties, IO[bytes]], - if_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[_models.UpdateRun]: - """Skips one or a combination of member/group/stage/afterStageWait(s) of an update run. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_run_name: The name of the UpdateRun resource. Required. - :type update_run_name: str - :param body: The content of the action request. Is either a SkipProperties type or a IO[bytes] - type. Required. - :type body: ~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.SkipProperties or - IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :return: An instance of LROPoller that returns either UpdateRun or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.UpdateRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-02-02-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.UpdateRun] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._skip_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - body=body, - if_match=if_match, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("UpdateRun", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.UpdateRun].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.UpdateRun]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _start_initial( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-02-02-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_start_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_start( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[_models.UpdateRun]: - """Starts an UpdateRun. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_run_name: The name of the UpdateRun resource. Required. - :type update_run_name: str - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :return: An instance of LROPoller that returns either UpdateRun or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.UpdateRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-02-02-preview") - ) - cls: ClsType[_models.UpdateRun] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._start_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - if_match=if_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("UpdateRun", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.UpdateRun].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.UpdateRun]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _stop_initial( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-02-02-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_stop_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_stop( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[_models.UpdateRun]: - """Stops an UpdateRun. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_run_name: The name of the UpdateRun resource. Required. - :type update_run_name: str - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :return: An instance of LROPoller that returns either UpdateRun or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2024_02_02_preview.models.UpdateRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-02-02-preview") - ) - cls: ClsType[_models.UpdateRun] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._stop_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - if_match=if_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("UpdateRun", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.UpdateRun].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.UpdateRun]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/py.typed b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/py.typed deleted file mode 100644 index e5aff4f83af86..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/py.typed +++ /dev/null @@ -1 +0,0 @@ -# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_04_01/__init__.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_04_01/__init__.py deleted file mode 100644 index 78b8b4b91a49e..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_04_01/__init__.py +++ /dev/null @@ -1,26 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._container_service_fleet_mgmt_client import ContainerServiceFleetMgmtClient -from ._version import VERSION - -__version__ = VERSION - -try: - from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ContainerServiceFleetMgmtClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) - -_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_04_01/_configuration.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_04_01/_configuration.py deleted file mode 100644 index 272c39b1f573b..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_04_01/_configuration.py +++ /dev/null @@ -1,65 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any, TYPE_CHECKING - -from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy - -from ._version import VERSION - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials import TokenCredential - - -class ContainerServiceFleetMgmtClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long - """Configuration for ContainerServiceFleetMgmtClient. - - 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. Required. - :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :keyword api_version: Api Version. Default value is "2024-04-01". Note that overriding this - default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2024-04-01") - - if credential is None: - raise ValueError("Parameter 'credential' must not be None.") - if subscription_id is None: - raise ValueError("Parameter 'subscription_id' must not be None.") - - self.credential = credential - self.subscription_id = subscription_id - self.api_version = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-containerservicefleet/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - 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.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") - if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_04_01/_container_service_fleet_mgmt_client.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_04_01/_container_service_fleet_mgmt_client.py deleted file mode 100644 index 8c71a4a070591..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_04_01/_container_service_fleet_mgmt_client.py +++ /dev/null @@ -1,139 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, TYPE_CHECKING -from typing_extensions import Self - -from azure.core.pipeline import policies -from azure.core.rest import HttpRequest, HttpResponse -from azure.mgmt.core import ARMPipelineClient -from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy - -from . import models as _models -from .._serialization import Deserializer, Serializer -from ._configuration import ContainerServiceFleetMgmtClientConfiguration -from .operations import ( - FleetMembersOperations, - FleetUpdateStrategiesOperations, - FleetsOperations, - Operations, - UpdateRunsOperations, -) - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials import TokenCredential - - -class ContainerServiceFleetMgmtClient: # pylint: disable=client-accepts-api-version-keyword - """Azure Kubernetes Fleet Manager api client. - - :ivar operations: Operations operations - :vartype operations: azure.mgmt.containerservicefleet.v2024_04_01.operations.Operations - :ivar fleets: FleetsOperations operations - :vartype fleets: azure.mgmt.containerservicefleet.v2024_04_01.operations.FleetsOperations - :ivar fleet_members: FleetMembersOperations operations - :vartype fleet_members: - azure.mgmt.containerservicefleet.v2024_04_01.operations.FleetMembersOperations - :ivar update_runs: UpdateRunsOperations operations - :vartype update_runs: - azure.mgmt.containerservicefleet.v2024_04_01.operations.UpdateRunsOperations - :ivar fleet_update_strategies: FleetUpdateStrategiesOperations operations - :vartype fleet_update_strategies: - azure.mgmt.containerservicefleet.v2024_04_01.operations.FleetUpdateStrategiesOperations - :param credential: Credential needed for the client to connect to Azure. Required. - :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". - :type base_url: str - :keyword api_version: Api Version. Default value is "2024-04-01". Note that overriding this - default value may result in unsupported behavior. - :paramtype api_version: str - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - """ - - def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any - ) -> None: - self._config = ContainerServiceFleetMgmtClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs - ) - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - ARMAutoResourceProviderRegistrationPolicy(), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) - - client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer(client_models) - self._deserialize = Deserializer(client_models) - self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize, "2024-04-01") - self.fleets = FleetsOperations(self._client, self._config, self._serialize, self._deserialize, "2024-04-01") - self.fleet_members = FleetMembersOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-04-01" - ) - self.update_runs = UpdateRunsOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-04-01" - ) - self.fleet_update_strategies = FleetUpdateStrategiesOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-04-01" - ) - - def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.HttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore - - def close(self) -> None: - self._client.close() - - def __enter__(self) -> Self: - self._client.__enter__() - return self - - def __exit__(self, *exc_details: Any) -> None: - self._client.__exit__(*exc_details) diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_04_01/_metadata.json b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_04_01/_metadata.json deleted file mode 100644 index 78c2bc67abaea..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_04_01/_metadata.json +++ /dev/null @@ -1,114 +0,0 @@ -{ - "chosen_version": "2024-04-01", - "total_api_version_list": ["2024-04-01"], - "client": { - "name": "ContainerServiceFleetMgmtClient", - "filename": "_container_service_fleet_mgmt_client", - "description": "Azure Kubernetes Fleet Manager api client.", - "host_value": "\"https://management.azure.com\"", - "parameterized_host_template": null, - "azure_arm": true, - "has_public_lro_operations": true, - "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ContainerServiceFleetMgmtClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ContainerServiceFleetMgmtClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" - }, - "global_parameters": { - "sync": { - "credential": { - "signature": "credential: \"TokenCredential\",", - "description": "Credential needed for the client to connect to Azure. Required.", - "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true, - "method_location": "positional" - }, - "subscription_id": { - "signature": "subscription_id: str,", - "description": "The ID of the target subscription. Required.", - "docstring_type": "str", - "required": true, - "method_location": "positional" - } - }, - "async": { - "credential": { - "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure. Required.", - "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", - "required": true - }, - "subscription_id": { - "signature": "subscription_id: str,", - "description": "The ID of the target subscription. Required.", - "docstring_type": "str", - "required": true - } - }, - "constant": { - }, - "call": "credential, subscription_id", - "service_client_specific": { - "sync": { - "api_version": { - "signature": "api_version: Optional[str]=None,", - "description": "API version to use if no profile is provided, or if missing in profile.", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", - "description": "Service URL", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "profile": { - "signature": "profile: KnownProfiles=KnownProfiles.default,", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false, - "method_location": "positional" - } - }, - "async": { - "api_version": { - "signature": "api_version: Optional[str] = None,", - "description": "API version to use if no profile is provided, or if missing in profile.", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", - "description": "Service URL", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "profile": { - "signature": "profile: KnownProfiles = KnownProfiles.default,", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false, - "method_location": "positional" - } - } - } - }, - "config": { - "credential": true, - "credential_scopes": ["https://management.azure.com/.default"], - "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", - "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", - "sync_imports": "{\"regular\": {\"sdkcore\": {\"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"sdkcore\": {\"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" - }, - "operation_groups": { - "operations": "Operations", - "fleets": "FleetsOperations", - "fleet_members": "FleetMembersOperations", - "update_runs": "UpdateRunsOperations", - "fleet_update_strategies": "FleetUpdateStrategiesOperations" - } -} diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_04_01/_patch.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_04_01/_patch.py deleted file mode 100644 index f7dd32510333d..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_04_01/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_04_01/_version.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_04_01/_version.py deleted file mode 100644 index 83f24ab509461..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_04_01/_version.py +++ /dev/null @@ -1,9 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -VERSION = "2.1.0" diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_04_01/aio/__init__.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_04_01/aio/__init__.py deleted file mode 100644 index af1d7b0b47fe9..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_04_01/aio/__init__.py +++ /dev/null @@ -1,23 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._container_service_fleet_mgmt_client import ContainerServiceFleetMgmtClient - -try: - from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ContainerServiceFleetMgmtClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) - -_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_04_01/aio/_configuration.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_04_01/aio/_configuration.py deleted file mode 100644 index 8473d07bde9cd..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_04_01/aio/_configuration.py +++ /dev/null @@ -1,65 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any, TYPE_CHECKING - -from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy - -from .._version import VERSION - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential - - -class ContainerServiceFleetMgmtClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long - """Configuration for ContainerServiceFleetMgmtClient. - - 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. Required. - :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :keyword api_version: Api Version. Default value is "2024-04-01". Note that overriding this - default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2024-04-01") - - if credential is None: - raise ValueError("Parameter 'credential' must not be None.") - if subscription_id is None: - raise ValueError("Parameter 'subscription_id' must not be None.") - - self.credential = credential - self.subscription_id = subscription_id - self.api_version = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-containerservicefleet/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - 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.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") - if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_04_01/aio/_container_service_fleet_mgmt_client.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_04_01/aio/_container_service_fleet_mgmt_client.py deleted file mode 100644 index 531d4b5b0a518..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_04_01/aio/_container_service_fleet_mgmt_client.py +++ /dev/null @@ -1,141 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING -from typing_extensions import Self - -from azure.core.pipeline import policies -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.mgmt.core import AsyncARMPipelineClient -from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy - -from .. import models as _models -from ..._serialization import Deserializer, Serializer -from ._configuration import ContainerServiceFleetMgmtClientConfiguration -from .operations import ( - FleetMembersOperations, - FleetUpdateStrategiesOperations, - FleetsOperations, - Operations, - UpdateRunsOperations, -) - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential - - -class ContainerServiceFleetMgmtClient: # pylint: disable=client-accepts-api-version-keyword - """Azure Kubernetes Fleet Manager api client. - - :ivar operations: Operations operations - :vartype operations: azure.mgmt.containerservicefleet.v2024_04_01.aio.operations.Operations - :ivar fleets: FleetsOperations operations - :vartype fleets: azure.mgmt.containerservicefleet.v2024_04_01.aio.operations.FleetsOperations - :ivar fleet_members: FleetMembersOperations operations - :vartype fleet_members: - azure.mgmt.containerservicefleet.v2024_04_01.aio.operations.FleetMembersOperations - :ivar update_runs: UpdateRunsOperations operations - :vartype update_runs: - azure.mgmt.containerservicefleet.v2024_04_01.aio.operations.UpdateRunsOperations - :ivar fleet_update_strategies: FleetUpdateStrategiesOperations operations - :vartype fleet_update_strategies: - azure.mgmt.containerservicefleet.v2024_04_01.aio.operations.FleetUpdateStrategiesOperations - :param credential: Credential needed for the client to connect to Azure. Required. - :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". - :type base_url: str - :keyword api_version: Api Version. Default value is "2024-04-01". Note that overriding this - default value may result in unsupported behavior. - :paramtype api_version: str - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - """ - - def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any - ) -> None: - self._config = ContainerServiceFleetMgmtClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs - ) - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - AsyncARMAutoResourceProviderRegistrationPolicy(), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) - - client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer(client_models) - self._deserialize = Deserializer(client_models) - self._serialize.client_side_validation = False - self.operations = Operations(self._client, self._config, self._serialize, self._deserialize, "2024-04-01") - self.fleets = FleetsOperations(self._client, self._config, self._serialize, self._deserialize, "2024-04-01") - self.fleet_members = FleetMembersOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-04-01" - ) - self.update_runs = UpdateRunsOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-04-01" - ) - self.fleet_update_strategies = FleetUpdateStrategiesOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-04-01" - ) - - def _send_request( - self, request: HttpRequest, *, stream: bool = False, **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = await client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.AsyncHttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore - - async def close(self) -> None: - await self._client.close() - - async def __aenter__(self) -> Self: - await self._client.__aenter__() - return self - - async def __aexit__(self, *exc_details: Any) -> None: - await self._client.__aexit__(*exc_details) diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_04_01/aio/_patch.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_04_01/aio/_patch.py deleted file mode 100644 index f7dd32510333d..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_04_01/aio/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_04_01/aio/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_04_01/aio/operations/__init__.py deleted file mode 100644 index 2233c34e005ae..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_04_01/aio/operations/__init__.py +++ /dev/null @@ -1,27 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._operations import Operations -from ._fleets_operations import FleetsOperations -from ._fleet_members_operations import FleetMembersOperations -from ._update_runs_operations import UpdateRunsOperations -from ._fleet_update_strategies_operations import FleetUpdateStrategiesOperations - -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "Operations", - "FleetsOperations", - "FleetMembersOperations", - "UpdateRunsOperations", - "FleetUpdateStrategiesOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_04_01/aio/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_04_01/aio/operations/_operations.py deleted file mode 100644 index 77500c482e937..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_04_01/aio/operations/_operations.py +++ /dev/null @@ -1,132 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ...operations._operations import build_list_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class Operations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.containerservicefleet.v2024_04_01.aio.ContainerServiceFleetMgmtClient`'s - :attr:`operations` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: - """List the operations for the provider. - - :return: An iterator like instance of either Operation or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservicefleet.v2024_04_01.models.Operation] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._api_version or "2024-04-01")) - cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("OperationListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_04_01/aio/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_04_01/aio/operations/_patch.py deleted file mode 100644 index f7dd32510333d..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_04_01/aio/operations/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_04_01/models/__init__.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_04_01/models/__init__.py deleted file mode 100644 index 3d046c8269569..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_04_01/models/__init__.py +++ /dev/null @@ -1,127 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._models_py3 import APIServerAccessProfile -from ._models_py3 import AgentProfile -from ._models_py3 import ErrorAdditionalInfo -from ._models_py3 import ErrorDetail -from ._models_py3 import ErrorResponse -from ._models_py3 import Fleet -from ._models_py3 import FleetCredentialResult -from ._models_py3 import FleetCredentialResults -from ._models_py3 import FleetHubProfile -from ._models_py3 import FleetListResult -from ._models_py3 import FleetMember -from ._models_py3 import FleetMemberListResult -from ._models_py3 import FleetMemberUpdate -from ._models_py3 import FleetPatch -from ._models_py3 import FleetUpdateStrategy -from ._models_py3 import FleetUpdateStrategyListResult -from ._models_py3 import ManagedClusterUpdate -from ._models_py3 import ManagedClusterUpgradeSpec -from ._models_py3 import ManagedServiceIdentity -from ._models_py3 import MemberUpdateStatus -from ._models_py3 import NodeImageSelection -from ._models_py3 import NodeImageSelectionStatus -from ._models_py3 import NodeImageVersion -from ._models_py3 import Operation -from ._models_py3 import OperationDisplay -from ._models_py3 import OperationListResult -from ._models_py3 import ProxyResource -from ._models_py3 import Resource -from ._models_py3 import SkipProperties -from ._models_py3 import SkipTarget -from ._models_py3 import SystemData -from ._models_py3 import TrackedResource -from ._models_py3 import UpdateGroup -from ._models_py3 import UpdateGroupStatus -from ._models_py3 import UpdateRun -from ._models_py3 import UpdateRunListResult -from ._models_py3 import UpdateRunStatus -from ._models_py3 import UpdateRunStrategy -from ._models_py3 import UpdateStage -from ._models_py3 import UpdateStageStatus -from ._models_py3 import UpdateStatus -from ._models_py3 import UserAssignedIdentity -from ._models_py3 import WaitStatus - -from ._container_service_fleet_mgmt_client_enums import ActionType -from ._container_service_fleet_mgmt_client_enums import CreatedByType -from ._container_service_fleet_mgmt_client_enums import FleetMemberProvisioningState -from ._container_service_fleet_mgmt_client_enums import FleetProvisioningState -from ._container_service_fleet_mgmt_client_enums import FleetUpdateStrategyProvisioningState -from ._container_service_fleet_mgmt_client_enums import ManagedClusterUpgradeType -from ._container_service_fleet_mgmt_client_enums import ManagedServiceIdentityType -from ._container_service_fleet_mgmt_client_enums import NodeImageSelectionType -from ._container_service_fleet_mgmt_client_enums import Origin -from ._container_service_fleet_mgmt_client_enums import TargetType -from ._container_service_fleet_mgmt_client_enums import UpdateRunProvisioningState -from ._container_service_fleet_mgmt_client_enums import UpdateState -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "APIServerAccessProfile", - "AgentProfile", - "ErrorAdditionalInfo", - "ErrorDetail", - "ErrorResponse", - "Fleet", - "FleetCredentialResult", - "FleetCredentialResults", - "FleetHubProfile", - "FleetListResult", - "FleetMember", - "FleetMemberListResult", - "FleetMemberUpdate", - "FleetPatch", - "FleetUpdateStrategy", - "FleetUpdateStrategyListResult", - "ManagedClusterUpdate", - "ManagedClusterUpgradeSpec", - "ManagedServiceIdentity", - "MemberUpdateStatus", - "NodeImageSelection", - "NodeImageSelectionStatus", - "NodeImageVersion", - "Operation", - "OperationDisplay", - "OperationListResult", - "ProxyResource", - "Resource", - "SkipProperties", - "SkipTarget", - "SystemData", - "TrackedResource", - "UpdateGroup", - "UpdateGroupStatus", - "UpdateRun", - "UpdateRunListResult", - "UpdateRunStatus", - "UpdateRunStrategy", - "UpdateStage", - "UpdateStageStatus", - "UpdateStatus", - "UserAssignedIdentity", - "WaitStatus", - "ActionType", - "CreatedByType", - "FleetMemberProvisioningState", - "FleetProvisioningState", - "FleetUpdateStrategyProvisioningState", - "ManagedClusterUpgradeType", - "ManagedServiceIdentityType", - "NodeImageSelectionType", - "Origin", - "TargetType", - "UpdateRunProvisioningState", - "UpdateState", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_04_01/models/_container_service_fleet_mgmt_client_enums.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_04_01/models/_container_service_fleet_mgmt_client_enums.py deleted file mode 100644 index 19e28171fd83b..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_04_01/models/_container_service_fleet_mgmt_client_enums.py +++ /dev/null @@ -1,167 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from enum import Enum -from azure.core import CaseInsensitiveEnumMeta - - -class ActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs.""" - - INTERNAL = "Internal" - - -class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of identity that created the resource.""" - - USER = "User" - APPLICATION = "Application" - MANAGED_IDENTITY = "ManagedIdentity" - KEY = "Key" - - -class FleetMemberProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The provisioning state of the last accepted operation.""" - - SUCCEEDED = "Succeeded" - """Resource has been created.""" - FAILED = "Failed" - """Resource creation failed.""" - CANCELED = "Canceled" - """Resource creation was canceled.""" - JOINING = "Joining" - """The provisioning state of a member joining a fleet.""" - LEAVING = "Leaving" - """The provisioning state of a member leaving a fleet.""" - UPDATING = "Updating" - """The provisioning state of a member being updated.""" - - -class FleetProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The provisioning state of the last accepted operation.""" - - SUCCEEDED = "Succeeded" - """Resource has been created.""" - FAILED = "Failed" - """Resource creation failed.""" - CANCELED = "Canceled" - """Resource creation was canceled.""" - CREATING = "Creating" - """The provisioning state of a fleet being created.""" - UPDATING = "Updating" - """The provisioning state of a fleet being updated.""" - DELETING = "Deleting" - """The provisioning state of a fleet being deleted.""" - - -class FleetUpdateStrategyProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The provisioning state of the UpdateStrategy resource.""" - - SUCCEEDED = "Succeeded" - """Resource has been created.""" - FAILED = "Failed" - """Resource creation failed.""" - CANCELED = "Canceled" - """Resource creation was canceled.""" - - -class ManagedClusterUpgradeType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of upgrade to perform when targeting ManagedClusters.""" - - FULL = "Full" - """Full upgrades the control plane and all agent pools of the target ManagedClusters. Requires the - ManagedClusterUpgradeSpec.KubernetesVersion property to be set.""" - NODE_IMAGE_ONLY = "NodeImageOnly" - """NodeImageOnly upgrades only the node images of the target ManagedClusters. Requires the - ManagedClusterUpgradeSpec.KubernetesVersion property to NOT be set.""" - CONTROL_PLANE_ONLY = "ControlPlaneOnly" - """ControlPlaneOnly upgrades only targets the KubernetesVersion of the ManagedClusters and will - not be applied to the AgentPool. Requires the ManagedClusterUpgradeSpec.KubernetesVersion - property to be set.""" - - -class ManagedServiceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of managed service identity (where both SystemAssigned and UserAssigned types are - allowed). - """ - - NONE = "None" - SYSTEM_ASSIGNED = "SystemAssigned" - USER_ASSIGNED = "UserAssigned" - SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned, UserAssigned" - - -class NodeImageSelectionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The node image upgrade type.""" - - LATEST = "Latest" - """Use the latest image version when upgrading nodes. Clusters may use different image versions - (e.g., 'AKSUbuntu-1804gen2containerd-2021.10.12' and 'AKSUbuntu-1804gen2containerd-2021.10.19') - because, for example, the latest available version is different in different regions.""" - CONSISTENT = "Consistent" - """The image versions to upgrade nodes to are selected as described below: for each node pool in - managed clusters affected by the update run, the system selects the latest image version such - that it is available across all other node pools (in all other clusters) of the same image - type. As a result, all node pools of the same image type will be upgraded to the same image - version. For example, if the latest image version for image type 'AKSUbuntu-1804gen2containerd' - is 'AKSUbuntu-1804gen2containerd-2021.10.12' for a node pool in cluster A in region X, and is - 'AKSUbuntu-1804gen2containerd-2021.10.17' for a node pool in cluster B in region Y, the system - will upgrade both node pools to image version 'AKSUbuntu-1804gen2containerd-2021.10.12'.""" - - -class Origin(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit - logs UX. Default value is "user,system". - """ - - USER = "user" - SYSTEM = "system" - USER_SYSTEM = "user,system" - - -class TargetType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The target type of a skip request.""" - - MEMBER = "Member" - """Skip the update of a member.""" - GROUP = "Group" - """Skip the update of a group.""" - STAGE = "Stage" - """Skip the update of an entire stage including the after stage wait.""" - AFTER_STAGE_WAIT = "AfterStageWait" - """Skip the update of the after stage wait of a certain stage.""" - - -class UpdateRunProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The provisioning state of the UpdateRun resource.""" - - SUCCEEDED = "Succeeded" - """Resource has been created.""" - FAILED = "Failed" - """Resource creation failed.""" - CANCELED = "Canceled" - """Resource creation was canceled.""" - - -class UpdateState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The state of the UpdateRun, UpdateStage, UpdateGroup, or MemberUpdate.""" - - NOT_STARTED = "NotStarted" - """The state of an UpdateRun/UpdateStage/UpdateGroup/MemberUpdate that has not been started.""" - RUNNING = "Running" - """The state of an UpdateRun/UpdateStage/UpdateGroup/MemberUpdate that is running.""" - STOPPING = "Stopping" - """The state of an UpdateRun/UpdateStage/UpdateGroup/MemberUpdate that is being stopped.""" - STOPPED = "Stopped" - """The state of an UpdateRun/UpdateStage/UpdateGroup/MemberUpdate that has stopped.""" - SKIPPED = "Skipped" - """The state of an UpdateRun/UpdateStage/UpdateGroup/MemberUpdate that has been skipped.""" - FAILED = "Failed" - """The state of an UpdateRun/UpdateStage/UpdateGroup/MemberUpdate that has failed.""" - COMPLETED = "Completed" - """The state of an UpdateRun/UpdateStage/UpdateGroup/MemberUpdate that has completed.""" diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_04_01/models/_patch.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_04_01/models/_patch.py deleted file mode 100644 index f7dd32510333d..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_04_01/models/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_04_01/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_04_01/operations/__init__.py deleted file mode 100644 index 2233c34e005ae..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_04_01/operations/__init__.py +++ /dev/null @@ -1,27 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._operations import Operations -from ._fleets_operations import FleetsOperations -from ._fleet_members_operations import FleetMembersOperations -from ._update_runs_operations import UpdateRunsOperations -from ._fleet_update_strategies_operations import FleetUpdateStrategiesOperations - -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "Operations", - "FleetsOperations", - "FleetMembersOperations", - "UpdateRunsOperations", - "FleetUpdateStrategiesOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_04_01/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_04_01/operations/_patch.py deleted file mode 100644 index f7dd32510333d..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_04_01/operations/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_04_01/py.typed b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_04_01/py.typed deleted file mode 100644 index e5aff4f83af86..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_04_01/py.typed +++ /dev/null @@ -1 +0,0 @@ -# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_05_02_preview/__init__.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_05_02_preview/__init__.py deleted file mode 100644 index 78b8b4b91a49e..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_05_02_preview/__init__.py +++ /dev/null @@ -1,26 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._container_service_fleet_mgmt_client import ContainerServiceFleetMgmtClient -from ._version import VERSION - -__version__ = VERSION - -try: - from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ContainerServiceFleetMgmtClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) - -_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_05_02_preview/_configuration.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_05_02_preview/_configuration.py deleted file mode 100644 index 6c1928ca11800..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_05_02_preview/_configuration.py +++ /dev/null @@ -1,65 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any, TYPE_CHECKING - -from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMChallengeAuthenticationPolicy, ARMHttpLoggingPolicy - -from ._version import VERSION - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials import TokenCredential - - -class ContainerServiceFleetMgmtClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long - """Configuration for ContainerServiceFleetMgmtClient. - - 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. Required. - :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :keyword api_version: Api Version. Default value is "2024-05-02-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__(self, credential: "TokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2024-05-02-preview") - - if credential is None: - raise ValueError("Parameter 'credential' must not be None.") - if subscription_id is None: - raise ValueError("Parameter 'subscription_id' must not be None.") - - self.credential = credential - self.subscription_id = subscription_id - self.api_version = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-containerservicefleet/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - 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.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.RedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.RetryPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") - if self.credential and not self.authentication_policy: - self.authentication_policy = ARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_05_02_preview/_container_service_fleet_mgmt_client.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_05_02_preview/_container_service_fleet_mgmt_client.py deleted file mode 100644 index 50d967212b013..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_05_02_preview/_container_service_fleet_mgmt_client.py +++ /dev/null @@ -1,151 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, TYPE_CHECKING -from typing_extensions import Self - -from azure.core.pipeline import policies -from azure.core.rest import HttpRequest, HttpResponse -from azure.mgmt.core import ARMPipelineClient -from azure.mgmt.core.policies import ARMAutoResourceProviderRegistrationPolicy - -from . import models as _models -from .._serialization import Deserializer, Serializer -from ._configuration import ContainerServiceFleetMgmtClientConfiguration -from .operations import ( - AutoUpgradeProfilesOperations, - FleetMembersOperations, - FleetUpdateStrategiesOperations, - FleetsOperations, - Operations, - UpdateRunsOperations, -) - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials import TokenCredential - - -class ContainerServiceFleetMgmtClient: # pylint: disable=client-accepts-api-version-keyword - """Azure Kubernetes Fleet Manager api client. - - :ivar operations: Operations operations - :vartype operations: azure.mgmt.containerservicefleet.v2024_05_02_preview.operations.Operations - :ivar fleets: FleetsOperations operations - :vartype fleets: - azure.mgmt.containerservicefleet.v2024_05_02_preview.operations.FleetsOperations - :ivar auto_upgrade_profiles: AutoUpgradeProfilesOperations operations - :vartype auto_upgrade_profiles: - azure.mgmt.containerservicefleet.v2024_05_02_preview.operations.AutoUpgradeProfilesOperations - :ivar fleet_members: FleetMembersOperations operations - :vartype fleet_members: - azure.mgmt.containerservicefleet.v2024_05_02_preview.operations.FleetMembersOperations - :ivar update_runs: UpdateRunsOperations operations - :vartype update_runs: - azure.mgmt.containerservicefleet.v2024_05_02_preview.operations.UpdateRunsOperations - :ivar fleet_update_strategies: FleetUpdateStrategiesOperations operations - :vartype fleet_update_strategies: - azure.mgmt.containerservicefleet.v2024_05_02_preview.operations.FleetUpdateStrategiesOperations - :param credential: Credential needed for the client to connect to Azure. Required. - :type credential: ~azure.core.credentials.TokenCredential - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". - :type base_url: str - :keyword api_version: Api Version. Default value is "2024-05-02-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - """ - - def __init__( - self, - credential: "TokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any - ) -> None: - self._config = ContainerServiceFleetMgmtClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs - ) - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - ARMAutoResourceProviderRegistrationPolicy(), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) - - client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer(client_models) - self._deserialize = Deserializer(client_models) - self._serialize.client_side_validation = False - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize, "2024-05-02-preview" - ) - self.fleets = FleetsOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-05-02-preview" - ) - self.auto_upgrade_profiles = AutoUpgradeProfilesOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-05-02-preview" - ) - self.fleet_members = FleetMembersOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-05-02-preview" - ) - self.update_runs = UpdateRunsOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-05-02-preview" - ) - self.fleet_update_strategies = FleetUpdateStrategiesOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-05-02-preview" - ) - - def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.HttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore - - def close(self) -> None: - self._client.close() - - def __enter__(self) -> Self: - self._client.__enter__() - return self - - def __exit__(self, *exc_details: Any) -> None: - self._client.__exit__(*exc_details) diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_05_02_preview/_metadata.json b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_05_02_preview/_metadata.json deleted file mode 100644 index b03a64e297d57..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_05_02_preview/_metadata.json +++ /dev/null @@ -1,115 +0,0 @@ -{ - "chosen_version": "2024-05-02-preview", - "total_api_version_list": ["2024-05-02-preview"], - "client": { - "name": "ContainerServiceFleetMgmtClient", - "filename": "_container_service_fleet_mgmt_client", - "description": "Azure Kubernetes Fleet Manager api client.", - "host_value": "\"https://management.azure.com\"", - "parameterized_host_template": null, - "azure_arm": true, - "has_public_lro_operations": true, - "client_side_validation": false, - "sync_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"ARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ContainerServiceFleetMgmtClientConfiguration\"], \".._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"conditional\": {\"stdlib\": {\"typing\": [\"Any\", \"Optional\"]}}, \"regular\": {\"sdkcore\": {\"azure.mgmt.core\": [\"AsyncARMPipelineClient\"], \"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"AsyncARMAutoResourceProviderRegistrationPolicy\"], \"azure.profiles\": [\"KnownProfiles\", \"ProfileDefinition\"], \"azure.profiles.multiapiclient\": [\"MultiApiClientMixin\"]}, \"local\": {\"._configuration\": [\"ContainerServiceFleetMgmtClientConfiguration\"], \"..._serialization\": [\"Deserializer\", \"Serializer\"]}, \"stdlib\": {\"typing_extensions\": [\"Self\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" - }, - "global_parameters": { - "sync": { - "credential": { - "signature": "credential: \"TokenCredential\",", - "description": "Credential needed for the client to connect to Azure. Required.", - "docstring_type": "~azure.core.credentials.TokenCredential", - "required": true, - "method_location": "positional" - }, - "subscription_id": { - "signature": "subscription_id: str,", - "description": "The ID of the target subscription. Required.", - "docstring_type": "str", - "required": true, - "method_location": "positional" - } - }, - "async": { - "credential": { - "signature": "credential: \"AsyncTokenCredential\",", - "description": "Credential needed for the client to connect to Azure. Required.", - "docstring_type": "~azure.core.credentials_async.AsyncTokenCredential", - "required": true - }, - "subscription_id": { - "signature": "subscription_id: str,", - "description": "The ID of the target subscription. Required.", - "docstring_type": "str", - "required": true - } - }, - "constant": { - }, - "call": "credential, subscription_id", - "service_client_specific": { - "sync": { - "api_version": { - "signature": "api_version: Optional[str]=None,", - "description": "API version to use if no profile is provided, or if missing in profile.", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", - "description": "Service URL", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "profile": { - "signature": "profile: KnownProfiles=KnownProfiles.default,", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false, - "method_location": "positional" - } - }, - "async": { - "api_version": { - "signature": "api_version: Optional[str] = None,", - "description": "API version to use if no profile is provided, or if missing in profile.", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "base_url": { - "signature": "base_url: str = \"https://management.azure.com\",", - "description": "Service URL", - "docstring_type": "str", - "required": false, - "method_location": "positional" - }, - "profile": { - "signature": "profile: KnownProfiles = KnownProfiles.default,", - "description": "A profile definition, from KnownProfiles to dict.", - "docstring_type": "azure.profiles.KnownProfiles", - "required": false, - "method_location": "positional" - } - } - } - }, - "config": { - "credential": true, - "credential_scopes": ["https://management.azure.com/.default"], - "credential_call_sync": "ARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", - "credential_call_async": "AsyncARMChallengeAuthenticationPolicy(self.credential, *self.credential_scopes, **kwargs)", - "sync_imports": "{\"regular\": {\"sdkcore\": {\"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMChallengeAuthenticationPolicy\", \"ARMHttpLoggingPolicy\"]}, \"local\": {\"._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials\": [\"TokenCredential\"]}}}", - "async_imports": "{\"regular\": {\"sdkcore\": {\"azure.core.pipeline\": [\"policies\"], \"azure.mgmt.core.policies\": [\"ARMHttpLoggingPolicy\", \"AsyncARMChallengeAuthenticationPolicy\"]}, \"local\": {\".._version\": [\"VERSION\"]}}, \"conditional\": {\"stdlib\": {\"typing\": [\"Any\"]}}, \"typing\": {\"sdkcore\": {\"azure.core.credentials_async\": [\"AsyncTokenCredential\"]}}}" - }, - "operation_groups": { - "operations": "Operations", - "fleets": "FleetsOperations", - "auto_upgrade_profiles": "AutoUpgradeProfilesOperations", - "fleet_members": "FleetMembersOperations", - "update_runs": "UpdateRunsOperations", - "fleet_update_strategies": "FleetUpdateStrategiesOperations" - } -} diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_05_02_preview/_patch.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_05_02_preview/_patch.py deleted file mode 100644 index f7dd32510333d..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_05_02_preview/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_05_02_preview/_version.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_05_02_preview/_version.py deleted file mode 100644 index 83f24ab509461..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_05_02_preview/_version.py +++ /dev/null @@ -1,9 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -VERSION = "2.1.0" diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_05_02_preview/aio/__init__.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_05_02_preview/aio/__init__.py deleted file mode 100644 index af1d7b0b47fe9..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_05_02_preview/aio/__init__.py +++ /dev/null @@ -1,23 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._container_service_fleet_mgmt_client import ContainerServiceFleetMgmtClient - -try: - from ._patch import __all__ as _patch_all - from ._patch import * # pylint: disable=unused-wildcard-import -except ImportError: - _patch_all = [] -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "ContainerServiceFleetMgmtClient", -] -__all__.extend([p for p in _patch_all if p not in __all__]) - -_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_05_02_preview/aio/_configuration.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_05_02_preview/aio/_configuration.py deleted file mode 100644 index 4179e4fdac5a7..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_05_02_preview/aio/_configuration.py +++ /dev/null @@ -1,65 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from typing import Any, TYPE_CHECKING - -from azure.core.pipeline import policies -from azure.mgmt.core.policies import ARMHttpLoggingPolicy, AsyncARMChallengeAuthenticationPolicy - -from .._version import VERSION - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential - - -class ContainerServiceFleetMgmtClientConfiguration: # pylint: disable=too-many-instance-attributes,name-too-long - """Configuration for ContainerServiceFleetMgmtClient. - - 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. Required. - :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :keyword api_version: Api Version. Default value is "2024-05-02-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - """ - - def __init__(self, credential: "AsyncTokenCredential", subscription_id: str, **kwargs: Any) -> None: - api_version: str = kwargs.pop("api_version", "2024-05-02-preview") - - if credential is None: - raise ValueError("Parameter 'credential' must not be None.") - if subscription_id is None: - raise ValueError("Parameter 'subscription_id' must not be None.") - - self.credential = credential - self.subscription_id = subscription_id - self.api_version = api_version - self.credential_scopes = kwargs.pop("credential_scopes", ["https://management.azure.com/.default"]) - kwargs.setdefault("sdk_moniker", "mgmt-containerservicefleet/{}".format(VERSION)) - self.polling_interval = kwargs.get("polling_interval", 30) - 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.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs) - self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs) - self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs) - self.authentication_policy = kwargs.get("authentication_policy") - if self.credential and not self.authentication_policy: - self.authentication_policy = AsyncARMChallengeAuthenticationPolicy( - self.credential, *self.credential_scopes, **kwargs - ) diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_05_02_preview/aio/_container_service_fleet_mgmt_client.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_05_02_preview/aio/_container_service_fleet_mgmt_client.py deleted file mode 100644 index 458390c7af0f3..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_05_02_preview/aio/_container_service_fleet_mgmt_client.py +++ /dev/null @@ -1,154 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from copy import deepcopy -from typing import Any, Awaitable, TYPE_CHECKING -from typing_extensions import Self - -from azure.core.pipeline import policies -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.mgmt.core import AsyncARMPipelineClient -from azure.mgmt.core.policies import AsyncARMAutoResourceProviderRegistrationPolicy - -from .. import models as _models -from ..._serialization import Deserializer, Serializer -from ._configuration import ContainerServiceFleetMgmtClientConfiguration -from .operations import ( - AutoUpgradeProfilesOperations, - FleetMembersOperations, - FleetUpdateStrategiesOperations, - FleetsOperations, - Operations, - UpdateRunsOperations, -) - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from azure.core.credentials_async import AsyncTokenCredential - - -class ContainerServiceFleetMgmtClient: # pylint: disable=client-accepts-api-version-keyword - """Azure Kubernetes Fleet Manager api client. - - :ivar operations: Operations operations - :vartype operations: - azure.mgmt.containerservicefleet.v2024_05_02_preview.aio.operations.Operations - :ivar fleets: FleetsOperations operations - :vartype fleets: - azure.mgmt.containerservicefleet.v2024_05_02_preview.aio.operations.FleetsOperations - :ivar auto_upgrade_profiles: AutoUpgradeProfilesOperations operations - :vartype auto_upgrade_profiles: - azure.mgmt.containerservicefleet.v2024_05_02_preview.aio.operations.AutoUpgradeProfilesOperations - :ivar fleet_members: FleetMembersOperations operations - :vartype fleet_members: - azure.mgmt.containerservicefleet.v2024_05_02_preview.aio.operations.FleetMembersOperations - :ivar update_runs: UpdateRunsOperations operations - :vartype update_runs: - azure.mgmt.containerservicefleet.v2024_05_02_preview.aio.operations.UpdateRunsOperations - :ivar fleet_update_strategies: FleetUpdateStrategiesOperations operations - :vartype fleet_update_strategies: - azure.mgmt.containerservicefleet.v2024_05_02_preview.aio.operations.FleetUpdateStrategiesOperations - :param credential: Credential needed for the client to connect to Azure. Required. - :type credential: ~azure.core.credentials_async.AsyncTokenCredential - :param subscription_id: The ID of the target subscription. Required. - :type subscription_id: str - :param base_url: Service URL. Default value is "https://management.azure.com". - :type base_url: str - :keyword api_version: Api Version. Default value is "2024-05-02-preview". Note that overriding - this default value may result in unsupported behavior. - :paramtype api_version: str - :keyword int polling_interval: Default waiting time between two polls for LRO operations if no - Retry-After header is present. - """ - - def __init__( - self, - credential: "AsyncTokenCredential", - subscription_id: str, - base_url: str = "https://management.azure.com", - **kwargs: Any - ) -> None: - self._config = ContainerServiceFleetMgmtClientConfiguration( - credential=credential, subscription_id=subscription_id, **kwargs - ) - _policies = kwargs.pop("policies", None) - if _policies is None: - _policies = [ - policies.RequestIdPolicy(**kwargs), - self._config.headers_policy, - self._config.user_agent_policy, - self._config.proxy_policy, - policies.ContentDecodePolicy(**kwargs), - AsyncARMAutoResourceProviderRegistrationPolicy(), - self._config.redirect_policy, - self._config.retry_policy, - self._config.authentication_policy, - self._config.custom_hook_policy, - self._config.logging_policy, - policies.DistributedTracingPolicy(**kwargs), - policies.SensitiveHeaderCleanupPolicy(**kwargs) if self._config.redirect_policy else None, - self._config.http_logging_policy, - ] - self._client: AsyncARMPipelineClient = AsyncARMPipelineClient(base_url=base_url, policies=_policies, **kwargs) - - client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} - self._serialize = Serializer(client_models) - self._deserialize = Deserializer(client_models) - self._serialize.client_side_validation = False - self.operations = Operations( - self._client, self._config, self._serialize, self._deserialize, "2024-05-02-preview" - ) - self.fleets = FleetsOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-05-02-preview" - ) - self.auto_upgrade_profiles = AutoUpgradeProfilesOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-05-02-preview" - ) - self.fleet_members = FleetMembersOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-05-02-preview" - ) - self.update_runs = UpdateRunsOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-05-02-preview" - ) - self.fleet_update_strategies = FleetUpdateStrategiesOperations( - self._client, self._config, self._serialize, self._deserialize, "2024-05-02-preview" - ) - - def _send_request( - self, request: HttpRequest, *, stream: bool = False, **kwargs: Any - ) -> Awaitable[AsyncHttpResponse]: - """Runs the network request through the client's chained policies. - - >>> from azure.core.rest import HttpRequest - >>> request = HttpRequest("GET", "https://www.example.org/") - - >>> response = await client._send_request(request) - - - For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request - - :param request: The network request you want to make. Required. - :type request: ~azure.core.rest.HttpRequest - :keyword bool stream: Whether the response payload will be streamed. Defaults to False. - :return: The response of your network call. Does not do error handling on your response. - :rtype: ~azure.core.rest.AsyncHttpResponse - """ - - request_copy = deepcopy(request) - request_copy.url = self._client.format_url(request_copy.url) - return self._client.send_request(request_copy, stream=stream, **kwargs) # type: ignore - - async def close(self) -> None: - await self._client.close() - - async def __aenter__(self) -> Self: - await self._client.__aenter__() - return self - - async def __aexit__(self, *exc_details: Any) -> None: - await self._client.__aexit__(*exc_details) diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_05_02_preview/aio/_patch.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_05_02_preview/aio/_patch.py deleted file mode 100644 index f7dd32510333d..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_05_02_preview/aio/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_05_02_preview/aio/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_05_02_preview/aio/operations/__init__.py deleted file mode 100644 index 1d1e4703657d6..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_05_02_preview/aio/operations/__init__.py +++ /dev/null @@ -1,29 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._operations import Operations -from ._fleets_operations import FleetsOperations -from ._auto_upgrade_profiles_operations import AutoUpgradeProfilesOperations -from ._fleet_members_operations import FleetMembersOperations -from ._update_runs_operations import UpdateRunsOperations -from ._fleet_update_strategies_operations import FleetUpdateStrategiesOperations - -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "Operations", - "FleetsOperations", - "AutoUpgradeProfilesOperations", - "FleetMembersOperations", - "UpdateRunsOperations", - "FleetUpdateStrategiesOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_05_02_preview/aio/operations/_auto_upgrade_profiles_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_05_02_preview/aio/operations/_auto_upgrade_profiles_operations.py deleted file mode 100644 index f81e133170a20..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_05_02_preview/aio/operations/_auto_upgrade_profiles_operations.py +++ /dev/null @@ -1,607 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._auto_upgrade_profiles_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_by_fleet_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class AutoUpgradeProfilesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.containerservicefleet.v2024_05_02_preview.aio.ContainerServiceFleetMgmtClient`'s - :attr:`auto_upgrade_profiles` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_by_fleet( - self, resource_group_name: str, fleet_name: str, **kwargs: Any - ) -> AsyncIterable["_models.AutoUpgradeProfile"]: - """List AutoUpgradeProfile resources by Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :return: An iterator like instance of either AutoUpgradeProfile or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.AutoUpgradeProfile] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-02-preview") - ) - cls: ClsType[_models.AutoUpgradeProfileListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_fleet_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("AutoUpgradeProfileListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get( - self, resource_group_name: str, fleet_name: str, auto_upgrade_profile_name: str, **kwargs: Any - ) -> _models.AutoUpgradeProfile: - """Get a AutoUpgradeProfile. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param auto_upgrade_profile_name: The name of the AutoUpgradeProfile resource. Required. - :type auto_upgrade_profile_name: str - :return: AutoUpgradeProfile or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.AutoUpgradeProfile - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-02-preview") - ) - cls: ClsType[_models.AutoUpgradeProfile] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - auto_upgrade_profile_name=auto_upgrade_profile_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("AutoUpgradeProfile", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - fleet_name: str, - auto_upgrade_profile_name: str, - resource: Union[_models.AutoUpgradeProfile, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-02-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "AutoUpgradeProfile") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - auto_upgrade_profile_name=auto_upgrade_profile_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - auto_upgrade_profile_name: str, - resource: _models.AutoUpgradeProfile, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.AutoUpgradeProfile]: - """Create a AutoUpgradeProfile. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param auto_upgrade_profile_name: The name of the AutoUpgradeProfile resource. Required. - :type auto_upgrade_profile_name: str - :param resource: Resource create parameters. Required. - :type resource: ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.AutoUpgradeProfile - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AutoUpgradeProfile or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.AutoUpgradeProfile] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - auto_upgrade_profile_name: str, - resource: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.AutoUpgradeProfile]: - """Create a AutoUpgradeProfile. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param auto_upgrade_profile_name: The name of the AutoUpgradeProfile resource. Required. - :type auto_upgrade_profile_name: str - :param resource: Resource create parameters. Required. - :type resource: IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either AutoUpgradeProfile or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.AutoUpgradeProfile] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - auto_upgrade_profile_name: str, - resource: Union[_models.AutoUpgradeProfile, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.AutoUpgradeProfile]: - """Create a AutoUpgradeProfile. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param auto_upgrade_profile_name: The name of the AutoUpgradeProfile resource. Required. - :type auto_upgrade_profile_name: str - :param resource: Resource create parameters. Is either a AutoUpgradeProfile type or a IO[bytes] - type. Required. - :type resource: ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.AutoUpgradeProfile - or IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :return: An instance of AsyncLROPoller that returns either AutoUpgradeProfile or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.AutoUpgradeProfile] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-02-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AutoUpgradeProfile] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - auto_upgrade_profile_name=auto_upgrade_profile_name, - resource=resource, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AutoUpgradeProfile", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.AutoUpgradeProfile].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.AutoUpgradeProfile]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, - resource_group_name: str, - fleet_name: str, - auto_upgrade_profile_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-02-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - auto_upgrade_profile_name=auto_upgrade_profile_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, - resource_group_name: str, - fleet_name: str, - auto_upgrade_profile_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Delete a AutoUpgradeProfile. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param auto_upgrade_profile_name: The name of the AutoUpgradeProfile resource. Required. - :type auto_upgrade_profile_name: str - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-02-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - auto_upgrade_profile_name=auto_upgrade_profile_name, - if_match=if_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_05_02_preview/aio/operations/_fleet_members_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_05_02_preview/aio/operations/_fleet_members_operations.py deleted file mode 100644 index 3fbaf6f58f548..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_05_02_preview/aio/operations/_fleet_members_operations.py +++ /dev/null @@ -1,842 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._fleet_members_operations import ( - build_create_request, - build_delete_request, - build_get_request, - build_list_by_fleet_request, - build_update_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class FleetMembersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.containerservicefleet.v2024_05_02_preview.aio.ContainerServiceFleetMgmtClient`'s - :attr:`fleet_members` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_by_fleet( - self, resource_group_name: str, fleet_name: str, **kwargs: Any - ) -> AsyncIterable["_models.FleetMember"]: - """List FleetMember resources by Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :return: An iterator like instance of either FleetMember or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.FleetMember] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-02-preview") - ) - cls: ClsType[_models.FleetMemberListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_fleet_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("FleetMemberListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get( - self, resource_group_name: str, fleet_name: str, fleet_member_name: str, **kwargs: Any - ) -> _models.FleetMember: - """Get a FleetMember. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :return: FleetMember or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.FleetMember - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-02-preview") - ) - cls: ClsType[_models.FleetMember] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - fleet_member_name=fleet_member_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("FleetMember", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_initial( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - resource: Union[_models.FleetMember, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-02-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "FleetMember") - - _request = build_create_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - fleet_member_name=fleet_member_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - resource: _models.FleetMember, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.FleetMember]: - """Create a FleetMember. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :param resource: Resource create parameters. Required. - :type resource: ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.FleetMember - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either FleetMember or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.FleetMember] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - resource: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.FleetMember]: - """Create a FleetMember. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :param resource: Resource create parameters. Required. - :type resource: IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either FleetMember or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.FleetMember] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - resource: Union[_models.FleetMember, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.FleetMember]: - """Create a FleetMember. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :param resource: Resource create parameters. Is either a FleetMember type or a IO[bytes] type. - Required. - :type resource: ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.FleetMember or - IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :return: An instance of AsyncLROPoller that returns either FleetMember or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.FleetMember] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-02-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FleetMember] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - fleet_member_name=fleet_member_name, - resource=resource, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FleetMember", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.FleetMember].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.FleetMember]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_initial( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - properties: Union[_models.FleetMemberUpdate, IO[bytes]], - if_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-02-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties - else: - _json = self._serialize.body(properties, "FleetMemberUpdate") - - _request = build_update_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - fleet_member_name=fleet_member_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - properties: _models.FleetMemberUpdate, - if_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.FleetMember]: - """Update a FleetMember. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :param properties: The resource properties to be updated. Required. - :type properties: - ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.FleetMemberUpdate - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either FleetMember or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.FleetMember] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - properties: IO[bytes], - if_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.FleetMember]: - """Update a FleetMember. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :param properties: The resource properties to be updated. Required. - :type properties: IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either FleetMember or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.FleetMember] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - properties: Union[_models.FleetMemberUpdate, IO[bytes]], - if_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.FleetMember]: - """Update a FleetMember. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :param properties: The resource properties to be updated. Is either a FleetMemberUpdate type or - a IO[bytes] type. Required. - :type properties: - ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.FleetMemberUpdate or IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :return: An instance of AsyncLROPoller that returns either FleetMember or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.FleetMember] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-02-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FleetMember] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - fleet_member_name=fleet_member_name, - properties=properties, - if_match=if_match, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FleetMember", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.FleetMember].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.FleetMember]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-02-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - fleet_member_name=fleet_member_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Delete a FleetMember. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-02-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - fleet_member_name=fleet_member_name, - if_match=if_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_05_02_preview/aio/operations/_fleet_update_strategies_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_05_02_preview/aio/operations/_fleet_update_strategies_operations.py deleted file mode 100644 index af005d78ea95a..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_05_02_preview/aio/operations/_fleet_update_strategies_operations.py +++ /dev/null @@ -1,606 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._fleet_update_strategies_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_by_fleet_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class FleetUpdateStrategiesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.containerservicefleet.v2024_05_02_preview.aio.ContainerServiceFleetMgmtClient`'s - :attr:`fleet_update_strategies` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_by_fleet( - self, resource_group_name: str, fleet_name: str, **kwargs: Any - ) -> AsyncIterable["_models.FleetUpdateStrategy"]: - """List FleetUpdateStrategy resources by Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :return: An iterator like instance of either FleetUpdateStrategy or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.FleetUpdateStrategy] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-02-preview") - ) - cls: ClsType[_models.FleetUpdateStrategyListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_fleet_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("FleetUpdateStrategyListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get( - self, resource_group_name: str, fleet_name: str, update_strategy_name: str, **kwargs: Any - ) -> _models.FleetUpdateStrategy: - """Get a FleetUpdateStrategy. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_strategy_name: The name of the UpdateStrategy resource. Required. - :type update_strategy_name: str - :return: FleetUpdateStrategy or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.FleetUpdateStrategy - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-02-preview") - ) - cls: ClsType[_models.FleetUpdateStrategy] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_strategy_name=update_strategy_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("FleetUpdateStrategy", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - fleet_name: str, - update_strategy_name: str, - resource: Union[_models.FleetUpdateStrategy, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-02-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "FleetUpdateStrategy") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_strategy_name=update_strategy_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - update_strategy_name: str, - resource: _models.FleetUpdateStrategy, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.FleetUpdateStrategy]: - """Create a FleetUpdateStrategy. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_strategy_name: The name of the UpdateStrategy resource. Required. - :type update_strategy_name: str - :param resource: Resource create parameters. Required. - :type resource: - ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.FleetUpdateStrategy - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either FleetUpdateStrategy or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.FleetUpdateStrategy] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - update_strategy_name: str, - resource: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.FleetUpdateStrategy]: - """Create a FleetUpdateStrategy. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_strategy_name: The name of the UpdateStrategy resource. Required. - :type update_strategy_name: str - :param resource: Resource create parameters. Required. - :type resource: IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either FleetUpdateStrategy or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.FleetUpdateStrategy] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - update_strategy_name: str, - resource: Union[_models.FleetUpdateStrategy, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.FleetUpdateStrategy]: - """Create a FleetUpdateStrategy. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_strategy_name: The name of the UpdateStrategy resource. Required. - :type update_strategy_name: str - :param resource: Resource create parameters. Is either a FleetUpdateStrategy type or a - IO[bytes] type. Required. - :type resource: - ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.FleetUpdateStrategy or IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :return: An instance of AsyncLROPoller that returns either FleetUpdateStrategy or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.FleetUpdateStrategy] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-02-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FleetUpdateStrategy] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_strategy_name=update_strategy_name, - resource=resource, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FleetUpdateStrategy", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.FleetUpdateStrategy].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.FleetUpdateStrategy]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, - resource_group_name: str, - fleet_name: str, - update_strategy_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-02-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_strategy_name=update_strategy_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, - resource_group_name: str, - fleet_name: str, - update_strategy_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Delete a FleetUpdateStrategy. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_strategy_name: The name of the UpdateStrategy resource. Required. - :type update_strategy_name: str - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-02-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_strategy_name=update_strategy_name, - if_match=if_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_05_02_preview/aio/operations/_fleets_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_05_02_preview/aio/operations/_fleets_operations.py deleted file mode 100644 index 6f3095bc200f2..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_05_02_preview/aio/operations/_fleets_operations.py +++ /dev/null @@ -1,926 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._fleets_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_by_resource_group_request, - build_list_by_subscription_request, - build_list_credentials_request, - build_update_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class FleetsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.containerservicefleet.v2024_05_02_preview.aio.ContainerServiceFleetMgmtClient`'s - :attr:`fleets` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> AsyncIterable["_models.Fleet"]: - """Lists fleets in the specified subscription. - - :return: An iterator like instance of either Fleet or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-02-preview") - ) - cls: ClsType[_models.FleetListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("FleetListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace - def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> AsyncIterable["_models.Fleet"]: - """Lists fleets in the specified subscription and resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :return: An iterator like instance of either Fleet or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-02-preview") - ) - cls: ClsType[_models.FleetListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("FleetListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get(self, resource_group_name: str, fleet_name: str, **kwargs: Any) -> _models.Fleet: - """Gets a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :return: Fleet or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.Fleet - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-02-preview") - ) - cls: ClsType[_models.Fleet] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Fleet", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - fleet_name: str, - resource: Union[_models.Fleet, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-02-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "Fleet") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - resource: _models.Fleet, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.Fleet]: - """Creates or updates a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param resource: Resource create parameters. Required. - :type resource: ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.Fleet - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either Fleet or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - resource: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.Fleet]: - """Creates or updates a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param resource: Resource create parameters. Required. - :type resource: IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either Fleet or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - resource: Union[_models.Fleet, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.Fleet]: - """Creates or updates a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param resource: Resource create parameters. Is either a Fleet type or a IO[bytes] type. - Required. - :type resource: ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.Fleet or IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :return: An instance of AsyncLROPoller that returns either Fleet or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-02-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Fleet] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - resource=resource, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Fleet", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.Fleet].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.Fleet]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _update_initial( - self, - resource_group_name: str, - fleet_name: str, - properties: Union[_models.FleetPatch, IO[bytes]], - if_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-02-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties - else: - _json = self._serialize.body(properties, "FleetPatch") - - _request = build_update_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_update( - self, - resource_group_name: str, - fleet_name: str, - properties: _models.FleetPatch, - if_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.Fleet]: - """Update a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param properties: The resource properties to be updated. Required. - :type properties: ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.FleetPatch - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either Fleet or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_update( - self, - resource_group_name: str, - fleet_name: str, - properties: IO[bytes], - if_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.Fleet]: - """Update a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param properties: The resource properties to be updated. Required. - :type properties: IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either Fleet or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_update( - self, - resource_group_name: str, - fleet_name: str, - properties: Union[_models.FleetPatch, IO[bytes]], - if_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.Fleet]: - """Update a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param properties: The resource properties to be updated. Is either a FleetPatch type or a - IO[bytes] type. Required. - :type properties: ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.FleetPatch or - IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :return: An instance of AsyncLROPoller that returns either Fleet or the result of cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-02-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Fleet] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._update_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - properties=properties, - if_match=if_match, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Fleet", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.Fleet].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.Fleet]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, resource_group_name: str, fleet_name: str, if_match: Optional[str] = None, **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-02-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, resource_group_name: str, fleet_name: str, if_match: Optional[str] = None, **kwargs: Any - ) -> AsyncLROPoller[None]: - """Delete a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-02-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - if_match=if_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace_async - async def list_credentials( - self, resource_group_name: str, fleet_name: str, **kwargs: Any - ) -> _models.FleetCredentialResults: - """Lists the user credentials of a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :return: FleetCredentialResults or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.FleetCredentialResults - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-02-preview") - ) - cls: ClsType[_models.FleetCredentialResults] = kwargs.pop("cls", None) - - _request = build_list_credentials_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("FleetCredentialResults", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_05_02_preview/aio/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_05_02_preview/aio/operations/_operations.py deleted file mode 100644 index 7d8ad9669d717..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_05_02_preview/aio/operations/_operations.py +++ /dev/null @@ -1,134 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 sys -from typing import Any, AsyncIterable, Callable, Dict, Optional, Type, TypeVar -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from ... import models as _models -from ...operations._operations import build_list_request - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class Operations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.containerservicefleet.v2024_05_02_preview.aio.ContainerServiceFleetMgmtClient`'s - :attr:`operations` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, **kwargs: Any) -> AsyncIterable["_models.Operation"]: - """List the operations for the provider. - - :return: An iterator like instance of either Operation or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.Operation] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-02-preview") - ) - cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("OperationListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_05_02_preview/aio/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_05_02_preview/aio/operations/_patch.py deleted file mode 100644 index f7dd32510333d..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_05_02_preview/aio/operations/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_05_02_preview/aio/operations/_update_runs_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_05_02_preview/aio/operations/_update_runs_operations.py deleted file mode 100644 index a6253075936fe..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_05_02_preview/aio/operations/_update_runs_operations.py +++ /dev/null @@ -1,1126 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 io import IOBase -import sys -from typing import Any, AsyncIterable, AsyncIterator, Callable, Dict, IO, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.async_paging import AsyncItemPaged, AsyncList -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.pipeline import PipelineResponse -from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod -from azure.core.rest import AsyncHttpResponse, HttpRequest -from azure.core.tracing.decorator import distributed_trace -from azure.core.tracing.decorator_async import distributed_trace_async -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling - -from ... import models as _models -from ...operations._update_runs_operations import ( - build_create_or_update_request, - build_delete_request, - build_get_request, - build_list_by_fleet_request, - build_skip_request, - build_start_request, - build_stop_request, -) - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]] - - -class UpdateRunsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.containerservicefleet.v2024_05_02_preview.aio.ContainerServiceFleetMgmtClient`'s - :attr:`update_runs` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs) -> None: - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_by_fleet( - self, resource_group_name: str, fleet_name: str, **kwargs: Any - ) -> AsyncIterable["_models.UpdateRun"]: - """List UpdateRun resources by Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :return: An iterator like instance of either UpdateRun or the result of cls(response) - :rtype: - ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.UpdateRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-02-preview") - ) - cls: ClsType[_models.UpdateRunListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_fleet_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - async def extract_data(pipeline_response): - deserialized = self._deserialize("UpdateRunListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, AsyncList(list_of_elem) - - async def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return AsyncItemPaged(get_next, extract_data) - - @distributed_trace_async - async def get( - self, resource_group_name: str, fleet_name: str, update_run_name: str, **kwargs: Any - ) -> _models.UpdateRun: - """Get a UpdateRun. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_run_name: The name of the UpdateRun resource. Required. - :type update_run_name: str - :return: UpdateRun or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.UpdateRun - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-02-preview") - ) - cls: ClsType[_models.UpdateRun] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("UpdateRun", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - async def _create_or_update_initial( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - resource: Union[_models.UpdateRun, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-02-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "UpdateRun") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - resource: _models.UpdateRun, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.UpdateRun]: - """Create a UpdateRun. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_run_name: The name of the UpdateRun resource. Required. - :type update_run_name: str - :param resource: Resource create parameters. Required. - :type resource: ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.UpdateRun - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either UpdateRun or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.UpdateRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - resource: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.UpdateRun]: - """Create a UpdateRun. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_run_name: The name of the UpdateRun resource. Required. - :type update_run_name: str - :param resource: Resource create parameters. Required. - :type resource: IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either UpdateRun or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.UpdateRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - resource: Union[_models.UpdateRun, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.UpdateRun]: - """Create a UpdateRun. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_run_name: The name of the UpdateRun resource. Required. - :type update_run_name: str - :param resource: Resource create parameters. Is either a UpdateRun type or a IO[bytes] type. - Required. - :type resource: ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.UpdateRun or - IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :return: An instance of AsyncLROPoller that returns either UpdateRun or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.UpdateRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-02-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.UpdateRun] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._create_or_update_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - resource=resource, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("UpdateRun", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, - AsyncARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs), - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.UpdateRun].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.UpdateRun]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _delete_initial( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-02-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_delete( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[None]: - """Delete a UpdateRun. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_run_name: The name of the UpdateRun resource. Required. - :type update_run_name: str - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-02-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._delete_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - if_match=if_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - async def _skip_initial( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - body: Union[_models.SkipProperties, IO[bytes]], - if_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-02-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _json = self._serialize.body(body, "SkipProperties") - - _request = build_skip_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - async def begin_skip( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - body: _models.SkipProperties, - if_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.UpdateRun]: - """Skips one or a combination of member/group/stage/afterStageWait(s) of an update run. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_run_name: The name of the UpdateRun resource. Required. - :type update_run_name: str - :param body: The content of the action request. Required. - :type body: ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.SkipProperties - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either UpdateRun or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.UpdateRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - async def begin_skip( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - body: IO[bytes], - if_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> AsyncLROPoller[_models.UpdateRun]: - """Skips one or a combination of member/group/stage/afterStageWait(s) of an update run. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_run_name: The name of the UpdateRun resource. Required. - :type update_run_name: str - :param body: The content of the action request. Required. - :type body: IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of AsyncLROPoller that returns either UpdateRun or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.UpdateRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace_async - async def begin_skip( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - body: Union[_models.SkipProperties, IO[bytes]], - if_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.UpdateRun]: - """Skips one or a combination of member/group/stage/afterStageWait(s) of an update run. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_run_name: The name of the UpdateRun resource. Required. - :type update_run_name: str - :param body: The content of the action request. Is either a SkipProperties type or a IO[bytes] - type. Required. - :type body: ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.SkipProperties or - IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :return: An instance of AsyncLROPoller that returns either UpdateRun or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.UpdateRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-02-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.UpdateRun] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._skip_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - body=body, - if_match=if_match, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("UpdateRun", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.UpdateRun].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.UpdateRun]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _start_initial( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-02-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_start_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_start( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.UpdateRun]: - """Starts an UpdateRun. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_run_name: The name of the UpdateRun resource. Required. - :type update_run_name: str - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :return: An instance of AsyncLROPoller that returns either UpdateRun or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.UpdateRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-02-preview") - ) - cls: ClsType[_models.UpdateRun] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._start_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - if_match=if_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("UpdateRun", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.UpdateRun].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.UpdateRun]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - async def _stop_initial( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncIterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-02-preview") - ) - cls: ClsType[AsyncIterator[bytes]] = kwargs.pop("cls", None) - - _request = build_stop_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - await response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace_async - async def begin_stop( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> AsyncLROPoller[_models.UpdateRun]: - """Stops an UpdateRun. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_run_name: The name of the UpdateRun resource. Required. - :type update_run_name: str - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :return: An instance of AsyncLROPoller that returns either UpdateRun or the result of - cls(response) - :rtype: - ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.UpdateRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-02-preview") - ) - cls: ClsType[_models.UpdateRun] = kwargs.pop("cls", None) - polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = await self._stop_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - if_match=if_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - await raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("UpdateRun", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: AsyncPollingMethod = cast( - AsyncPollingMethod, AsyncARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(AsyncPollingMethod, AsyncNoPolling()) - else: - polling_method = polling - if cont_token: - return AsyncLROPoller[_models.UpdateRun].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return AsyncLROPoller[_models.UpdateRun]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_05_02_preview/models/__init__.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_05_02_preview/models/__init__.py deleted file mode 100644 index 7f46cbc6ced58..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_05_02_preview/models/__init__.py +++ /dev/null @@ -1,139 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._models_py3 import APIServerAccessProfile -from ._models_py3 import AgentProfile -from ._models_py3 import AutoUpgradeNodeImageSelection -from ._models_py3 import AutoUpgradeProfile -from ._models_py3 import AutoUpgradeProfileListResult -from ._models_py3 import ErrorAdditionalInfo -from ._models_py3 import ErrorDetail -from ._models_py3 import ErrorResponse -from ._models_py3 import Fleet -from ._models_py3 import FleetCredentialResult -from ._models_py3 import FleetCredentialResults -from ._models_py3 import FleetHubProfile -from ._models_py3 import FleetListResult -from ._models_py3 import FleetMember -from ._models_py3 import FleetMemberListResult -from ._models_py3 import FleetMemberUpdate -from ._models_py3 import FleetPatch -from ._models_py3 import FleetUpdateStrategy -from ._models_py3 import FleetUpdateStrategyListResult -from ._models_py3 import ManagedClusterUpdate -from ._models_py3 import ManagedClusterUpgradeSpec -from ._models_py3 import ManagedServiceIdentity -from ._models_py3 import MemberUpdateStatus -from ._models_py3 import NodeImageSelection -from ._models_py3 import NodeImageSelectionStatus -from ._models_py3 import NodeImageVersion -from ._models_py3 import Operation -from ._models_py3 import OperationDisplay -from ._models_py3 import OperationListResult -from ._models_py3 import ProxyResource -from ._models_py3 import Resource -from ._models_py3 import SkipProperties -from ._models_py3 import SkipTarget -from ._models_py3 import SystemData -from ._models_py3 import TrackedResource -from ._models_py3 import UpdateGroup -from ._models_py3 import UpdateGroupStatus -from ._models_py3 import UpdateRun -from ._models_py3 import UpdateRunListResult -from ._models_py3 import UpdateRunStatus -from ._models_py3 import UpdateRunStrategy -from ._models_py3 import UpdateStage -from ._models_py3 import UpdateStageStatus -from ._models_py3 import UpdateStatus -from ._models_py3 import UserAssignedIdentity -from ._models_py3 import WaitStatus - -from ._container_service_fleet_mgmt_client_enums import ActionType -from ._container_service_fleet_mgmt_client_enums import AutoUpgradeNodeImageSelectionType -from ._container_service_fleet_mgmt_client_enums import AutoUpgradeProfileProvisioningState -from ._container_service_fleet_mgmt_client_enums import CreatedByType -from ._container_service_fleet_mgmt_client_enums import FleetMemberProvisioningState -from ._container_service_fleet_mgmt_client_enums import FleetProvisioningState -from ._container_service_fleet_mgmt_client_enums import FleetUpdateStrategyProvisioningState -from ._container_service_fleet_mgmt_client_enums import ManagedClusterUpgradeType -from ._container_service_fleet_mgmt_client_enums import ManagedServiceIdentityType -from ._container_service_fleet_mgmt_client_enums import NodeImageSelectionType -from ._container_service_fleet_mgmt_client_enums import Origin -from ._container_service_fleet_mgmt_client_enums import TargetType -from ._container_service_fleet_mgmt_client_enums import UpdateRunProvisioningState -from ._container_service_fleet_mgmt_client_enums import UpdateState -from ._container_service_fleet_mgmt_client_enums import UpgradeChannel -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "APIServerAccessProfile", - "AgentProfile", - "AutoUpgradeNodeImageSelection", - "AutoUpgradeProfile", - "AutoUpgradeProfileListResult", - "ErrorAdditionalInfo", - "ErrorDetail", - "ErrorResponse", - "Fleet", - "FleetCredentialResult", - "FleetCredentialResults", - "FleetHubProfile", - "FleetListResult", - "FleetMember", - "FleetMemberListResult", - "FleetMemberUpdate", - "FleetPatch", - "FleetUpdateStrategy", - "FleetUpdateStrategyListResult", - "ManagedClusterUpdate", - "ManagedClusterUpgradeSpec", - "ManagedServiceIdentity", - "MemberUpdateStatus", - "NodeImageSelection", - "NodeImageSelectionStatus", - "NodeImageVersion", - "Operation", - "OperationDisplay", - "OperationListResult", - "ProxyResource", - "Resource", - "SkipProperties", - "SkipTarget", - "SystemData", - "TrackedResource", - "UpdateGroup", - "UpdateGroupStatus", - "UpdateRun", - "UpdateRunListResult", - "UpdateRunStatus", - "UpdateRunStrategy", - "UpdateStage", - "UpdateStageStatus", - "UpdateStatus", - "UserAssignedIdentity", - "WaitStatus", - "ActionType", - "AutoUpgradeNodeImageSelectionType", - "AutoUpgradeProfileProvisioningState", - "CreatedByType", - "FleetMemberProvisioningState", - "FleetProvisioningState", - "FleetUpdateStrategyProvisioningState", - "ManagedClusterUpgradeType", - "ManagedServiceIdentityType", - "NodeImageSelectionType", - "Origin", - "TargetType", - "UpdateRunProvisioningState", - "UpdateState", - "UpgradeChannel", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_05_02_preview/models/_container_service_fleet_mgmt_client_enums.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_05_02_preview/models/_container_service_fleet_mgmt_client_enums.py deleted file mode 100644 index 236083df8e74f..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_05_02_preview/models/_container_service_fleet_mgmt_client_enums.py +++ /dev/null @@ -1,215 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from enum import Enum -from azure.core import CaseInsensitiveEnumMeta - - -class ActionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs.""" - - INTERNAL = "Internal" - - -class AutoUpgradeNodeImageSelectionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The node image upgrade type.""" - - LATEST = "Latest" - """Use the latest image version when upgrading nodes. Clusters may use different image versions - (e.g., 'AKSUbuntu-1804gen2containerd-2021.10.12' and 'AKSUbuntu-1804gen2containerd-2021.10.19') - because, for example, the latest available version is different in different regions.""" - CONSISTENT = "Consistent" - """The image versions to upgrade nodes to are selected as described below: for each node pool in - managed clusters affected by the update run, the system selects the latest image version such - that it is available across all other node pools (in all other clusters) of the same image - type. As a result, all node pools of the same image type will be upgraded to the same image - version. For example, if the latest image version for image type 'AKSUbuntu-1804gen2containerd' - is 'AKSUbuntu-1804gen2containerd-2021.10.12' for a node pool in cluster A in region X, and is - 'AKSUbuntu-1804gen2containerd-2021.10.17' for a node pool in cluster B in region Y, the system - will upgrade both node pools to image version 'AKSUbuntu-1804gen2containerd-2021.10.12'.""" - - -class AutoUpgradeProfileProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The provisioning state of the AutoUpgradeProfile resource.""" - - SUCCEEDED = "Succeeded" - """Resource has been created.""" - FAILED = "Failed" - """Resource creation failed.""" - CANCELED = "Canceled" - """Resource creation was canceled.""" - - -class CreatedByType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of identity that created the resource.""" - - USER = "User" - APPLICATION = "Application" - MANAGED_IDENTITY = "ManagedIdentity" - KEY = "Key" - - -class FleetMemberProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The provisioning state of the last accepted operation.""" - - SUCCEEDED = "Succeeded" - """Resource has been created.""" - FAILED = "Failed" - """Resource creation failed.""" - CANCELED = "Canceled" - """Resource creation was canceled.""" - JOINING = "Joining" - """The provisioning state of a member joining a fleet.""" - LEAVING = "Leaving" - """The provisioning state of a member leaving a fleet.""" - UPDATING = "Updating" - """The provisioning state of a member being updated.""" - - -class FleetProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The provisioning state of the last accepted operation.""" - - SUCCEEDED = "Succeeded" - """Resource has been created.""" - FAILED = "Failed" - """Resource creation failed.""" - CANCELED = "Canceled" - """Resource creation was canceled.""" - CREATING = "Creating" - """The provisioning state of a fleet being created.""" - UPDATING = "Updating" - """The provisioning state of a fleet being updated.""" - DELETING = "Deleting" - """The provisioning state of a fleet being deleted.""" - - -class FleetUpdateStrategyProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The provisioning state of the UpdateStrategy resource.""" - - SUCCEEDED = "Succeeded" - """Resource has been created.""" - FAILED = "Failed" - """Resource creation failed.""" - CANCELED = "Canceled" - """Resource creation was canceled.""" - - -class ManagedClusterUpgradeType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The type of upgrade to perform when targeting ManagedClusters.""" - - FULL = "Full" - """Full upgrades the control plane and all agent pools of the target ManagedClusters. Requires the - ManagedClusterUpgradeSpec.KubernetesVersion property to be set.""" - NODE_IMAGE_ONLY = "NodeImageOnly" - """NodeImageOnly upgrades only the node images of the target ManagedClusters. Requires the - ManagedClusterUpgradeSpec.KubernetesVersion property to NOT be set.""" - CONTROL_PLANE_ONLY = "ControlPlaneOnly" - """ControlPlaneOnly upgrades only targets the KubernetesVersion of the ManagedClusters and will - not be applied to the AgentPool. Requires the ManagedClusterUpgradeSpec.KubernetesVersion - property to be set.""" - - -class ManagedServiceIdentityType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Type of managed service identity (where both SystemAssigned and UserAssigned types are - allowed). - """ - - NONE = "None" - SYSTEM_ASSIGNED = "SystemAssigned" - USER_ASSIGNED = "UserAssigned" - SYSTEM_ASSIGNED_USER_ASSIGNED = "SystemAssigned, UserAssigned" - - -class NodeImageSelectionType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The node image upgrade type.""" - - LATEST = "Latest" - """Use the latest image version when upgrading nodes. Clusters may use different image versions - (e.g., 'AKSUbuntu-1804gen2containerd-2021.10.12' and 'AKSUbuntu-1804gen2containerd-2021.10.19') - because, for example, the latest available version is different in different regions.""" - CONSISTENT = "Consistent" - """The image versions to upgrade nodes to are selected as described below: for each node pool in - managed clusters affected by the update run, the system selects the latest image version such - that it is available across all other node pools (in all other clusters) of the same image - type. As a result, all node pools of the same image type will be upgraded to the same image - version. For example, if the latest image version for image type 'AKSUbuntu-1804gen2containerd' - is 'AKSUbuntu-1804gen2containerd-2021.10.12' for a node pool in cluster A in region X, and is - 'AKSUbuntu-1804gen2containerd-2021.10.17' for a node pool in cluster B in region Y, the system - will upgrade both node pools to image version 'AKSUbuntu-1804gen2containerd-2021.10.12'.""" - CUSTOM = "Custom" - """Upgrade the nodes to the custom image versions. When set, update run will use node image - versions provided in customNodeImageVersions to upgrade the nodes. If set, - customNodeImageVersions must not be empty.""" - - -class Origin(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit - logs UX. Default value is "user,system". - """ - - USER = "user" - SYSTEM = "system" - USER_SYSTEM = "user,system" - - -class TargetType(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The target type of a skip request.""" - - MEMBER = "Member" - """Skip the update of a member.""" - GROUP = "Group" - """Skip the update of a group.""" - STAGE = "Stage" - """Skip the update of an entire stage including the after stage wait.""" - AFTER_STAGE_WAIT = "AfterStageWait" - """Skip the update of the after stage wait of a certain stage.""" - - -class UpdateRunProvisioningState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The provisioning state of the UpdateRun resource.""" - - SUCCEEDED = "Succeeded" - """Resource has been created.""" - FAILED = "Failed" - """Resource creation failed.""" - CANCELED = "Canceled" - """Resource creation was canceled.""" - - -class UpdateState(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """The state of the UpdateRun, UpdateStage, UpdateGroup, or MemberUpdate.""" - - NOT_STARTED = "NotStarted" - """The state of an UpdateRun/UpdateStage/UpdateGroup/MemberUpdate that has not been started.""" - RUNNING = "Running" - """The state of an UpdateRun/UpdateStage/UpdateGroup/MemberUpdate that is running.""" - STOPPING = "Stopping" - """The state of an UpdateRun/UpdateStage/UpdateGroup/MemberUpdate that is being stopped.""" - STOPPED = "Stopped" - """The state of an UpdateRun/UpdateStage/UpdateGroup/MemberUpdate that has stopped.""" - SKIPPED = "Skipped" - """The state of an UpdateRun/UpdateStage/UpdateGroup/MemberUpdate that has been skipped.""" - FAILED = "Failed" - """The state of an UpdateRun/UpdateStage/UpdateGroup/MemberUpdate that has failed.""" - COMPLETED = "Completed" - """The state of an UpdateRun/UpdateStage/UpdateGroup/MemberUpdate that has completed.""" - - -class UpgradeChannel(str, Enum, metaclass=CaseInsensitiveEnumMeta): - """Configuration of how auto upgrade will be run.""" - - STABLE = "Stable" - """Upgrades the clusters kubernetes version to the latest supported patch release on minor version - N-1, where N is the latest supported minor version. - For example, if a cluster runs version 1.17.7 and versions 1.17.9, 1.18.4, 1.18.6, and 1.19.1 - are available, the cluster upgrades to 1.18.6.""" - RAPID = "Rapid" - """Upgrades the clusters kubernetes version to the latest supported patch release on the latest - supported minor version.""" - NODE_IMAGE = "NodeImage" - """Upgrade node image version of the clusters.""" diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_05_02_preview/models/_models_py3.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_05_02_preview/models/_models_py3.py deleted file mode 100644 index 85c85b18275e4..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_05_02_preview/models/_models_py3.py +++ /dev/null @@ -1,2002 +0,0 @@ -# coding=utf-8 -# pylint: disable=too-many-lines -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights 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 Any, Dict, List, Optional, TYPE_CHECKING, Union - -from ... import _serialization - -if TYPE_CHECKING: - # pylint: disable=unused-import,ungrouped-imports - from .. import models as _models - - -class AgentProfile(_serialization.Model): - """Agent profile for the Fleet hub. - - :ivar subnet_id: The ID of the subnet which the Fleet hub node will join on startup. If this is - not specified, a vnet and subnet will be generated and used. - :vartype subnet_id: str - :ivar vm_size: The virtual machine size of the Fleet hub. - :vartype vm_size: str - """ - - _attribute_map = { - "subnet_id": {"key": "subnetId", "type": "str"}, - "vm_size": {"key": "vmSize", "type": "str"}, - } - - def __init__(self, *, subnet_id: Optional[str] = None, vm_size: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword subnet_id: The ID of the subnet which the Fleet hub node will join on startup. If this - is not specified, a vnet and subnet will be generated and used. - :paramtype subnet_id: str - :keyword vm_size: The virtual machine size of the Fleet hub. - :paramtype vm_size: str - """ - super().__init__(**kwargs) - self.subnet_id = subnet_id - self.vm_size = vm_size - - -class APIServerAccessProfile(_serialization.Model): - """Access profile for the Fleet hub API server. - - :ivar enable_private_cluster: Whether to create the Fleet hub as a private cluster or not. - :vartype enable_private_cluster: bool - :ivar enable_vnet_integration: Whether to enable apiserver vnet integration for the Fleet hub - or not. - :vartype enable_vnet_integration: bool - :ivar subnet_id: The subnet to be used when apiserver vnet integration is enabled. It is - required when creating a new Fleet with BYO vnet. - :vartype subnet_id: str - """ - - _attribute_map = { - "enable_private_cluster": {"key": "enablePrivateCluster", "type": "bool"}, - "enable_vnet_integration": {"key": "enableVnetIntegration", "type": "bool"}, - "subnet_id": {"key": "subnetId", "type": "str"}, - } - - def __init__( - self, - *, - enable_private_cluster: Optional[bool] = None, - enable_vnet_integration: Optional[bool] = None, - subnet_id: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword enable_private_cluster: Whether to create the Fleet hub as a private cluster or not. - :paramtype enable_private_cluster: bool - :keyword enable_vnet_integration: Whether to enable apiserver vnet integration for the Fleet - hub or not. - :paramtype enable_vnet_integration: bool - :keyword subnet_id: The subnet to be used when apiserver vnet integration is enabled. It is - required when creating a new Fleet with BYO vnet. - :paramtype subnet_id: str - """ - super().__init__(**kwargs) - self.enable_private_cluster = enable_private_cluster - self.enable_vnet_integration = enable_vnet_integration - self.subnet_id = subnet_id - - -class AutoUpgradeNodeImageSelection(_serialization.Model): - """The node image upgrade to be applied to the target clusters in auto upgrade. - - All required parameters must be populated in order to send to server. - - :ivar type: The node image upgrade type. Required. Known values are: "Latest" and "Consistent". - :vartype type: str or - ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.AutoUpgradeNodeImageSelectionType - """ - - _validation = { - "type": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - } - - def __init__(self, *, type: Union[str, "_models.AutoUpgradeNodeImageSelectionType"], **kwargs: Any) -> None: - """ - :keyword type: The node image upgrade type. Required. Known values are: "Latest" and - "Consistent". - :paramtype type: str or - ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.AutoUpgradeNodeImageSelectionType - """ - super().__init__(**kwargs) - self.type = type - - -class Resource(_serialization.Model): - """Common fields that are returned in the response for all Azure Resource Manager resources. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.SystemData - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.id = None - self.name = None - self.type = None - self.system_data = None - - -class ProxyResource(Resource): - """The resource model definition for a Azure Resource Manager proxy resource. It will not have - tags and a location. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.SystemData - """ - - -class AutoUpgradeProfile(ProxyResource): - """The AutoUpgradeProfile resource. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.SystemData - :ivar e_tag: If eTag is provided in the response body, it may also be provided as a header per - the normal etag convention. Entity tags are used for comparing two or more entities from the - same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match - (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. - :vartype e_tag: str - :ivar provisioning_state: The provisioning state of the AutoUpgradeProfile resource. Known - values are: "Succeeded", "Failed", and "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.AutoUpgradeProfileProvisioningState - :ivar update_strategy_id: The resource id of the UpdateStrategy resource to reference. If not - specified, the auto upgrade will run on all clusters which are members of the fleet. - :vartype update_strategy_id: str - :ivar channel: Configures how auto-upgrade will be run. Known values are: "Stable", "Rapid", - and "NodeImage". - :vartype channel: str or - ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.UpgradeChannel - :ivar node_image_selection: The node image upgrade to be applied to the target clusters in auto - upgrade. - :vartype node_image_selection: - ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.AutoUpgradeNodeImageSelection - :ivar disabled: If set to False: the auto upgrade has effect - target managed clusters will be - upgraded on schedule. - If set to True: the auto upgrade has no effect - no upgrade will be run on the target managed - clusters. - This is a boolean and not an enum because enabled/disabled are all available states of the - auto upgrade profile. - By default, this is set to False. - :vartype disabled: bool - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "e_tag": {"readonly": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "e_tag": {"key": "eTag", "type": "str"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "update_strategy_id": {"key": "properties.updateStrategyId", "type": "str"}, - "channel": {"key": "properties.channel", "type": "str"}, - "node_image_selection": {"key": "properties.nodeImageSelection", "type": "AutoUpgradeNodeImageSelection"}, - "disabled": {"key": "properties.disabled", "type": "bool"}, - } - - def __init__( - self, - *, - update_strategy_id: Optional[str] = None, - channel: Optional[Union[str, "_models.UpgradeChannel"]] = None, - node_image_selection: Optional["_models.AutoUpgradeNodeImageSelection"] = None, - disabled: Optional[bool] = None, - **kwargs: Any - ) -> None: - """ - :keyword update_strategy_id: The resource id of the UpdateStrategy resource to reference. If - not specified, the auto upgrade will run on all clusters which are members of the fleet. - :paramtype update_strategy_id: str - :keyword channel: Configures how auto-upgrade will be run. Known values are: "Stable", "Rapid", - and "NodeImage". - :paramtype channel: str or - ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.UpgradeChannel - :keyword node_image_selection: The node image upgrade to be applied to the target clusters in - auto upgrade. - :paramtype node_image_selection: - ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.AutoUpgradeNodeImageSelection - :keyword disabled: If set to False: the auto upgrade has effect - target managed clusters will - be upgraded on schedule. - If set to True: the auto upgrade has no effect - no upgrade will be run on the target managed - clusters. - This is a boolean and not an enum because enabled/disabled are all available states of the - auto upgrade profile. - By default, this is set to False. - :paramtype disabled: bool - """ - super().__init__(**kwargs) - self.e_tag = None - self.provisioning_state = None - self.update_strategy_id = update_strategy_id - self.channel = channel - self.node_image_selection = node_image_selection - self.disabled = disabled - - -class AutoUpgradeProfileListResult(_serialization.Model): - """The response of a AutoUpgradeProfile list operation. - - All required parameters must be populated in order to send to server. - - :ivar value: The AutoUpgradeProfile items on this page. Required. - :vartype value: - list[~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.AutoUpgradeProfile] - :ivar next_link: The link to the next page of items. - :vartype next_link: str - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[AutoUpgradeProfile]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: List["_models.AutoUpgradeProfile"], next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: The AutoUpgradeProfile items on this page. Required. - :paramtype value: - list[~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.AutoUpgradeProfile] - :keyword next_link: The link to the next page of items. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ErrorAdditionalInfo(_serialization.Model): - """The resource management error additional info. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar type: The additional info type. - :vartype type: str - :ivar info: The additional info. - :vartype info: JSON - """ - - _validation = { - "type": {"readonly": True}, - "info": {"readonly": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "info": {"key": "info", "type": "object"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.type = None - self.info = None - - -class ErrorDetail(_serialization.Model): - """The error detail. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar code: The error code. - :vartype code: str - :ivar message: The error message. - :vartype message: str - :ivar target: The error target. - :vartype target: str - :ivar details: The error details. - :vartype details: - list[~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.ErrorDetail] - :ivar additional_info: The error additional info. - :vartype additional_info: - list[~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.ErrorAdditionalInfo] - """ - - _validation = { - "code": {"readonly": True}, - "message": {"readonly": True}, - "target": {"readonly": True}, - "details": {"readonly": True}, - "additional_info": {"readonly": True}, - } - - _attribute_map = { - "code": {"key": "code", "type": "str"}, - "message": {"key": "message", "type": "str"}, - "target": {"key": "target", "type": "str"}, - "details": {"key": "details", "type": "[ErrorDetail]"}, - "additional_info": {"key": "additionalInfo", "type": "[ErrorAdditionalInfo]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.code = None - self.message = None - self.target = None - self.details = None - self.additional_info = None - - -class ErrorResponse(_serialization.Model): - """Common error response for all Azure Resource Manager APIs to return error details for failed - operations. (This also follows the OData error response format.). - - :ivar error: The error object. - :vartype error: ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.ErrorDetail - """ - - _attribute_map = { - "error": {"key": "error", "type": "ErrorDetail"}, - } - - def __init__(self, *, error: Optional["_models.ErrorDetail"] = None, **kwargs: Any) -> None: - """ - :keyword error: The error object. - :paramtype error: ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.ErrorDetail - """ - super().__init__(**kwargs) - self.error = error - - -class TrackedResource(Resource): - """The resource model definition for an Azure Resource Manager tracked top level resource which - has 'tags' and a 'location'. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.SystemData - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "location": {"required": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - } - - def __init__(self, *, location: str, tags: Optional[Dict[str, str]] = None, **kwargs: Any) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - """ - super().__init__(**kwargs) - self.tags = tags - self.location = location - - -class Fleet(TrackedResource): - """The Fleet 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 server. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.SystemData - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar location: The geo-location where the resource lives. Required. - :vartype location: str - :ivar e_tag: If eTag is provided in the response body, it may also be provided as a header per - the normal etag convention. Entity tags are used for comparing two or more entities from the - same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match - (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. - :vartype e_tag: str - :ivar identity: Managed identity. - :vartype identity: - ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.ManagedServiceIdentity - :ivar provisioning_state: The status of the last operation. Known values are: "Succeeded", - "Failed", "Canceled", "Creating", "Updating", and "Deleting". - :vartype provisioning_state: str or - ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.FleetProvisioningState - :ivar hub_profile: The FleetHubProfile configures the Fleet's hub. - :vartype hub_profile: - ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.FleetHubProfile - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "location": {"required": True}, - "e_tag": {"readonly": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "tags": {"key": "tags", "type": "{str}"}, - "location": {"key": "location", "type": "str"}, - "e_tag": {"key": "eTag", "type": "str"}, - "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "hub_profile": {"key": "properties.hubProfile", "type": "FleetHubProfile"}, - } - - def __init__( - self, - *, - location: str, - tags: Optional[Dict[str, str]] = None, - identity: Optional["_models.ManagedServiceIdentity"] = None, - hub_profile: Optional["_models.FleetHubProfile"] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword location: The geo-location where the resource lives. Required. - :paramtype location: str - :keyword identity: Managed identity. - :paramtype identity: - ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.ManagedServiceIdentity - :keyword hub_profile: The FleetHubProfile configures the Fleet's hub. - :paramtype hub_profile: - ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.FleetHubProfile - """ - super().__init__(tags=tags, location=location, **kwargs) - self.e_tag = None - self.identity = identity - self.provisioning_state = None - self.hub_profile = hub_profile - - -class FleetCredentialResult(_serialization.Model): - """One credential result item. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: The name of the credential. - :vartype name: str - :ivar value: Base64-encoded Kubernetes configuration file. - :vartype value: bytes - """ - - _validation = { - "name": {"readonly": True}, - "value": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "value": {"key": "value", "type": "bytearray"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.name = None - self.value = None - - -class FleetCredentialResults(_serialization.Model): - """The Credential results response. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar kubeconfigs: Array of base64-encoded Kubernetes configuration files. - :vartype kubeconfigs: - list[~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.FleetCredentialResult] - """ - - _validation = { - "kubeconfigs": {"readonly": True}, - } - - _attribute_map = { - "kubeconfigs": {"key": "kubeconfigs", "type": "[FleetCredentialResult]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.kubeconfigs = None - - -class FleetHubProfile(_serialization.Model): - """The FleetHubProfile configures the fleet hub. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar dns_prefix: DNS prefix used to create the FQDN for the Fleet hub. - :vartype dns_prefix: str - :ivar api_server_access_profile: The access profile for the Fleet hub API server. - :vartype api_server_access_profile: - ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.APIServerAccessProfile - :ivar agent_profile: The agent profile for the Fleet hub. - :vartype agent_profile: - ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.AgentProfile - :ivar fqdn: The FQDN of the Fleet hub. - :vartype fqdn: str - :ivar kubernetes_version: The Kubernetes version of the Fleet hub. - :vartype kubernetes_version: str - :ivar portal_fqdn: The Azure Portal FQDN of the Fleet hub. - :vartype portal_fqdn: str - """ - - _validation = { - "dns_prefix": { - "max_length": 54, - "min_length": 1, - "pattern": r"^[a-zA-Z0-9]$|^[a-zA-Z0-9][a-zA-Z0-9-]{0,52}[a-zA-Z0-9]$", - }, - "fqdn": {"readonly": True}, - "kubernetes_version": {"readonly": True}, - "portal_fqdn": {"readonly": True}, - } - - _attribute_map = { - "dns_prefix": {"key": "dnsPrefix", "type": "str"}, - "api_server_access_profile": {"key": "apiServerAccessProfile", "type": "APIServerAccessProfile"}, - "agent_profile": {"key": "agentProfile", "type": "AgentProfile"}, - "fqdn": {"key": "fqdn", "type": "str"}, - "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, - "portal_fqdn": {"key": "portalFqdn", "type": "str"}, - } - - def __init__( - self, - *, - dns_prefix: Optional[str] = None, - api_server_access_profile: Optional["_models.APIServerAccessProfile"] = None, - agent_profile: Optional["_models.AgentProfile"] = None, - **kwargs: Any - ) -> None: - """ - :keyword dns_prefix: DNS prefix used to create the FQDN for the Fleet hub. - :paramtype dns_prefix: str - :keyword api_server_access_profile: The access profile for the Fleet hub API server. - :paramtype api_server_access_profile: - ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.APIServerAccessProfile - :keyword agent_profile: The agent profile for the Fleet hub. - :paramtype agent_profile: - ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.AgentProfile - """ - super().__init__(**kwargs) - self.dns_prefix = dns_prefix - self.api_server_access_profile = api_server_access_profile - self.agent_profile = agent_profile - self.fqdn = None - self.kubernetes_version = None - self.portal_fqdn = None - - -class FleetListResult(_serialization.Model): - """The response of a Fleet list operation. - - All required parameters must be populated in order to send to server. - - :ivar value: The Fleet items on this page. Required. - :vartype value: list[~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.Fleet] - :ivar next_link: The link to the next page of items. - :vartype next_link: str - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[Fleet]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, *, value: List["_models.Fleet"], next_link: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword value: The Fleet items on this page. Required. - :paramtype value: list[~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.Fleet] - :keyword next_link: The link to the next page of items. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class FleetMember(ProxyResource): - """A member of the Fleet. It contains a reference to an existing Kubernetes cluster on Azure. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.SystemData - :ivar e_tag: If eTag is provided in the response body, it may also be provided as a header per - the normal etag convention. Entity tags are used for comparing two or more entities from the - same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match - (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. - :vartype e_tag: str - :ivar cluster_resource_id: The ARM resource id of the cluster that joins the Fleet. Must be a - valid Azure resource id. e.g.: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{clusterName}'. # pylint: disable=line-too-long - :vartype cluster_resource_id: str - :ivar group: The group this member belongs to for multi-cluster update management. - :vartype group: str - :ivar provisioning_state: The status of the last operation. Known values are: "Succeeded", - "Failed", "Canceled", "Joining", "Leaving", and "Updating". - :vartype provisioning_state: str or - ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.FleetMemberProvisioningState - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "e_tag": {"readonly": True}, - "group": {"max_length": 50, "min_length": 1, "pattern": r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$"}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "e_tag": {"key": "eTag", "type": "str"}, - "cluster_resource_id": {"key": "properties.clusterResourceId", "type": "str"}, - "group": {"key": "properties.group", "type": "str"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - } - - def __init__( - self, *, cluster_resource_id: Optional[str] = None, group: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword cluster_resource_id: The ARM resource id of the cluster that joins the Fleet. Must be - a valid Azure resource id. e.g.: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{clusterName}'. # pylint: disable=line-too-long - :paramtype cluster_resource_id: str - :keyword group: The group this member belongs to for multi-cluster update management. - :paramtype group: str - """ - super().__init__(**kwargs) - self.e_tag = None - self.cluster_resource_id = cluster_resource_id - self.group = group - self.provisioning_state = None - - -class FleetMemberListResult(_serialization.Model): - """The response of a FleetMember list operation. - - All required parameters must be populated in order to send to server. - - :ivar value: The FleetMember items on this page. Required. - :vartype value: list[~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.FleetMember] - :ivar next_link: The link to the next page of items. - :vartype next_link: str - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[FleetMember]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, *, value: List["_models.FleetMember"], next_link: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword value: The FleetMember items on this page. Required. - :paramtype value: - list[~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.FleetMember] - :keyword next_link: The link to the next page of items. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class FleetMemberUpdate(_serialization.Model): - """The type used for update operations of the FleetMember. - - :ivar group: The group this member belongs to for multi-cluster update management. - :vartype group: str - """ - - _validation = { - "group": {"max_length": 50, "min_length": 1, "pattern": r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$"}, - } - - _attribute_map = { - "group": {"key": "properties.group", "type": "str"}, - } - - def __init__(self, *, group: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword group: The group this member belongs to for multi-cluster update management. - :paramtype group: str - """ - super().__init__(**kwargs) - self.group = group - - -class FleetPatch(_serialization.Model): - """Properties of a Fleet that can be patched. - - :ivar tags: Resource tags. - :vartype tags: dict[str, str] - :ivar identity: Managed identity. - :vartype identity: - ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.ManagedServiceIdentity - """ - - _attribute_map = { - "tags": {"key": "tags", "type": "{str}"}, - "identity": {"key": "identity", "type": "ManagedServiceIdentity"}, - } - - def __init__( - self, - *, - tags: Optional[Dict[str, str]] = None, - identity: Optional["_models.ManagedServiceIdentity"] = None, - **kwargs: Any - ) -> None: - """ - :keyword tags: Resource tags. - :paramtype tags: dict[str, str] - :keyword identity: Managed identity. - :paramtype identity: - ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.ManagedServiceIdentity - """ - super().__init__(**kwargs) - self.tags = tags - self.identity = identity - - -class FleetUpdateStrategy(ProxyResource): - """Defines a multi-stage process to perform update operations across members of a Fleet. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.SystemData - :ivar e_tag: If eTag is provided in the response body, it may also be provided as a header per - the normal etag convention. Entity tags are used for comparing two or more entities from the - same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match - (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. - :vartype e_tag: str - :ivar provisioning_state: The provisioning state of the UpdateStrategy resource. Known values - are: "Succeeded", "Failed", and "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.FleetUpdateStrategyProvisioningState - :ivar strategy: Defines the update sequence of the clusters. - :vartype strategy: - ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.UpdateRunStrategy - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "e_tag": {"readonly": True}, - "provisioning_state": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "e_tag": {"key": "eTag", "type": "str"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "strategy": {"key": "properties.strategy", "type": "UpdateRunStrategy"}, - } - - def __init__(self, *, strategy: Optional["_models.UpdateRunStrategy"] = None, **kwargs: Any) -> None: - """ - :keyword strategy: Defines the update sequence of the clusters. - :paramtype strategy: - ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.UpdateRunStrategy - """ - super().__init__(**kwargs) - self.e_tag = None - self.provisioning_state = None - self.strategy = strategy - - -class FleetUpdateStrategyListResult(_serialization.Model): - """The response of a FleetUpdateStrategy list operation. - - All required parameters must be populated in order to send to server. - - :ivar value: The FleetUpdateStrategy items on this page. Required. - :vartype value: - list[~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.FleetUpdateStrategy] - :ivar next_link: The link to the next page of items. - :vartype next_link: str - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[FleetUpdateStrategy]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__( - self, *, value: List["_models.FleetUpdateStrategy"], next_link: Optional[str] = None, **kwargs: Any - ) -> None: - """ - :keyword value: The FleetUpdateStrategy items on this page. Required. - :paramtype value: - list[~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.FleetUpdateStrategy] - :keyword next_link: The link to the next page of items. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class ManagedClusterUpdate(_serialization.Model): - """The update to be applied to the ManagedClusters. - - All required parameters must be populated in order to send to server. - - :ivar upgrade: The upgrade to apply to the ManagedClusters. Required. - :vartype upgrade: - ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.ManagedClusterUpgradeSpec - :ivar node_image_selection: The node image upgrade to be applied to the target nodes in update - run. - :vartype node_image_selection: - ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.NodeImageSelection - """ - - _validation = { - "upgrade": {"required": True}, - } - - _attribute_map = { - "upgrade": {"key": "upgrade", "type": "ManagedClusterUpgradeSpec"}, - "node_image_selection": {"key": "nodeImageSelection", "type": "NodeImageSelection"}, - } - - def __init__( - self, - *, - upgrade: "_models.ManagedClusterUpgradeSpec", - node_image_selection: Optional["_models.NodeImageSelection"] = None, - **kwargs: Any - ) -> None: - """ - :keyword upgrade: The upgrade to apply to the ManagedClusters. Required. - :paramtype upgrade: - ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.ManagedClusterUpgradeSpec - :keyword node_image_selection: The node image upgrade to be applied to the target nodes in - update run. - :paramtype node_image_selection: - ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.NodeImageSelection - """ - super().__init__(**kwargs) - self.upgrade = upgrade - self.node_image_selection = node_image_selection - - -class ManagedClusterUpgradeSpec(_serialization.Model): - """The upgrade to apply to a ManagedCluster. - - All required parameters must be populated in order to send to server. - - :ivar type: ManagedClusterUpgradeType is the type of upgrade to be applied. Required. Known - values are: "Full", "NodeImageOnly", and "ControlPlaneOnly". - :vartype type: str or - ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.ManagedClusterUpgradeType - :ivar kubernetes_version: The Kubernetes version to upgrade the member clusters to. - :vartype kubernetes_version: str - """ - - _validation = { - "type": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "kubernetes_version": {"key": "kubernetesVersion", "type": "str"}, - } - - def __init__( - self, - *, - type: Union[str, "_models.ManagedClusterUpgradeType"], - kubernetes_version: Optional[str] = None, - **kwargs: Any - ) -> None: - """ - :keyword type: ManagedClusterUpgradeType is the type of upgrade to be applied. Required. Known - values are: "Full", "NodeImageOnly", and "ControlPlaneOnly". - :paramtype type: str or - ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.ManagedClusterUpgradeType - :keyword kubernetes_version: The Kubernetes version to upgrade the member clusters to. - :paramtype kubernetes_version: str - """ - super().__init__(**kwargs) - self.type = type - self.kubernetes_version = kubernetes_version - - -class ManagedServiceIdentity(_serialization.Model): - """Managed service identity (system assigned and/or user assigned identities). - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to server. - - :ivar principal_id: The service principal ID of the system assigned identity. This property - will only be provided for a system assigned identity. - :vartype principal_id: str - :ivar tenant_id: The tenant ID of the system assigned identity. This property will only be - provided for a system assigned identity. - :vartype tenant_id: str - :ivar type: Type of managed service identity (where both SystemAssigned and UserAssigned types - are allowed). Required. Known values are: "None", "SystemAssigned", "UserAssigned", and - "SystemAssigned, UserAssigned". - :vartype type: str or - ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.ManagedServiceIdentityType - :ivar user_assigned_identities: The set of user assigned identities associated with the - resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. # pylint: disable=line-too-long - The dictionary values can be empty objects ({}) in requests. - :vartype user_assigned_identities: dict[str, - ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.UserAssignedIdentity] - """ - - _validation = { - "principal_id": {"readonly": True}, - "tenant_id": {"readonly": True}, - "type": {"required": True}, - } - - _attribute_map = { - "principal_id": {"key": "principalId", "type": "str"}, - "tenant_id": {"key": "tenantId", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "user_assigned_identities": {"key": "userAssignedIdentities", "type": "{UserAssignedIdentity}"}, - } - - def __init__( - self, - *, - type: Union[str, "_models.ManagedServiceIdentityType"], - user_assigned_identities: Optional[Dict[str, "_models.UserAssignedIdentity"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword type: Type of managed service identity (where both SystemAssigned and UserAssigned - types are allowed). Required. Known values are: "None", "SystemAssigned", "UserAssigned", and - "SystemAssigned, UserAssigned". - :paramtype type: str or - ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.ManagedServiceIdentityType - :keyword user_assigned_identities: The set of user assigned identities associated with the - resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: - '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. # pylint: disable=line-too-long - The dictionary values can be empty objects ({}) in requests. - :paramtype user_assigned_identities: dict[str, - ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.UserAssignedIdentity] - """ - super().__init__(**kwargs) - self.principal_id = None - self.tenant_id = None - self.type = type - self.user_assigned_identities = user_assigned_identities - - -class MemberUpdateStatus(_serialization.Model): - """The status of a member update operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar status: The status of the MemberUpdate operation. - :vartype status: ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.UpdateStatus - :ivar name: The name of the FleetMember. - :vartype name: str - :ivar cluster_resource_id: The Azure resource id of the target Kubernetes cluster. - :vartype cluster_resource_id: str - :ivar operation_id: The operation resource id of the latest attempt to perform the operation. - :vartype operation_id: str - :ivar message: The status message after processing the member update operation. - :vartype message: str - """ - - _validation = { - "status": {"readonly": True}, - "name": {"readonly": True}, - "cluster_resource_id": {"readonly": True}, - "operation_id": {"readonly": True}, - "message": {"readonly": True}, - } - - _attribute_map = { - "status": {"key": "status", "type": "UpdateStatus"}, - "name": {"key": "name", "type": "str"}, - "cluster_resource_id": {"key": "clusterResourceId", "type": "str"}, - "operation_id": {"key": "operationId", "type": "str"}, - "message": {"key": "message", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.status = None - self.name = None - self.cluster_resource_id = None - self.operation_id = None - self.message = None - - -class NodeImageSelection(_serialization.Model): - """The node image upgrade to be applied to the target nodes in update run. - - All required parameters must be populated in order to send to server. - - :ivar type: The node image upgrade type. Required. Known values are: "Latest", "Consistent", - and "Custom". - :vartype type: str or - ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.NodeImageSelectionType - :ivar custom_node_image_versions: Custom node image versions to upgrade the nodes to. This - field is required if node image selection type is Custom. Otherwise, it must be empty. For each - node image family (e.g., 'AKSUbuntu-1804gen2containerd'), this field can contain at most one - version (e.g., only one of 'AKSUbuntu-1804gen2containerd-2023.01.12' or - 'AKSUbuntu-1804gen2containerd-2023.02.12', not both). If the nodes belong to a family without a - matching image version in this field, they are not upgraded. - :vartype custom_node_image_versions: - list[~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.NodeImageVersion] - """ - - _validation = { - "type": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "custom_node_image_versions": {"key": "customNodeImageVersions", "type": "[NodeImageVersion]"}, - } - - def __init__( - self, - *, - type: Union[str, "_models.NodeImageSelectionType"], - custom_node_image_versions: Optional[List["_models.NodeImageVersion"]] = None, - **kwargs: Any - ) -> None: - """ - :keyword type: The node image upgrade type. Required. Known values are: "Latest", "Consistent", - and "Custom". - :paramtype type: str or - ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.NodeImageSelectionType - :keyword custom_node_image_versions: Custom node image versions to upgrade the nodes to. This - field is required if node image selection type is Custom. Otherwise, it must be empty. For each - node image family (e.g., 'AKSUbuntu-1804gen2containerd'), this field can contain at most one - version (e.g., only one of 'AKSUbuntu-1804gen2containerd-2023.01.12' or - 'AKSUbuntu-1804gen2containerd-2023.02.12', not both). If the nodes belong to a family without a - matching image version in this field, they are not upgraded. - :paramtype custom_node_image_versions: - list[~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.NodeImageVersion] - """ - super().__init__(**kwargs) - self.type = type - self.custom_node_image_versions = custom_node_image_versions - - -class NodeImageSelectionStatus(_serialization.Model): - """The node image upgrade specs for the update run. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar selected_node_image_versions: The image versions to upgrade the nodes to. - :vartype selected_node_image_versions: - list[~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.NodeImageVersion] - """ - - _validation = { - "selected_node_image_versions": {"readonly": True}, - } - - _attribute_map = { - "selected_node_image_versions": {"key": "selectedNodeImageVersions", "type": "[NodeImageVersion]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.selected_node_image_versions = None - - -class NodeImageVersion(_serialization.Model): - """The node upgrade image version. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar version: The image version to upgrade the nodes to (e.g., - 'AKSUbuntu-1804gen2containerd-2022.12.13'). - :vartype version: str - """ - - _validation = { - "version": {"readonly": True}, - } - - _attribute_map = { - "version": {"key": "version", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.version = None - - -class Operation(_serialization.Model): - """Details of a REST API operation, returned from the Resource Provider Operations API. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar name: The name of the operation, as per Resource-Based Access Control (RBAC). Examples: - "Microsoft.Compute/virtualMachines/write", "Microsoft.Compute/virtualMachines/capture/action". - :vartype name: str - :ivar is_data_action: Whether the operation applies to data-plane. This is "true" for - data-plane operations and "false" for ARM/control-plane operations. - :vartype is_data_action: bool - :ivar display: Localized display information for this particular operation. - :vartype display: ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.OperationDisplay - :ivar origin: The intended executor of the operation; as in Resource Based Access Control - (RBAC) and audit logs UX. Default value is "user,system". Known values are: "user", "system", - and "user,system". - :vartype origin: str or ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.Origin - :ivar action_type: Enum. Indicates the action type. "Internal" refers to actions that are for - internal only APIs. "Internal" - :vartype action_type: str or - ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.ActionType - """ - - _validation = { - "name": {"readonly": True}, - "is_data_action": {"readonly": True}, - "origin": {"readonly": True}, - "action_type": {"readonly": True}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "is_data_action": {"key": "isDataAction", "type": "bool"}, - "display": {"key": "display", "type": "OperationDisplay"}, - "origin": {"key": "origin", "type": "str"}, - "action_type": {"key": "actionType", "type": "str"}, - } - - def __init__(self, *, display: Optional["_models.OperationDisplay"] = None, **kwargs: Any) -> None: - """ - :keyword display: Localized display information for this particular operation. - :paramtype display: - ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.OperationDisplay - """ - super().__init__(**kwargs) - self.name = None - self.is_data_action = None - self.display = display - self.origin = None - self.action_type = None - - -class OperationDisplay(_serialization.Model): - """Localized display information for this particular operation. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar provider: The localized friendly form of the resource provider name, e.g. "Microsoft - Monitoring Insights" or "Microsoft Compute". - :vartype provider: str - :ivar resource: The localized friendly name of the resource type related to this operation. - E.g. "Virtual Machines" or "Job Schedule Collections". - :vartype resource: str - :ivar operation: The concise, localized friendly name for the operation; suitable for - dropdowns. E.g. "Create or Update Virtual Machine", "Restart Virtual Machine". - :vartype operation: str - :ivar description: The short, localized friendly description of the operation; suitable for - tool tips and detailed views. - :vartype description: str - """ - - _validation = { - "provider": {"readonly": True}, - "resource": {"readonly": True}, - "operation": {"readonly": True}, - "description": {"readonly": True}, - } - - _attribute_map = { - "provider": {"key": "provider", "type": "str"}, - "resource": {"key": "resource", "type": "str"}, - "operation": {"key": "operation", "type": "str"}, - "description": {"key": "description", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.provider = None - self.resource = None - self.operation = None - self.description = None - - -class OperationListResult(_serialization.Model): - """A list of REST API operations supported by an Azure Resource Provider. It contains an URL link - to get the next set of results. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar value: List of operations supported by the resource provider. - :vartype value: list[~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.Operation] - :ivar next_link: URL to get the next set of operation list results (if there are any). - :vartype next_link: str - """ - - _validation = { - "value": {"readonly": True}, - "next_link": {"readonly": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[Operation]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.value = None - self.next_link = None - - -class SkipProperties(_serialization.Model): - """The properties of a skip operation containing multiple skip requests. - - All required parameters must be populated in order to send to server. - - :ivar targets: The targets to skip. Required. - :vartype targets: list[~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.SkipTarget] - """ - - _validation = { - "targets": {"required": True}, - } - - _attribute_map = { - "targets": {"key": "targets", "type": "[SkipTarget]"}, - } - - def __init__(self, *, targets: List["_models.SkipTarget"], **kwargs: Any) -> None: - """ - :keyword targets: The targets to skip. Required. - :paramtype targets: - list[~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.SkipTarget] - """ - super().__init__(**kwargs) - self.targets = targets - - -class SkipTarget(_serialization.Model): - """The definition of a single skip request. - - All required parameters must be populated in order to send to server. - - :ivar type: The skip target type. Required. Known values are: "Member", "Group", "Stage", and - "AfterStageWait". - :vartype type: str or ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.TargetType - :ivar name: The skip target's name. - To skip a member/group/stage, use the member/group/stage's name; - Tp skip an after stage wait, use the parent stage's name. Required. - :vartype name: str - """ - - _validation = { - "type": {"required": True}, - "name": {"required": True}, - } - - _attribute_map = { - "type": {"key": "type", "type": "str"}, - "name": {"key": "name", "type": "str"}, - } - - def __init__(self, *, type: Union[str, "_models.TargetType"], name: str, **kwargs: Any) -> None: - """ - :keyword type: The skip target type. Required. Known values are: "Member", "Group", "Stage", - and "AfterStageWait". - :paramtype type: str or ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.TargetType - :keyword name: The skip target's name. - To skip a member/group/stage, use the member/group/stage's name; - Tp skip an after stage wait, use the parent stage's name. Required. - :paramtype name: str - """ - super().__init__(**kwargs) - self.type = type - self.name = name - - -class SystemData(_serialization.Model): - """Metadata pertaining to creation and last modification of the resource. - - :ivar created_by: The identity that created the resource. - :vartype created_by: str - :ivar created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", and "Key". - :vartype created_by_type: str or - ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.CreatedByType - :ivar created_at: The timestamp of resource creation (UTC). - :vartype created_at: ~datetime.datetime - :ivar last_modified_by: The identity that last modified the resource. - :vartype last_modified_by: str - :ivar last_modified_by_type: The type of identity that last modified the resource. Known values - are: "User", "Application", "ManagedIdentity", and "Key". - :vartype last_modified_by_type: str or - ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.CreatedByType - :ivar last_modified_at: The timestamp of resource last modification (UTC). - :vartype last_modified_at: ~datetime.datetime - """ - - _attribute_map = { - "created_by": {"key": "createdBy", "type": "str"}, - "created_by_type": {"key": "createdByType", "type": "str"}, - "created_at": {"key": "createdAt", "type": "iso-8601"}, - "last_modified_by": {"key": "lastModifiedBy", "type": "str"}, - "last_modified_by_type": {"key": "lastModifiedByType", "type": "str"}, - "last_modified_at": {"key": "lastModifiedAt", "type": "iso-8601"}, - } - - def __init__( - self, - *, - created_by: Optional[str] = None, - created_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, - created_at: Optional[datetime.datetime] = None, - last_modified_by: Optional[str] = None, - last_modified_by_type: Optional[Union[str, "_models.CreatedByType"]] = None, - last_modified_at: Optional[datetime.datetime] = None, - **kwargs: Any - ) -> None: - """ - :keyword created_by: The identity that created the resource. - :paramtype created_by: str - :keyword created_by_type: The type of identity that created the resource. Known values are: - "User", "Application", "ManagedIdentity", and "Key". - :paramtype created_by_type: str or - ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.CreatedByType - :keyword created_at: The timestamp of resource creation (UTC). - :paramtype created_at: ~datetime.datetime - :keyword last_modified_by: The identity that last modified the resource. - :paramtype last_modified_by: str - :keyword last_modified_by_type: The type of identity that last modified the resource. Known - values are: "User", "Application", "ManagedIdentity", and "Key". - :paramtype last_modified_by_type: str or - ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.CreatedByType - :keyword last_modified_at: The timestamp of resource last modification (UTC). - :paramtype last_modified_at: ~datetime.datetime - """ - super().__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 UpdateGroup(_serialization.Model): - """A group to be updated. - - All required parameters must be populated in order to send to server. - - :ivar name: Name of the group. - It must match a group name of an existing fleet member. Required. - :vartype name: str - """ - - _validation = { - "name": {"required": True, "max_length": 50, "min_length": 1, "pattern": r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$"}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - } - - def __init__(self, *, name: str, **kwargs: Any) -> None: - """ - :keyword name: Name of the group. - It must match a group name of an existing fleet member. Required. - :paramtype name: str - """ - super().__init__(**kwargs) - self.name = name - - -class UpdateGroupStatus(_serialization.Model): - """The status of a UpdateGroup. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar status: The status of the UpdateGroup. - :vartype status: ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.UpdateStatus - :ivar name: The name of the UpdateGroup. - :vartype name: str - :ivar members: The list of member this UpdateGroup updates. - :vartype members: - list[~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.MemberUpdateStatus] - """ - - _validation = { - "status": {"readonly": True}, - "name": {"readonly": True}, - "members": {"readonly": True}, - } - - _attribute_map = { - "status": {"key": "status", "type": "UpdateStatus"}, - "name": {"key": "name", "type": "str"}, - "members": {"key": "members", "type": "[MemberUpdateStatus]"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.status = None - self.name = None - self.members = None - - -class UpdateRun(ProxyResource): - """A multi-stage process to perform update operations across members of a Fleet. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar id: Fully qualified resource ID for the resource. Ex - - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. # pylint: disable=line-too-long - :vartype id: str - :ivar name: The name of the resource. - :vartype name: str - :ivar type: The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or - "Microsoft.Storage/storageAccounts". - :vartype type: str - :ivar system_data: Azure Resource Manager metadata containing createdBy and modifiedBy - information. - :vartype system_data: ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.SystemData - :ivar e_tag: If eTag is provided in the response body, it may also be provided as a header per - the normal etag convention. Entity tags are used for comparing two or more entities from the - same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match - (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. - :vartype e_tag: str - :ivar provisioning_state: The provisioning state of the UpdateRun resource. Known values are: - "Succeeded", "Failed", and "Canceled". - :vartype provisioning_state: str or - ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.UpdateRunProvisioningState - :ivar update_strategy_id: The resource id of the FleetUpdateStrategy resource to reference. - - When creating a new run, there are three ways to define a strategy for the run: - - - #. Define a new strategy in place: Set the "strategy" field. - #. Use an existing strategy: Set the "updateStrategyId" field. (since 2023-08-15-preview) - #. Use the default strategy to update all the members one by one: Leave both - "updateStrategyId" and "strategy" unset. (since 2023-08-15-preview) - - Setting both "updateStrategyId" and "strategy" is invalid. - - UpdateRuns created by "updateStrategyId" snapshot the referenced UpdateStrategy at the time of - creation and store it in the "strategy" field. - Subsequent changes to the referenced FleetUpdateStrategy resource do not propagate. - UpdateRunStrategy changes can be made directly on the "strategy" field before launching the - UpdateRun. - :vartype update_strategy_id: str - :ivar strategy: The strategy defines the order in which the clusters will be updated. - If not set, all members will be updated sequentially. The UpdateRun status will show a single - UpdateStage and a single UpdateGroup targeting all members. - The strategy of the UpdateRun can be modified until the run is started. - :vartype strategy: - ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.UpdateRunStrategy - :ivar managed_cluster_update: The update to be applied to all clusters in the UpdateRun. The - managedClusterUpdate can be modified until the run is started. - :vartype managed_cluster_update: - ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.ManagedClusterUpdate - :ivar status: The status of the UpdateRun. - :vartype status: ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.UpdateRunStatus - """ - - _validation = { - "id": {"readonly": True}, - "name": {"readonly": True}, - "type": {"readonly": True}, - "system_data": {"readonly": True}, - "e_tag": {"readonly": True}, - "provisioning_state": {"readonly": True}, - "status": {"readonly": True}, - } - - _attribute_map = { - "id": {"key": "id", "type": "str"}, - "name": {"key": "name", "type": "str"}, - "type": {"key": "type", "type": "str"}, - "system_data": {"key": "systemData", "type": "SystemData"}, - "e_tag": {"key": "eTag", "type": "str"}, - "provisioning_state": {"key": "properties.provisioningState", "type": "str"}, - "update_strategy_id": {"key": "properties.updateStrategyId", "type": "str"}, - "strategy": {"key": "properties.strategy", "type": "UpdateRunStrategy"}, - "managed_cluster_update": {"key": "properties.managedClusterUpdate", "type": "ManagedClusterUpdate"}, - "status": {"key": "properties.status", "type": "UpdateRunStatus"}, - } - - def __init__( - self, - *, - update_strategy_id: Optional[str] = None, - strategy: Optional["_models.UpdateRunStrategy"] = None, - managed_cluster_update: Optional["_models.ManagedClusterUpdate"] = None, - **kwargs: Any - ) -> None: - """ - :keyword update_strategy_id: The resource id of the FleetUpdateStrategy resource to reference. - - When creating a new run, there are three ways to define a strategy for the run: - - - #. Define a new strategy in place: Set the "strategy" field. - #. Use an existing strategy: Set the "updateStrategyId" field. (since 2023-08-15-preview) - #. Use the default strategy to update all the members one by one: Leave both - "updateStrategyId" and "strategy" unset. (since 2023-08-15-preview) - - Setting both "updateStrategyId" and "strategy" is invalid. - - UpdateRuns created by "updateStrategyId" snapshot the referenced UpdateStrategy at the time of - creation and store it in the "strategy" field. - Subsequent changes to the referenced FleetUpdateStrategy resource do not propagate. - UpdateRunStrategy changes can be made directly on the "strategy" field before launching the - UpdateRun. - :paramtype update_strategy_id: str - :keyword strategy: The strategy defines the order in which the clusters will be updated. - If not set, all members will be updated sequentially. The UpdateRun status will show a single - UpdateStage and a single UpdateGroup targeting all members. - The strategy of the UpdateRun can be modified until the run is started. - :paramtype strategy: - ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.UpdateRunStrategy - :keyword managed_cluster_update: The update to be applied to all clusters in the UpdateRun. The - managedClusterUpdate can be modified until the run is started. - :paramtype managed_cluster_update: - ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.ManagedClusterUpdate - """ - super().__init__(**kwargs) - self.e_tag = None - self.provisioning_state = None - self.update_strategy_id = update_strategy_id - self.strategy = strategy - self.managed_cluster_update = managed_cluster_update - self.status = None - - -class UpdateRunListResult(_serialization.Model): - """The response of a UpdateRun list operation. - - All required parameters must be populated in order to send to server. - - :ivar value: The UpdateRun items on this page. Required. - :vartype value: list[~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.UpdateRun] - :ivar next_link: The link to the next page of items. - :vartype next_link: str - """ - - _validation = { - "value": {"required": True}, - } - - _attribute_map = { - "value": {"key": "value", "type": "[UpdateRun]"}, - "next_link": {"key": "nextLink", "type": "str"}, - } - - def __init__(self, *, value: List["_models.UpdateRun"], next_link: Optional[str] = None, **kwargs: Any) -> None: - """ - :keyword value: The UpdateRun items on this page. Required. - :paramtype value: list[~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.UpdateRun] - :keyword next_link: The link to the next page of items. - :paramtype next_link: str - """ - super().__init__(**kwargs) - self.value = value - self.next_link = next_link - - -class UpdateRunStatus(_serialization.Model): - """The status of a UpdateRun. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar status: The status of the UpdateRun. - :vartype status: ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.UpdateStatus - :ivar stages: The stages composing an update run. Stages are run sequentially withing an - UpdateRun. - :vartype stages: - list[~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.UpdateStageStatus] - :ivar node_image_selection: The node image upgrade specs for the update run. It is only set in - update run when ``NodeImageSelection.type`` is ``Consistent``. - :vartype node_image_selection: - ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.NodeImageSelectionStatus - """ - - _validation = { - "status": {"readonly": True}, - "stages": {"readonly": True}, - "node_image_selection": {"readonly": True}, - } - - _attribute_map = { - "status": {"key": "status", "type": "UpdateStatus"}, - "stages": {"key": "stages", "type": "[UpdateStageStatus]"}, - "node_image_selection": {"key": "nodeImageSelection", "type": "NodeImageSelectionStatus"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.status = None - self.stages = None - self.node_image_selection = None - - -class UpdateRunStrategy(_serialization.Model): - """Defines the update sequence of the clusters via stages and groups. - - Stages within a run are executed sequentially one after another. - Groups within a stage are executed in parallel. - Member clusters within a group are updated sequentially one after another. - - A valid strategy contains no duplicate groups within or across stages. - - All required parameters must be populated in order to send to server. - - :ivar stages: The list of stages that compose this update run. Min size: 1. Required. - :vartype stages: list[~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.UpdateStage] - """ - - _validation = { - "stages": {"required": True}, - } - - _attribute_map = { - "stages": {"key": "stages", "type": "[UpdateStage]"}, - } - - def __init__(self, *, stages: List["_models.UpdateStage"], **kwargs: Any) -> None: - """ - :keyword stages: The list of stages that compose this update run. Min size: 1. Required. - :paramtype stages: - list[~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.UpdateStage] - """ - super().__init__(**kwargs) - self.stages = stages - - -class UpdateStage(_serialization.Model): - """Defines a stage which contains the groups to update and the steps to take (e.g., wait for a - time period) before starting the next stage. - - All required parameters must be populated in order to send to server. - - :ivar name: The name of the stage. Must be unique within the UpdateRun. Required. - :vartype name: str - :ivar groups: Defines the groups to be executed in parallel in this stage. Duplicate groups are - not allowed. Min size: 1. - :vartype groups: list[~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.UpdateGroup] - :ivar after_stage_wait_in_seconds: The time in seconds to wait at the end of this stage before - starting the next one. Defaults to 0 seconds if unspecified. - :vartype after_stage_wait_in_seconds: int - """ - - _validation = { - "name": {"required": True, "max_length": 50, "min_length": 1, "pattern": r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$"}, - } - - _attribute_map = { - "name": {"key": "name", "type": "str"}, - "groups": {"key": "groups", "type": "[UpdateGroup]"}, - "after_stage_wait_in_seconds": {"key": "afterStageWaitInSeconds", "type": "int"}, - } - - def __init__( - self, - *, - name: str, - groups: Optional[List["_models.UpdateGroup"]] = None, - after_stage_wait_in_seconds: Optional[int] = None, - **kwargs: Any - ) -> None: - """ - :keyword name: The name of the stage. Must be unique within the UpdateRun. Required. - :paramtype name: str - :keyword groups: Defines the groups to be executed in parallel in this stage. Duplicate groups - are not allowed. Min size: 1. - :paramtype groups: - list[~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.UpdateGroup] - :keyword after_stage_wait_in_seconds: The time in seconds to wait at the end of this stage - before starting the next one. Defaults to 0 seconds if unspecified. - :paramtype after_stage_wait_in_seconds: int - """ - super().__init__(**kwargs) - self.name = name - self.groups = groups - self.after_stage_wait_in_seconds = after_stage_wait_in_seconds - - -class UpdateStageStatus(_serialization.Model): - """The status of a UpdateStage. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar status: The status of the UpdateStage. - :vartype status: ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.UpdateStatus - :ivar name: The name of the UpdateStage. - :vartype name: str - :ivar groups: The list of groups to be updated as part of this UpdateStage. - :vartype groups: - list[~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.UpdateGroupStatus] - :ivar after_stage_wait_status: The status of the wait period configured on the UpdateStage. - :vartype after_stage_wait_status: - ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.WaitStatus - """ - - _validation = { - "status": {"readonly": True}, - "name": {"readonly": True}, - "groups": {"readonly": True}, - "after_stage_wait_status": {"readonly": True}, - } - - _attribute_map = { - "status": {"key": "status", "type": "UpdateStatus"}, - "name": {"key": "name", "type": "str"}, - "groups": {"key": "groups", "type": "[UpdateGroupStatus]"}, - "after_stage_wait_status": {"key": "afterStageWaitStatus", "type": "WaitStatus"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.status = None - self.name = None - self.groups = None - self.after_stage_wait_status = None - - -class UpdateStatus(_serialization.Model): - """The status for an operation or group of operations. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar start_time: The time the operation or group was started. - :vartype start_time: ~datetime.datetime - :ivar completed_time: The time the operation or group was completed. - :vartype completed_time: ~datetime.datetime - :ivar state: The State of the operation or group. Known values are: "NotStarted", "Running", - "Stopping", "Stopped", "Skipped", "Failed", and "Completed". - :vartype state: str or ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.UpdateState - :ivar error: The error details when a failure is encountered. - :vartype error: ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.ErrorDetail - """ - - _validation = { - "start_time": {"readonly": True}, - "completed_time": {"readonly": True}, - "state": {"readonly": True}, - "error": {"readonly": True}, - } - - _attribute_map = { - "start_time": {"key": "startTime", "type": "iso-8601"}, - "completed_time": {"key": "completedTime", "type": "iso-8601"}, - "state": {"key": "state", "type": "str"}, - "error": {"key": "error", "type": "ErrorDetail"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.start_time = None - self.completed_time = None - self.state = None - self.error = None - - -class UserAssignedIdentity(_serialization.Model): - """User assigned identity properties. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar principal_id: The principal ID of the assigned identity. - :vartype principal_id: str - :ivar client_id: The client ID of the assigned identity. - :vartype client_id: str - """ - - _validation = { - "principal_id": {"readonly": True}, - "client_id": {"readonly": True}, - } - - _attribute_map = { - "principal_id": {"key": "principalId", "type": "str"}, - "client_id": {"key": "clientId", "type": "str"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.principal_id = None - self.client_id = None - - -class WaitStatus(_serialization.Model): - """The status of the wait duration. - - Variables are only populated by the server, and will be ignored when sending a request. - - :ivar status: The status of the wait duration. - :vartype status: ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.UpdateStatus - :ivar wait_duration_in_seconds: The wait duration configured in seconds. - :vartype wait_duration_in_seconds: int - """ - - _validation = { - "status": {"readonly": True}, - "wait_duration_in_seconds": {"readonly": True}, - } - - _attribute_map = { - "status": {"key": "status", "type": "UpdateStatus"}, - "wait_duration_in_seconds": {"key": "waitDurationInSeconds", "type": "int"}, - } - - def __init__(self, **kwargs: Any) -> None: - """ """ - super().__init__(**kwargs) - self.status = None - self.wait_duration_in_seconds = None diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_05_02_preview/models/_patch.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_05_02_preview/models/_patch.py deleted file mode 100644 index f7dd32510333d..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_05_02_preview/models/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_05_02_preview/operations/__init__.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_05_02_preview/operations/__init__.py deleted file mode 100644 index 1d1e4703657d6..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_05_02_preview/operations/__init__.py +++ /dev/null @@ -1,29 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from ._operations import Operations -from ._fleets_operations import FleetsOperations -from ._auto_upgrade_profiles_operations import AutoUpgradeProfilesOperations -from ._fleet_members_operations import FleetMembersOperations -from ._update_runs_operations import UpdateRunsOperations -from ._fleet_update_strategies_operations import FleetUpdateStrategiesOperations - -from ._patch import __all__ as _patch_all -from ._patch import * # pylint: disable=unused-wildcard-import -from ._patch import patch_sdk as _patch_sdk - -__all__ = [ - "Operations", - "FleetsOperations", - "AutoUpgradeProfilesOperations", - "FleetMembersOperations", - "UpdateRunsOperations", - "FleetUpdateStrategiesOperations", -] -__all__.extend([p for p in _patch_all if p not in __all__]) -_patch_sdk() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_05_02_preview/operations/_auto_upgrade_profiles_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_05_02_preview/operations/_auto_upgrade_profiles_operations.py deleted file mode 100644 index 5fbaf7d9d560d..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_05_02_preview/operations/_auto_upgrade_profiles_operations.py +++ /dev/null @@ -1,789 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_fleet_request( - resource_group_name: str, fleet_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-02-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/autoUpgradeProfiles", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, fleet_name: str, auto_upgrade_profile_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-02-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/autoUpgradeProfiles/{autoUpgradeProfileName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - "autoUpgradeProfileName": _SERIALIZER.url( - "auto_upgrade_profile_name", - auto_upgrade_profile_name, - "str", - max_length=50, - min_length=1, - pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - fleet_name: str, - auto_upgrade_profile_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-02-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/autoUpgradeProfiles/{autoUpgradeProfileName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - "autoUpgradeProfileName": _SERIALIZER.url( - "auto_upgrade_profile_name", - auto_upgrade_profile_name, - "str", - max_length=50, - min_length=1, - pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if if_none_match is not None: - _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - fleet_name: str, - auto_upgrade_profile_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-02-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/autoUpgradeProfiles/{autoUpgradeProfileName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - "autoUpgradeProfileName": _SERIALIZER.url( - "auto_upgrade_profile_name", - auto_upgrade_profile_name, - "str", - max_length=50, - min_length=1, - pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -class AutoUpgradeProfilesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.containerservicefleet.v2024_05_02_preview.ContainerServiceFleetMgmtClient`'s - :attr:`auto_upgrade_profiles` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_by_fleet( - self, resource_group_name: str, fleet_name: str, **kwargs: Any - ) -> Iterable["_models.AutoUpgradeProfile"]: - """List AutoUpgradeProfile resources by Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :return: An iterator like instance of either AutoUpgradeProfile or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.AutoUpgradeProfile] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-02-preview") - ) - cls: ClsType[_models.AutoUpgradeProfileListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_fleet_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("AutoUpgradeProfileListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get( - self, resource_group_name: str, fleet_name: str, auto_upgrade_profile_name: str, **kwargs: Any - ) -> _models.AutoUpgradeProfile: - """Get a AutoUpgradeProfile. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param auto_upgrade_profile_name: The name of the AutoUpgradeProfile resource. Required. - :type auto_upgrade_profile_name: str - :return: AutoUpgradeProfile or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.AutoUpgradeProfile - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-02-preview") - ) - cls: ClsType[_models.AutoUpgradeProfile] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - auto_upgrade_profile_name=auto_upgrade_profile_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("AutoUpgradeProfile", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - fleet_name: str, - auto_upgrade_profile_name: str, - resource: Union[_models.AutoUpgradeProfile, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-02-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "AutoUpgradeProfile") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - auto_upgrade_profile_name=auto_upgrade_profile_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Azure-AsyncOperation"] = self._deserialize( - "str", response.headers.get("Azure-AsyncOperation") - ) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - auto_upgrade_profile_name: str, - resource: _models.AutoUpgradeProfile, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.AutoUpgradeProfile]: - """Create a AutoUpgradeProfile. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param auto_upgrade_profile_name: The name of the AutoUpgradeProfile resource. Required. - :type auto_upgrade_profile_name: str - :param resource: Resource create parameters. Required. - :type resource: ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.AutoUpgradeProfile - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either AutoUpgradeProfile or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.AutoUpgradeProfile] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - auto_upgrade_profile_name: str, - resource: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.AutoUpgradeProfile]: - """Create a AutoUpgradeProfile. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param auto_upgrade_profile_name: The name of the AutoUpgradeProfile resource. Required. - :type auto_upgrade_profile_name: str - :param resource: Resource create parameters. Required. - :type resource: IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either AutoUpgradeProfile or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.AutoUpgradeProfile] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - auto_upgrade_profile_name: str, - resource: Union[_models.AutoUpgradeProfile, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[_models.AutoUpgradeProfile]: - """Create a AutoUpgradeProfile. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param auto_upgrade_profile_name: The name of the AutoUpgradeProfile resource. Required. - :type auto_upgrade_profile_name: str - :param resource: Resource create parameters. Is either a AutoUpgradeProfile type or a IO[bytes] - type. Required. - :type resource: ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.AutoUpgradeProfile - or IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :return: An instance of LROPoller that returns either AutoUpgradeProfile or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.AutoUpgradeProfile] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-02-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.AutoUpgradeProfile] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - auto_upgrade_profile_name=auto_upgrade_profile_name, - resource=resource, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("AutoUpgradeProfile", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.AutoUpgradeProfile].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.AutoUpgradeProfile]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, - resource_group_name: str, - fleet_name: str, - auto_upgrade_profile_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-02-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - auto_upgrade_profile_name=auto_upgrade_profile_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, - resource_group_name: str, - fleet_name: str, - auto_upgrade_profile_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[None]: - """Delete a AutoUpgradeProfile. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param auto_upgrade_profile_name: The name of the AutoUpgradeProfile resource. Required. - :type auto_upgrade_profile_name: str - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-02-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - auto_upgrade_profile_name=auto_upgrade_profile_name, - if_match=if_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_05_02_preview/operations/_fleet_members_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_05_02_preview/operations/_fleet_members_operations.py deleted file mode 100644 index 60ff4d4a58460..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_05_02_preview/operations/_fleet_members_operations.py +++ /dev/null @@ -1,1076 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_fleet_request( - resource_group_name: str, fleet_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-02-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, fleet_name: str, fleet_member_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-02-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - "fleetMemberName": _SERIALIZER.url( - "fleet_member_name", - fleet_member_name, - "str", - max_length=50, - min_length=1, - pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_request( - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-02-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - "fleetMemberName": _SERIALIZER.url( - "fleet_member_name", - fleet_member_name, - "str", - max_length=50, - min_length=1, - pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if if_none_match is not None: - _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-02-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - "fleetMemberName": _SERIALIZER.url( - "fleet_member_name", - fleet_member_name, - "str", - max_length=50, - min_length=1, - pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-02-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - "fleetMemberName": _SERIALIZER.url( - "fleet_member_name", - fleet_member_name, - "str", - max_length=50, - min_length=1, - pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -class FleetMembersOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.containerservicefleet.v2024_05_02_preview.ContainerServiceFleetMgmtClient`'s - :attr:`fleet_members` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_by_fleet( - self, resource_group_name: str, fleet_name: str, **kwargs: Any - ) -> Iterable["_models.FleetMember"]: - """List FleetMember resources by Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :return: An iterator like instance of either FleetMember or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.FleetMember] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-02-preview") - ) - cls: ClsType[_models.FleetMemberListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_fleet_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("FleetMemberListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get( - self, resource_group_name: str, fleet_name: str, fleet_member_name: str, **kwargs: Any - ) -> _models.FleetMember: - """Get a FleetMember. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :return: FleetMember or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.FleetMember - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-02-preview") - ) - cls: ClsType[_models.FleetMember] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - fleet_member_name=fleet_member_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("FleetMember", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_initial( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - resource: Union[_models.FleetMember, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-02-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "FleetMember") - - _request = build_create_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - fleet_member_name=fleet_member_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - resource: _models.FleetMember, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.FleetMember]: - """Create a FleetMember. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :param resource: Resource create parameters. Required. - :type resource: ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.FleetMember - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either FleetMember or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.FleetMember] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - resource: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.FleetMember]: - """Create a FleetMember. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :param resource: Resource create parameters. Required. - :type resource: IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either FleetMember or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.FleetMember] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - resource: Union[_models.FleetMember, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[_models.FleetMember]: - """Create a FleetMember. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :param resource: Resource create parameters. Is either a FleetMember type or a IO[bytes] type. - Required. - :type resource: ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.FleetMember or - IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :return: An instance of LROPoller that returns either FleetMember or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.FleetMember] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-02-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FleetMember] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - fleet_member_name=fleet_member_name, - resource=resource, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FleetMember", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.FleetMember].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.FleetMember]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_initial( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - properties: Union[_models.FleetMemberUpdate, IO[bytes]], - if_match: Optional[str] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-02-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties - else: - _json = self._serialize.body(properties, "FleetMemberUpdate") - - _request = build_update_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - fleet_member_name=fleet_member_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - properties: _models.FleetMemberUpdate, - if_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.FleetMember]: - """Update a FleetMember. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :param properties: The resource properties to be updated. Required. - :type properties: - ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.FleetMemberUpdate - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either FleetMember or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.FleetMember] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - properties: IO[bytes], - if_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.FleetMember]: - """Update a FleetMember. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :param properties: The resource properties to be updated. Required. - :type properties: IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either FleetMember or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.FleetMember] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - properties: Union[_models.FleetMemberUpdate, IO[bytes]], - if_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[_models.FleetMember]: - """Update a FleetMember. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :param properties: The resource properties to be updated. Is either a FleetMemberUpdate type or - a IO[bytes] type. Required. - :type properties: - ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.FleetMemberUpdate or IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :return: An instance of LROPoller that returns either FleetMember or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.FleetMember] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-02-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FleetMember] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - fleet_member_name=fleet_member_name, - properties=properties, - if_match=if_match, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FleetMember", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.FleetMember].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.FleetMember]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-02-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - fleet_member_name=fleet_member_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, - resource_group_name: str, - fleet_name: str, - fleet_member_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[None]: - """Delete a FleetMember. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param fleet_member_name: The name of the Fleet member resource. Required. - :type fleet_member_name: str - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-02-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - fleet_member_name=fleet_member_name, - if_match=if_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_05_02_preview/operations/_fleet_update_strategies_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_05_02_preview/operations/_fleet_update_strategies_operations.py deleted file mode 100644 index 0a7d215de0d96..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_05_02_preview/operations/_fleet_update_strategies_operations.py +++ /dev/null @@ -1,787 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_fleet_request( - resource_group_name: str, fleet_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-02-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateStrategies", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, fleet_name: str, update_strategy_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-02-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateStrategies/{updateStrategyName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - "updateStrategyName": _SERIALIZER.url( - "update_strategy_name", - update_strategy_name, - "str", - max_length=50, - min_length=1, - pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - fleet_name: str, - update_strategy_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-02-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateStrategies/{updateStrategyName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - "updateStrategyName": _SERIALIZER.url( - "update_strategy_name", - update_strategy_name, - "str", - max_length=50, - min_length=1, - pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if if_none_match is not None: - _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - fleet_name: str, - update_strategy_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-02-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateStrategies/{updateStrategyName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - "updateStrategyName": _SERIALIZER.url( - "update_strategy_name", - update_strategy_name, - "str", - max_length=50, - min_length=1, - pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -class FleetUpdateStrategiesOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.containerservicefleet.v2024_05_02_preview.ContainerServiceFleetMgmtClient`'s - :attr:`fleet_update_strategies` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_by_fleet( - self, resource_group_name: str, fleet_name: str, **kwargs: Any - ) -> Iterable["_models.FleetUpdateStrategy"]: - """List FleetUpdateStrategy resources by Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :return: An iterator like instance of either FleetUpdateStrategy or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.FleetUpdateStrategy] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-02-preview") - ) - cls: ClsType[_models.FleetUpdateStrategyListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_fleet_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("FleetUpdateStrategyListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get( - self, resource_group_name: str, fleet_name: str, update_strategy_name: str, **kwargs: Any - ) -> _models.FleetUpdateStrategy: - """Get a FleetUpdateStrategy. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_strategy_name: The name of the UpdateStrategy resource. Required. - :type update_strategy_name: str - :return: FleetUpdateStrategy or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.FleetUpdateStrategy - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-02-preview") - ) - cls: ClsType[_models.FleetUpdateStrategy] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_strategy_name=update_strategy_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("FleetUpdateStrategy", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - fleet_name: str, - update_strategy_name: str, - resource: Union[_models.FleetUpdateStrategy, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-02-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "FleetUpdateStrategy") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_strategy_name=update_strategy_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - update_strategy_name: str, - resource: _models.FleetUpdateStrategy, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.FleetUpdateStrategy]: - """Create a FleetUpdateStrategy. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_strategy_name: The name of the UpdateStrategy resource. Required. - :type update_strategy_name: str - :param resource: Resource create parameters. Required. - :type resource: - ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.FleetUpdateStrategy - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either FleetUpdateStrategy or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.FleetUpdateStrategy] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - update_strategy_name: str, - resource: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.FleetUpdateStrategy]: - """Create a FleetUpdateStrategy. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_strategy_name: The name of the UpdateStrategy resource. Required. - :type update_strategy_name: str - :param resource: Resource create parameters. Required. - :type resource: IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either FleetUpdateStrategy or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.FleetUpdateStrategy] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - update_strategy_name: str, - resource: Union[_models.FleetUpdateStrategy, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[_models.FleetUpdateStrategy]: - """Create a FleetUpdateStrategy. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_strategy_name: The name of the UpdateStrategy resource. Required. - :type update_strategy_name: str - :param resource: Resource create parameters. Is either a FleetUpdateStrategy type or a - IO[bytes] type. Required. - :type resource: - ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.FleetUpdateStrategy or IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :return: An instance of LROPoller that returns either FleetUpdateStrategy or the result of - cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.FleetUpdateStrategy] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-02-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.FleetUpdateStrategy] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_strategy_name=update_strategy_name, - resource=resource, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("FleetUpdateStrategy", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.FleetUpdateStrategy].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.FleetUpdateStrategy]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, - resource_group_name: str, - fleet_name: str, - update_strategy_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-02-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_strategy_name=update_strategy_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, - resource_group_name: str, - fleet_name: str, - update_strategy_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[None]: - """Delete a FleetUpdateStrategy. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_strategy_name: The name of the UpdateStrategy resource. Required. - :type update_strategy_name: str - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-02-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_strategy_name=update_strategy_name, - if_match=if_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_05_02_preview/operations/_fleets_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_05_02_preview/operations/_fleets_operations.py deleted file mode 100644 index 06f9f28013039..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_05_02_preview/operations/_fleets_operations.py +++ /dev/null @@ -1,1165 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-02-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/fleets") - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_by_resource_group_request(resource_group_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-02-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request(resource_group_name: str, fleet_name: str, subscription_id: str, **kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-02-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - fleet_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-02-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if if_none_match is not None: - _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_update_request( - resource_group_name: str, fleet_name: str, subscription_id: str, *, if_match: Optional[str] = None, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-02-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PATCH", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, fleet_name: str, subscription_id: str, *, if_match: Optional[str] = None, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-02-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_list_credentials_request( - resource_group_name: str, fleet_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-02-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/listCredentials", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class FleetsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.containerservicefleet.v2024_05_02_preview.ContainerServiceFleetMgmtClient`'s - :attr:`fleets` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_by_subscription(self, **kwargs: Any) -> Iterable["_models.Fleet"]: - """Lists fleets in the specified subscription. - - :return: An iterator like instance of either Fleet or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-02-preview") - ) - cls: ClsType[_models.FleetListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_subscription_request( - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("FleetListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def list_by_resource_group(self, resource_group_name: str, **kwargs: Any) -> Iterable["_models.Fleet"]: - """Lists fleets in the specified subscription and resource group. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :return: An iterator like instance of either Fleet or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-02-preview") - ) - cls: ClsType[_models.FleetListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_resource_group_request( - resource_group_name=resource_group_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("FleetListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get(self, resource_group_name: str, fleet_name: str, **kwargs: Any) -> _models.Fleet: - """Gets a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :return: Fleet or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.Fleet - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-02-preview") - ) - cls: ClsType[_models.Fleet] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("Fleet", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - fleet_name: str, - resource: Union[_models.Fleet, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-02-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "Fleet") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - resource: _models.Fleet, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Fleet]: - """Creates or updates a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param resource: Resource create parameters. Required. - :type resource: ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.Fleet - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either Fleet or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - resource: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Fleet]: - """Creates or updates a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param resource: Resource create parameters. Required. - :type resource: IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either Fleet or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - resource: Union[_models.Fleet, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[_models.Fleet]: - """Creates or updates a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param resource: Resource create parameters. Is either a Fleet type or a IO[bytes] type. - Required. - :type resource: ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.Fleet or IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :return: An instance of LROPoller that returns either Fleet or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-02-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Fleet] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - resource=resource, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Fleet", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.Fleet].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.Fleet]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _update_initial( - self, - resource_group_name: str, - fleet_name: str, - properties: Union[_models.FleetPatch, IO[bytes]], - if_match: Optional[str] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-02-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(properties, (IOBase, bytes)): - _content = properties - else: - _json = self._serialize.body(properties, "FleetPatch") - - _request = build_update_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_update( - self, - resource_group_name: str, - fleet_name: str, - properties: _models.FleetPatch, - if_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Fleet]: - """Update a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param properties: The resource properties to be updated. Required. - :type properties: ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.FleetPatch - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either Fleet or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_update( - self, - resource_group_name: str, - fleet_name: str, - properties: IO[bytes], - if_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.Fleet]: - """Update a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param properties: The resource properties to be updated. Required. - :type properties: IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either Fleet or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_update( - self, - resource_group_name: str, - fleet_name: str, - properties: Union[_models.FleetPatch, IO[bytes]], - if_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[_models.Fleet]: - """Update a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param properties: The resource properties to be updated. Is either a FleetPatch type or a - IO[bytes] type. Required. - :type properties: ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.FleetPatch or - IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :return: An instance of LROPoller that returns either Fleet or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.Fleet] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-02-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.Fleet] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._update_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - properties=properties, - if_match=if_match, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("Fleet", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "original-uri"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.Fleet].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.Fleet]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, resource_group_name: str, fleet_name: str, if_match: Optional[str] = None, **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-02-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, resource_group_name: str, fleet_name: str, if_match: Optional[str] = None, **kwargs: Any - ) -> LROPoller[None]: - """Delete a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-02-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - if_match=if_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - @distributed_trace - def list_credentials( - self, resource_group_name: str, fleet_name: str, **kwargs: Any - ) -> _models.FleetCredentialResults: - """Lists the user credentials of a Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :return: FleetCredentialResults or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.FleetCredentialResults - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-02-preview") - ) - cls: ClsType[_models.FleetCredentialResults] = kwargs.pop("cls", None) - - _request = build_list_credentials_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("FleetCredentialResults", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_05_02_preview/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_05_02_preview/operations/_operations.py deleted file mode 100644 index 39091f27f596d..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_05_02_preview/operations/_operations.py +++ /dev/null @@ -1,156 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 sys -from typing import Any, Callable, Dict, Iterable, Optional, Type, TypeVar -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_request(**kwargs: Any) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-02-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop("template_url", "/providers/Microsoft.ContainerService/operations") - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -class Operations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.containerservicefleet.v2024_05_02_preview.ContainerServiceFleetMgmtClient`'s - :attr:`operations` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list(self, **kwargs: Any) -> Iterable["_models.Operation"]: - """List the operations for the provider. - - :return: An iterator like instance of either Operation or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.Operation] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-02-preview") - ) - cls: ClsType[_models.OperationListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_request( - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - 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) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_05_02_preview/operations/_patch.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_05_02_preview/operations/_patch.py deleted file mode 100644 index f7dd32510333d..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_05_02_preview/operations/_patch.py +++ /dev/null @@ -1,20 +0,0 @@ -# ------------------------------------ -# Copyright (c) Microsoft Corporation. -# Licensed under the MIT License. -# ------------------------------------ -"""Customize generated code here. - -Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize -""" -from typing import List - -__all__: List[str] = [] # Add all objects you want publicly available to users at this package level - - -def patch_sdk(): - """Do not remove from this file. - - `patch_sdk` is a last resort escape hatch that allows you to do customizations - you can't accomplish using the techniques described in - https://aka.ms/azsdk/python/dpcodegen/python/customize - """ diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_05_02_preview/operations/_update_runs_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_05_02_preview/operations/_update_runs_operations.py deleted file mode 100644 index 6aa085585e3be..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_05_02_preview/operations/_update_runs_operations.py +++ /dev/null @@ -1,1449 +0,0 @@ -# pylint: disable=too-many-lines,too-many-statements -# 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 io import IOBase -import sys -from typing import Any, Callable, Dict, IO, Iterable, Iterator, Optional, Type, TypeVar, Union, cast, overload -import urllib.parse - -from azure.core.exceptions import ( - ClientAuthenticationError, - HttpResponseError, - ResourceExistsError, - ResourceNotFoundError, - ResourceNotModifiedError, - StreamClosedError, - StreamConsumedError, - map_error, -) -from azure.core.paging import ItemPaged -from azure.core.pipeline import PipelineResponse -from azure.core.polling import LROPoller, NoPolling, PollingMethod -from azure.core.rest import HttpRequest, HttpResponse -from azure.core.tracing.decorator import distributed_trace -from azure.core.utils import case_insensitive_dict -from azure.mgmt.core.exceptions import ARMErrorFormat -from azure.mgmt.core.polling.arm_polling import ARMPolling - -from .. import models as _models -from ..._serialization import Serializer - -if sys.version_info >= (3, 9): - from collections.abc import MutableMapping -else: - from typing import MutableMapping # type: ignore # pylint: disable=ungrouped-imports -T = TypeVar("T") -ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]] - -_SERIALIZER = Serializer() -_SERIALIZER.client_side_validation = False - - -def build_list_by_fleet_request( - resource_group_name: str, fleet_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-02-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_get_request( - resource_group_name: str, fleet_name: str, update_run_name: str, subscription_id: str, **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-02-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - "updateRunName": _SERIALIZER.url( - "update_run_name", - update_run_name, - "str", - max_length=50, - min_length=1, - pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="GET", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_create_or_update_request( - resource_group_name: str, - fleet_name: str, - update_run_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-02-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - "updateRunName": _SERIALIZER.url( - "update_run_name", - update_run_name, - "str", - max_length=50, - min_length=1, - pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if if_none_match is not None: - _headers["If-None-Match"] = _SERIALIZER.header("if_none_match", if_none_match, "str") - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="PUT", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_delete_request( - resource_group_name: str, - fleet_name: str, - update_run_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-02-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName}", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - "updateRunName": _SERIALIZER.url( - "update_run_name", - update_run_name, - "str", - max_length=50, - min_length=1, - pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="DELETE", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_skip_request( - resource_group_name: str, - fleet_name: str, - update_run_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-02-preview")) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName}/skip", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - "updateRunName": _SERIALIZER.url( - "update_run_name", - update_run_name, - "str", - max_length=50, - min_length=1, - pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - if content_type is not None: - _headers["Content-Type"] = _SERIALIZER.header("content_type", content_type, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_start_request( - resource_group_name: str, - fleet_name: str, - update_run_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-02-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName}/start", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - "updateRunName": _SERIALIZER.url( - "update_run_name", - update_run_name, - "str", - max_length=50, - min_length=1, - pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -def build_stop_request( - resource_group_name: str, - fleet_name: str, - update_run_name: str, - subscription_id: str, - *, - if_match: Optional[str] = None, - **kwargs: Any -) -> HttpRequest: - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-02-preview")) - accept = _headers.pop("Accept", "application/json") - - # Construct URL - _url = kwargs.pop( - "template_url", - "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName}/stop", - ) # pylint: disable=line-too-long - path_format_arguments = { - "subscriptionId": _SERIALIZER.url("subscription_id", subscription_id, "str", min_length=1), - "resourceGroupName": _SERIALIZER.url( - "resource_group_name", resource_group_name, "str", max_length=90, min_length=1 - ), - "fleetName": _SERIALIZER.url( - "fleet_name", fleet_name, "str", max_length=63, min_length=1, pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$" - ), - "updateRunName": _SERIALIZER.url( - "update_run_name", - update_run_name, - "str", - max_length=50, - min_length=1, - pattern=r"^[a-z0-9]([-a-z0-9]*[a-z0-9])?$", - ), - } - - _url: str = _url.format(**path_format_arguments) # type: ignore - - # Construct parameters - _params["api-version"] = _SERIALIZER.query("api_version", api_version, "str") - - # Construct headers - if if_match is not None: - _headers["If-Match"] = _SERIALIZER.header("if_match", if_match, "str") - _headers["Accept"] = _SERIALIZER.header("accept", accept, "str") - - return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs) - - -class UpdateRunsOperations: - """ - .. warning:: - **DO NOT** instantiate this class directly. - - Instead, you should access the following operations through - :class:`~azure.mgmt.containerservicefleet.v2024_05_02_preview.ContainerServiceFleetMgmtClient`'s - :attr:`update_runs` attribute. - """ - - models = _models - - def __init__(self, *args, **kwargs): - input_args = list(args) - self._client = input_args.pop(0) if input_args else kwargs.pop("client") - self._config = input_args.pop(0) if input_args else kwargs.pop("config") - self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer") - self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer") - self._api_version = input_args.pop(0) if input_args else kwargs.pop("api_version") - - @distributed_trace - def list_by_fleet(self, resource_group_name: str, fleet_name: str, **kwargs: Any) -> Iterable["_models.UpdateRun"]: - """List UpdateRun resources by Fleet. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :return: An iterator like instance of either UpdateRun or the result of cls(response) - :rtype: - ~azure.core.paging.ItemPaged[~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.UpdateRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-02-preview") - ) - cls: ClsType[_models.UpdateRunListResult] = kwargs.pop("cls", None) - - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - def prepare_request(next_link=None): - if not next_link: - - _request = build_list_by_fleet_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - else: - # make call to next link with the client's api-version - _parsed_next_link = urllib.parse.urlparse(next_link) - _next_request_params = case_insensitive_dict( - { - key: [urllib.parse.quote(v) for v in value] - for key, value in urllib.parse.parse_qs(_parsed_next_link.query).items() - } - ) - _next_request_params["api-version"] = self._api_version - _request = HttpRequest( - "GET", urllib.parse.urljoin(next_link, _parsed_next_link.path), params=_next_request_params - ) - _request.url = self._client.format_url(_request.url) - _request.method = "GET" - return _request - - def extract_data(pipeline_response): - deserialized = self._deserialize("UpdateRunListResult", pipeline_response) - list_of_elem = deserialized.value - if cls: - list_of_elem = cls(list_of_elem) # type: ignore - return deserialized.next_link or None, iter(list_of_elem) - - def get_next(next_link=None): - _request = prepare_request(next_link) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - return pipeline_response - - return ItemPaged(get_next, extract_data) - - @distributed_trace - def get(self, resource_group_name: str, fleet_name: str, update_run_name: str, **kwargs: Any) -> _models.UpdateRun: - """Get a UpdateRun. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_run_name: The name of the UpdateRun resource. Required. - :type update_run_name: str - :return: UpdateRun or the result of cls(response) - :rtype: ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.UpdateRun - :raises ~azure.core.exceptions.HttpResponseError: - """ - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-02-preview") - ) - cls: ClsType[_models.UpdateRun] = kwargs.pop("cls", None) - - _request = build_get_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - subscription_id=self._config.subscription_id, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _stream = False - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200]: - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - deserialized = self._deserialize("UpdateRun", pipeline_response.http_response) - - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - - return deserialized # type: ignore - - def _create_or_update_initial( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - resource: Union[_models.UpdateRun, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-02-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(resource, (IOBase, bytes)): - _content = resource - else: - _json = self._serialize.body(resource, "UpdateRun") - - _request = build_create_or_update_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 201]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 201: - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - resource: _models.UpdateRun, - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.UpdateRun]: - """Create a UpdateRun. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_run_name: The name of the UpdateRun resource. Required. - :type update_run_name: str - :param resource: Resource create parameters. Required. - :type resource: ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.UpdateRun - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either UpdateRun or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.UpdateRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - resource: IO[bytes], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.UpdateRun]: - """Create a UpdateRun. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_run_name: The name of the UpdateRun resource. Required. - :type update_run_name: str - :param resource: Resource create parameters. Required. - :type resource: IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either UpdateRun or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.UpdateRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_create_or_update( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - resource: Union[_models.UpdateRun, IO[bytes]], - if_match: Optional[str] = None, - if_none_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[_models.UpdateRun]: - """Create a UpdateRun. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_run_name: The name of the UpdateRun resource. Required. - :type update_run_name: str - :param resource: Resource create parameters. Is either a UpdateRun type or a IO[bytes] type. - Required. - :type resource: ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.UpdateRun or - IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :param if_none_match: The request should only proceed if no entity matches this string. Default - value is None. - :type if_none_match: str - :return: An instance of LROPoller that returns either UpdateRun or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.UpdateRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-02-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.UpdateRun] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._create_or_update_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - resource=resource, - if_match=if_match, - if_none_match=if_none_match, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("UpdateRun", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "azure-async-operation"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.UpdateRun].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.UpdateRun]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _delete_initial( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-02-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_delete_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202, 204]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_delete( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[None]: - """Delete a UpdateRun. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_run_name: The name of the UpdateRun resource. Required. - :type update_run_name: str - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :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: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-02-preview") - ) - cls: ClsType[None] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._delete_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - if_match=if_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements - if cls: - return cls(pipeline_response, None, {}) # type: ignore - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[None].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[None](self._client, raw_result, get_long_running_output, polling_method) # type: ignore - - def _skip_initial( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - body: Union[_models.SkipProperties, IO[bytes]], - if_match: Optional[str] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-02-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - content_type = content_type or "application/json" - _json = None - _content = None - if isinstance(body, (IOBase, bytes)): - _content = body - else: - _json = self._serialize.body(body, "SkipProperties") - - _request = build_skip_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - content_type=content_type, - json=_json, - content=_content, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @overload - def begin_skip( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - body: _models.SkipProperties, - if_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.UpdateRun]: - """Skips one or a combination of member/group/stage/afterStageWait(s) of an update run. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_run_name: The name of the UpdateRun resource. Required. - :type update_run_name: str - :param body: The content of the action request. Required. - :type body: ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.SkipProperties - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for JSON body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either UpdateRun or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.UpdateRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @overload - def begin_skip( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - body: IO[bytes], - if_match: Optional[str] = None, - *, - content_type: str = "application/json", - **kwargs: Any - ) -> LROPoller[_models.UpdateRun]: - """Skips one or a combination of member/group/stage/afterStageWait(s) of an update run. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_run_name: The name of the UpdateRun resource. Required. - :type update_run_name: str - :param body: The content of the action request. Required. - :type body: IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :keyword content_type: Body Parameter content-type. Content type parameter for binary body. - Default value is "application/json". - :paramtype content_type: str - :return: An instance of LROPoller that returns either UpdateRun or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.UpdateRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - - @distributed_trace - def begin_skip( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - body: Union[_models.SkipProperties, IO[bytes]], - if_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[_models.UpdateRun]: - """Skips one or a combination of member/group/stage/afterStageWait(s) of an update run. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_run_name: The name of the UpdateRun resource. Required. - :type update_run_name: str - :param body: The content of the action request. Is either a SkipProperties type or a IO[bytes] - type. Required. - :type body: ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.SkipProperties or - IO[bytes] - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :return: An instance of LROPoller that returns either UpdateRun or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.UpdateRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = case_insensitive_dict(kwargs.pop("headers", {}) or {}) - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-02-preview") - ) - content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None)) - cls: ClsType[_models.UpdateRun] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._skip_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - body=body, - if_match=if_match, - api_version=api_version, - content_type=content_type, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("UpdateRun", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.UpdateRun].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.UpdateRun]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _start_initial( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-02-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_start_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_start( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[_models.UpdateRun]: - """Starts an UpdateRun. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_run_name: The name of the UpdateRun resource. Required. - :type update_run_name: str - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :return: An instance of LROPoller that returns either UpdateRun or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.UpdateRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-02-preview") - ) - cls: ClsType[_models.UpdateRun] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._start_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - if_match=if_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("UpdateRun", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.UpdateRun].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.UpdateRun]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) - - def _stop_initial( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> Iterator[bytes]: - error_map: MutableMapping[int, Type[HttpResponseError]] = { - 401: ClientAuthenticationError, - 404: ResourceNotFoundError, - 409: ResourceExistsError, - 304: ResourceNotModifiedError, - } - error_map.update(kwargs.pop("error_map", {}) or {}) - - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-02-preview") - ) - cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None) - - _request = build_stop_request( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - subscription_id=self._config.subscription_id, - if_match=if_match, - api_version=api_version, - headers=_headers, - params=_params, - ) - _request.url = self._client.format_url(_request.url) - - _decompress = kwargs.pop("decompress", True) - _stream = True - pipeline_response: PipelineResponse = self._client._pipeline.run( # pylint: disable=protected-access - _request, stream=_stream, **kwargs - ) - - response = pipeline_response.http_response - - if response.status_code not in [200, 202]: - try: - response.read() # Load the body in memory and close the socket - except (StreamConsumedError, StreamClosedError): - pass - map_error(status_code=response.status_code, response=response, error_map=error_map) - error = self._deserialize.failsafe_deserialize(_models.ErrorResponse, pipeline_response) - raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat) - - response_headers = {} - if response.status_code == 202: - response_headers["Location"] = self._deserialize("str", response.headers.get("Location")) - response_headers["Retry-After"] = self._deserialize("int", response.headers.get("Retry-After")) - - deserialized = response.stream_download(self._client._pipeline, decompress=_decompress) - - if cls: - return cls(pipeline_response, deserialized, response_headers) # type: ignore - - return deserialized # type: ignore - - @distributed_trace - def begin_stop( - self, - resource_group_name: str, - fleet_name: str, - update_run_name: str, - if_match: Optional[str] = None, - **kwargs: Any - ) -> LROPoller[_models.UpdateRun]: - """Stops an UpdateRun. - - :param resource_group_name: The name of the resource group. The name is case insensitive. - Required. - :type resource_group_name: str - :param fleet_name: The name of the Fleet resource. Required. - :type fleet_name: str - :param update_run_name: The name of the UpdateRun resource. Required. - :type update_run_name: str - :param if_match: The request should only proceed if an entity matches this string. Default - value is None. - :type if_match: str - :return: An instance of LROPoller that returns either UpdateRun or the result of cls(response) - :rtype: - ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.UpdateRun] - :raises ~azure.core.exceptions.HttpResponseError: - """ - _headers = kwargs.pop("headers", {}) or {} - _params = case_insensitive_dict(kwargs.pop("params", {}) or {}) - - api_version: str = kwargs.pop( - "api_version", _params.pop("api-version", self._api_version or "2024-05-02-preview") - ) - cls: ClsType[_models.UpdateRun] = kwargs.pop("cls", None) - polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) - lro_delay = kwargs.pop("polling_interval", self._config.polling_interval) - cont_token: Optional[str] = kwargs.pop("continuation_token", None) - if cont_token is None: - raw_result = self._stop_initial( - resource_group_name=resource_group_name, - fleet_name=fleet_name, - update_run_name=update_run_name, - if_match=if_match, - api_version=api_version, - cls=lambda x, y, z: x, - headers=_headers, - params=_params, - **kwargs - ) - raw_result.http_response.read() # type: ignore - kwargs.pop("error_map", None) - - def get_long_running_output(pipeline_response): - deserialized = self._deserialize("UpdateRun", pipeline_response.http_response) - if cls: - return cls(pipeline_response, deserialized, {}) # type: ignore - return deserialized - - if polling is True: - polling_method: PollingMethod = cast( - PollingMethod, ARMPolling(lro_delay, lro_options={"final-state-via": "location"}, **kwargs) - ) - elif polling is False: - polling_method = cast(PollingMethod, NoPolling()) - else: - polling_method = polling - if cont_token: - return LROPoller[_models.UpdateRun].from_continuation_token( - polling_method=polling_method, - continuation_token=cont_token, - client=self._client, - deserialization_callback=get_long_running_output, - ) - return LROPoller[_models.UpdateRun]( - self._client, raw_result, get_long_running_output, polling_method # type: ignore - ) diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_05_02_preview/py.typed b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_05_02_preview/py.typed deleted file mode 100644 index e5aff4f83af86..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_05_02_preview/py.typed +++ /dev/null @@ -1 +0,0 @@ -# Marker file for PEP 561. \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/auto_upgrade_profiles_create_or_update.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/auto_upgrade_profiles_create_or_update.py deleted file mode 100644 index 0a7e5adb99254..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/auto_upgrade_profiles_create_or_update.py +++ /dev/null @@ -1,44 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.containerservicefleet import ContainerServiceFleetMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-containerservicefleet -# USAGE - python auto_upgrade_profiles_create_or_update.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ContainerServiceFleetMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", - ) - - response = client.auto_upgrade_profiles.begin_create_or_update( - resource_group_name="rg1", - fleet_name="fleet1", - auto_upgrade_profile_name="autoupgradeprofile1", - resource={"properties": {"channel": "Stable"}}, - ).result() - print(response) - - -# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2024-05-02-preview/examples/AutoUpgradeProfiles_CreateOrUpdate.json -if __name__ == "__main__": - main() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/auto_upgrade_profiles_delete.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/auto_upgrade_profiles_delete.py deleted file mode 100644 index 960a73a3e32d4..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/auto_upgrade_profiles_delete.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.containerservicefleet import ContainerServiceFleetMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-containerservicefleet -# USAGE - python auto_upgrade_profiles_delete.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ContainerServiceFleetMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="subid1", - ) - - client.auto_upgrade_profiles.begin_delete( - resource_group_name="rg1", - fleet_name="fleet1", - auto_upgrade_profile_name="autoupgradeprofile1", - ).result() - - -# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2024-05-02-preview/examples/AutoUpgradeProfiles_Delete.json -if __name__ == "__main__": - main() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/auto_upgrade_profiles_get.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/auto_upgrade_profiles_get.py deleted file mode 100644 index 4bfbd1fc75597..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/auto_upgrade_profiles_get.py +++ /dev/null @@ -1,43 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.containerservicefleet import ContainerServiceFleetMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-containerservicefleet -# USAGE - python auto_upgrade_profiles_get.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ContainerServiceFleetMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", - ) - - response = client.auto_upgrade_profiles.get( - resource_group_name="rg1", - fleet_name="fleet1", - auto_upgrade_profile_name="autoupgradeprofile1", - ) - print(response) - - -# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2024-05-02-preview/examples/AutoUpgradeProfiles_Get.json -if __name__ == "__main__": - main() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/auto_upgrade_profiles_list_by_fleet.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/auto_upgrade_profiles_list_by_fleet.py deleted file mode 100644 index 727545be84e15..0000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/auto_upgrade_profiles_list_by_fleet.py +++ /dev/null @@ -1,43 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Copyright (c) Microsoft Corporation. All rights reserved. -# Licensed under the MIT License. See License.txt in the project root for license information. -# Code generated by Microsoft (R) AutoRest Code Generator. -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -from azure.identity import DefaultAzureCredential - -from azure.mgmt.containerservicefleet import ContainerServiceFleetMgmtClient - -""" -# PREREQUISITES - pip install azure-identity - pip install azure-mgmt-containerservicefleet -# USAGE - python auto_upgrade_profiles_list_by_fleet.py - - Before run the sample, please set the values of the client ID, tenant ID and client secret - of the AAD application as environment variables: AZURE_CLIENT_ID, AZURE_TENANT_ID, - AZURE_CLIENT_SECRET. For more info about how to get the value, please see: - https://docs.microsoft.com/azure/active-directory/develop/howto-create-service-principal-portal -""" - - -def main(): - client = ContainerServiceFleetMgmtClient( - credential=DefaultAzureCredential(), - subscription_id="00000000-0000-0000-0000-000000000000", - ) - - response = client.auto_upgrade_profiles.list_by_fleet( - resource_group_name="rg1", - fleet_name="fleet1", - ) - for item in response: - print(item) - - -# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2024-05-02-preview/examples/AutoUpgradeProfiles_ListByFleet.json -if __name__ == "__main__": - main() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleet_members_create.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleet_members_create.py index be5ef18358f1d..e01ff0a80028b 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleet_members_create.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleet_members_create.py @@ -43,6 +43,6 @@ def main(): print(response) -# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2024-05-02-preview/examples/FleetMembers_Create.json +# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2024-04-01/examples/FleetMembers_Create.json if __name__ == "__main__": main() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleet_members_delete.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleet_members_delete.py index d7a7717a4f59c..ff5d5d29be544 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleet_members_delete.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleet_members_delete.py @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2024-05-02-preview/examples/FleetMembers_Delete.json +# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2024-04-01/examples/FleetMembers_Delete.json if __name__ == "__main__": main() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleet_members_get.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleet_members_get.py index ec620fac260b0..a974016a6345f 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleet_members_get.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleet_members_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2024-05-02-preview/examples/FleetMembers_Get.json +# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2024-04-01/examples/FleetMembers_Get.json if __name__ == "__main__": main() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleet_members_list_by_fleet.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleet_members_list_by_fleet.py index 97151960bee9e..8d99393c49301 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleet_members_list_by_fleet.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleet_members_list_by_fleet.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2024-05-02-preview/examples/FleetMembers_ListByFleet.json +# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2024-04-01/examples/FleetMembers_ListByFleet.json if __name__ == "__main__": main() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleet_members_update.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleet_members_update.py index 278b590e10c10..ac69493d8fb49 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleet_members_update.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleet_members_update.py @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2024-05-02-preview/examples/FleetMembers_Update.json +# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2024-04-01/examples/FleetMembers_Update.json if __name__ == "__main__": main() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleets_create_or_update.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleets_create_or_update.py index 9872133384584..71ad37cb56fcd 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleets_create_or_update.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleets_create_or_update.py @@ -42,6 +42,6 @@ def main(): print(response) -# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2024-05-02-preview/examples/Fleets_CreateOrUpdate.json +# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2024-04-01/examples/Fleets_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleets_delete.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleets_delete.py index 2e9130fca0834..ca250fff5a972 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleets_delete.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleets_delete.py @@ -36,6 +36,6 @@ def main(): ).result() -# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2024-05-02-preview/examples/Fleets_Delete.json +# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2024-04-01/examples/Fleets_Delete.json if __name__ == "__main__": main() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleets_get.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleets_get.py index 2acba2ec3eb5e..ce49d372dd15b 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleets_get.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleets_get.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2024-05-02-preview/examples/Fleets_Get.json +# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2024-04-01/examples/Fleets_Get.json if __name__ == "__main__": main() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleets_list_by_resource_group.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleets_list_by_resource_group.py index 3192494ac8a27..28d1514bd9379 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleets_list_by_resource_group.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleets_list_by_resource_group.py @@ -37,6 +37,6 @@ def main(): print(item) -# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2024-05-02-preview/examples/Fleets_ListByResourceGroup.json +# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2024-04-01/examples/Fleets_ListByResourceGroup.json if __name__ == "__main__": main() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleets_list_by_sub.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleets_list_by_sub.py index 4e7073f41c9b3..c0237622f1acb 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleets_list_by_sub.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleets_list_by_sub.py @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2024-05-02-preview/examples/Fleets_ListBySub.json +# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2024-04-01/examples/Fleets_ListBySub.json if __name__ == "__main__": main() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleets_list_credentials_result.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleets_list_credentials_result.py index a9296cdc7415f..a38208ef550fc 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleets_list_credentials_result.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleets_list_credentials_result.py @@ -37,6 +37,6 @@ def main(): print(response) -# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2024-05-02-preview/examples/Fleets_ListCredentialsResult.json +# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2024-04-01/examples/Fleets_ListCredentialsResult.json if __name__ == "__main__": main() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleets_patch_tags.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleets_patch_tags.py index a287db0fa82f1..4735736dfffda 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleets_patch_tags.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/fleets_patch_tags.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2024-05-02-preview/examples/Fleets_PatchTags.json +# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2024-04-01/examples/Fleets_PatchTags.json if __name__ == "__main__": main() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/operations_list.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/operations_list.py index 0528dc8c6040d..39ab937385037 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/operations_list.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/operations_list.py @@ -35,6 +35,6 @@ def main(): print(item) -# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2024-05-02-preview/examples/Operations_List.json +# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2024-04-01/examples/Operations_List.json if __name__ == "__main__": main() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/update_runs_create_or_update.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/update_runs_create_or_update.py index 244b231a1b434..f5b8c6e99a20b 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/update_runs_create_or_update.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/update_runs_create_or_update.py @@ -50,6 +50,6 @@ def main(): print(response) -# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2024-05-02-preview/examples/UpdateRuns_CreateOrUpdate.json +# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2024-04-01/examples/UpdateRuns_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/update_runs_delete.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/update_runs_delete.py index 939d8cf5d934e..9bad600ea0d6e 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/update_runs_delete.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/update_runs_delete.py @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2024-05-02-preview/examples/UpdateRuns_Delete.json +# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2024-04-01/examples/UpdateRuns_Delete.json if __name__ == "__main__": main() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/update_runs_get.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/update_runs_get.py index 6233ad89f9734..ceb1cb0a3406b 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/update_runs_get.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/update_runs_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2024-05-02-preview/examples/UpdateRuns_Get.json +# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2024-04-01/examples/UpdateRuns_Get.json if __name__ == "__main__": main() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/update_runs_list_by_fleet.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/update_runs_list_by_fleet.py index 9a22088239ed2..7b6b48ddb874d 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/update_runs_list_by_fleet.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/update_runs_list_by_fleet.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2024-05-02-preview/examples/UpdateRuns_ListByFleet.json +# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2024-04-01/examples/UpdateRuns_ListByFleet.json if __name__ == "__main__": main() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/update_runs_skip.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/update_runs_skip.py index 8b5d87a365aec..8d616f44dd871 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/update_runs_skip.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/update_runs_skip.py @@ -39,6 +39,6 @@ def main(): print(response) -# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2024-05-02-preview/examples/UpdateRuns_Skip.json +# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2024-04-01/examples/UpdateRuns_Skip.json if __name__ == "__main__": main() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/update_runs_start.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/update_runs_start.py index 422e2aab22557..488ea88e8c9e4 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/update_runs_start.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/update_runs_start.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2024-05-02-preview/examples/UpdateRuns_Start.json +# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2024-04-01/examples/UpdateRuns_Start.json if __name__ == "__main__": main() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/update_runs_stop.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/update_runs_stop.py index 0b4548930aab4..406608f22b6f5 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/update_runs_stop.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/update_runs_stop.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2024-05-02-preview/examples/UpdateRuns_Stop.json +# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2024-04-01/examples/UpdateRuns_Stop.json if __name__ == "__main__": main() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/update_strategies_create_or_update.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/update_strategies_create_or_update.py index bcfed7900ef11..62f78fefc36e2 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/update_strategies_create_or_update.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/update_strategies_create_or_update.py @@ -45,6 +45,6 @@ def main(): print(response) -# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2024-05-02-preview/examples/UpdateStrategies_CreateOrUpdate.json +# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2024-04-01/examples/UpdateStrategies_CreateOrUpdate.json if __name__ == "__main__": main() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/update_strategies_delete.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/update_strategies_delete.py index 3f37856f9179e..f8e45c552f7c3 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/update_strategies_delete.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/update_strategies_delete.py @@ -37,6 +37,6 @@ def main(): ).result() -# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2024-05-02-preview/examples/UpdateStrategies_Delete.json +# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2024-04-01/examples/UpdateStrategies_Delete.json if __name__ == "__main__": main() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/update_strategies_get.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/update_strategies_get.py index f8f27a93531cd..ca1eb995a791a 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/update_strategies_get.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/update_strategies_get.py @@ -38,6 +38,6 @@ def main(): print(response) -# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2024-05-02-preview/examples/UpdateStrategies_Get.json +# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2024-04-01/examples/UpdateStrategies_Get.json if __name__ == "__main__": main() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/update_strategies_list_by_fleet.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/update_strategies_list_by_fleet.py index 313fcb272b6a2..a1fdcf48fa458 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/update_strategies_list_by_fleet.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_samples/update_strategies_list_by_fleet.py @@ -38,6 +38,6 @@ def main(): print(item) -# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/preview/2024-05-02-preview/examples/UpdateStrategies_ListByFleet.json +# x-ms-original-file: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2024-04-01/examples/UpdateStrategies_ListByFleet.json if __name__ == "__main__": main() diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_tests/test_container_service_fleet_mgmt_fleet_members_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_tests/test_container_service_fleet_mgmt_fleet_members_operations.py index c2738290b5eba..269317f431feb 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_tests/test_container_service_fleet_mgmt_fleet_members_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_tests/test_container_service_fleet_mgmt_fleet_members_operations.py @@ -24,7 +24,7 @@ def test_list_by_fleet(self, resource_group): response = self.client.fleet_members.list_by_fleet( resource_group_name=resource_group.name, fleet_name="str", - api_version="2024-05-02-preview", + api_version="2024-04-01", ) result = [r for r in response] # please add some check logic here by yourself @@ -37,7 +37,7 @@ def test_get(self, resource_group): resource_group_name=resource_group.name, fleet_name="str", fleet_member_name="str", - api_version="2024-05-02-preview", + api_version="2024-04-01", ) # please add some check logic here by yourself @@ -67,7 +67,7 @@ def test_begin_create(self, resource_group): }, "type": "str", }, - api_version="2024-05-02-preview", + api_version="2024-04-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -81,7 +81,7 @@ def test_begin_update(self, resource_group): fleet_name="str", fleet_member_name="str", properties={"group": "str"}, - api_version="2024-05-02-preview", + api_version="2024-04-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -94,7 +94,7 @@ def test_begin_delete(self, resource_group): resource_group_name=resource_group.name, fleet_name="str", fleet_member_name="str", - api_version="2024-05-02-preview", + api_version="2024-04-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_tests/test_container_service_fleet_mgmt_fleet_members_operations_async.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_tests/test_container_service_fleet_mgmt_fleet_members_operations_async.py index bf2bbc16e37ad..2b47776dac94b 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_tests/test_container_service_fleet_mgmt_fleet_members_operations_async.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_tests/test_container_service_fleet_mgmt_fleet_members_operations_async.py @@ -25,7 +25,7 @@ async def test_list_by_fleet(self, resource_group): response = self.client.fleet_members.list_by_fleet( resource_group_name=resource_group.name, fleet_name="str", - api_version="2024-05-02-preview", + api_version="2024-04-01", ) result = [r async for r in response] # please add some check logic here by yourself @@ -38,7 +38,7 @@ async def test_get(self, resource_group): resource_group_name=resource_group.name, fleet_name="str", fleet_member_name="str", - api_version="2024-05-02-preview", + api_version="2024-04-01", ) # please add some check logic here by yourself @@ -69,7 +69,7 @@ async def test_begin_create(self, resource_group): }, "type": "str", }, - api_version="2024-05-02-preview", + api_version="2024-04-01", ) ).result() # call '.result()' to poll until service return final result @@ -85,7 +85,7 @@ async def test_begin_update(self, resource_group): fleet_name="str", fleet_member_name="str", properties={"group": "str"}, - api_version="2024-05-02-preview", + api_version="2024-04-01", ) ).result() # call '.result()' to poll until service return final result @@ -100,7 +100,7 @@ async def test_begin_delete(self, resource_group): resource_group_name=resource_group.name, fleet_name="str", fleet_member_name="str", - api_version="2024-05-02-preview", + api_version="2024-04-01", ) ).result() # call '.result()' to poll until service return final result diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_tests/test_container_service_fleet_mgmt_fleet_update_strategies_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_tests/test_container_service_fleet_mgmt_fleet_update_strategies_operations.py index 24882dd305e25..f5589366e0d91 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_tests/test_container_service_fleet_mgmt_fleet_update_strategies_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_tests/test_container_service_fleet_mgmt_fleet_update_strategies_operations.py @@ -24,7 +24,7 @@ def test_list_by_fleet(self, resource_group): response = self.client.fleet_update_strategies.list_by_fleet( resource_group_name=resource_group.name, fleet_name="str", - api_version="2024-05-02-preview", + api_version="2024-04-01", ) result = [r for r in response] # please add some check logic here by yourself @@ -37,7 +37,7 @@ def test_get(self, resource_group): resource_group_name=resource_group.name, fleet_name="str", update_strategy_name="str", - api_version="2024-05-02-preview", + api_version="2024-04-01", ) # please add some check logic here by yourself @@ -66,7 +66,7 @@ def test_begin_create_or_update(self, resource_group): }, "type": "str", }, - api_version="2024-05-02-preview", + api_version="2024-04-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -79,7 +79,7 @@ def test_begin_delete(self, resource_group): resource_group_name=resource_group.name, fleet_name="str", update_strategy_name="str", - api_version="2024-05-02-preview", + api_version="2024-04-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_tests/test_container_service_fleet_mgmt_fleet_update_strategies_operations_async.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_tests/test_container_service_fleet_mgmt_fleet_update_strategies_operations_async.py index acea7af401897..ce0e92b44bbd2 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_tests/test_container_service_fleet_mgmt_fleet_update_strategies_operations_async.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_tests/test_container_service_fleet_mgmt_fleet_update_strategies_operations_async.py @@ -25,7 +25,7 @@ async def test_list_by_fleet(self, resource_group): response = self.client.fleet_update_strategies.list_by_fleet( resource_group_name=resource_group.name, fleet_name="str", - api_version="2024-05-02-preview", + api_version="2024-04-01", ) result = [r async for r in response] # please add some check logic here by yourself @@ -38,7 +38,7 @@ async def test_get(self, resource_group): resource_group_name=resource_group.name, fleet_name="str", update_strategy_name="str", - api_version="2024-05-02-preview", + api_version="2024-04-01", ) # please add some check logic here by yourself @@ -70,7 +70,7 @@ async def test_begin_create_or_update(self, resource_group): }, "type": "str", }, - api_version="2024-05-02-preview", + api_version="2024-04-01", ) ).result() # call '.result()' to poll until service return final result @@ -85,7 +85,7 @@ async def test_begin_delete(self, resource_group): resource_group_name=resource_group.name, fleet_name="str", update_strategy_name="str", - api_version="2024-05-02-preview", + api_version="2024-04-01", ) ).result() # call '.result()' to poll until service return final result diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_tests/test_container_service_fleet_mgmt_fleets_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_tests/test_container_service_fleet_mgmt_fleets_operations.py index c0494cf43d0ee..c81a2a5eb90c3 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_tests/test_container_service_fleet_mgmt_fleets_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_tests/test_container_service_fleet_mgmt_fleets_operations.py @@ -22,7 +22,7 @@ def setup_method(self, method): @recorded_by_proxy def test_list_by_subscription(self, resource_group): response = self.client.fleets.list_by_subscription( - api_version="2024-05-02-preview", + api_version="2024-04-01", ) result = [r for r in response] # please add some check logic here by yourself @@ -33,7 +33,7 @@ def test_list_by_subscription(self, resource_group): def test_list_by_resource_group(self, resource_group): response = self.client.fleets.list_by_resource_group( resource_group_name=resource_group.name, - api_version="2024-05-02-preview", + api_version="2024-04-01", ) result = [r for r in response] # please add some check logic here by yourself @@ -45,7 +45,7 @@ def test_get(self, resource_group): response = self.client.fleets.get( resource_group_name=resource_group.name, fleet_name="str", - api_version="2024-05-02-preview", + api_version="2024-04-01", ) # please add some check logic here by yourself @@ -62,11 +62,7 @@ def test_begin_create_or_update(self, resource_group): "eTag": "str", "hubProfile": { "agentProfile": {"subnetId": "str", "vmSize": "str"}, - "apiServerAccessProfile": { - "enablePrivateCluster": bool, - "enableVnetIntegration": bool, - "subnetId": "str", - }, + "apiServerAccessProfile": {"enablePrivateCluster": bool}, "dnsPrefix": "str", "fqdn": "str", "kubernetesVersion": "str", @@ -92,7 +88,7 @@ def test_begin_create_or_update(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2024-05-02-preview", + api_version="2024-04-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -113,7 +109,7 @@ def test_begin_update(self, resource_group): }, "tags": {"str": "str"}, }, - api_version="2024-05-02-preview", + api_version="2024-04-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -125,7 +121,7 @@ def test_begin_delete(self, resource_group): response = self.client.fleets.begin_delete( resource_group_name=resource_group.name, fleet_name="str", - api_version="2024-05-02-preview", + api_version="2024-04-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -137,7 +133,7 @@ def test_list_credentials(self, resource_group): response = self.client.fleets.list_credentials( resource_group_name=resource_group.name, fleet_name="str", - api_version="2024-05-02-preview", + api_version="2024-04-01", ) # please add some check logic here by yourself diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_tests/test_container_service_fleet_mgmt_fleets_operations_async.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_tests/test_container_service_fleet_mgmt_fleets_operations_async.py index aeeffd7c6feda..59d88781040c9 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_tests/test_container_service_fleet_mgmt_fleets_operations_async.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_tests/test_container_service_fleet_mgmt_fleets_operations_async.py @@ -23,7 +23,7 @@ def setup_method(self, method): @recorded_by_proxy_async async def test_list_by_subscription(self, resource_group): response = self.client.fleets.list_by_subscription( - api_version="2024-05-02-preview", + api_version="2024-04-01", ) result = [r async for r in response] # please add some check logic here by yourself @@ -34,7 +34,7 @@ async def test_list_by_subscription(self, resource_group): async def test_list_by_resource_group(self, resource_group): response = self.client.fleets.list_by_resource_group( resource_group_name=resource_group.name, - api_version="2024-05-02-preview", + api_version="2024-04-01", ) result = [r async for r in response] # please add some check logic here by yourself @@ -46,7 +46,7 @@ async def test_get(self, resource_group): response = await self.client.fleets.get( resource_group_name=resource_group.name, fleet_name="str", - api_version="2024-05-02-preview", + api_version="2024-04-01", ) # please add some check logic here by yourself @@ -64,11 +64,7 @@ async def test_begin_create_or_update(self, resource_group): "eTag": "str", "hubProfile": { "agentProfile": {"subnetId": "str", "vmSize": "str"}, - "apiServerAccessProfile": { - "enablePrivateCluster": bool, - "enableVnetIntegration": bool, - "subnetId": "str", - }, + "apiServerAccessProfile": {"enablePrivateCluster": bool}, "dnsPrefix": "str", "fqdn": "str", "kubernetesVersion": "str", @@ -94,7 +90,7 @@ async def test_begin_create_or_update(self, resource_group): "tags": {"str": "str"}, "type": "str", }, - api_version="2024-05-02-preview", + api_version="2024-04-01", ) ).result() # call '.result()' to poll until service return final result @@ -117,7 +113,7 @@ async def test_begin_update(self, resource_group): }, "tags": {"str": "str"}, }, - api_version="2024-05-02-preview", + api_version="2024-04-01", ) ).result() # call '.result()' to poll until service return final result @@ -131,7 +127,7 @@ async def test_begin_delete(self, resource_group): await self.client.fleets.begin_delete( resource_group_name=resource_group.name, fleet_name="str", - api_version="2024-05-02-preview", + api_version="2024-04-01", ) ).result() # call '.result()' to poll until service return final result @@ -144,7 +140,7 @@ async def test_list_credentials(self, resource_group): response = await self.client.fleets.list_credentials( resource_group_name=resource_group.name, fleet_name="str", - api_version="2024-05-02-preview", + api_version="2024-04-01", ) # please add some check logic here by yourself diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_tests/test_container_service_fleet_mgmt_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_tests/test_container_service_fleet_mgmt_operations.py index a763ccd0c8ec2..bcbb878f7e2e5 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_tests/test_container_service_fleet_mgmt_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_tests/test_container_service_fleet_mgmt_operations.py @@ -22,7 +22,7 @@ def setup_method(self, method): @recorded_by_proxy def test_list(self, resource_group): response = self.client.operations.list( - api_version="2024-05-02-preview", + api_version="2024-04-01", ) result = [r for r in response] # please add some check logic here by yourself diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_tests/test_container_service_fleet_mgmt_operations_async.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_tests/test_container_service_fleet_mgmt_operations_async.py index ab6a10357e659..f302bd933121b 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_tests/test_container_service_fleet_mgmt_operations_async.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_tests/test_container_service_fleet_mgmt_operations_async.py @@ -23,7 +23,7 @@ def setup_method(self, method): @recorded_by_proxy_async async def test_list(self, resource_group): response = self.client.operations.list( - api_version="2024-05-02-preview", + api_version="2024-04-01", ) result = [r async for r in response] # please add some check logic here by yourself diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_tests/test_container_service_fleet_mgmt_update_runs_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_tests/test_container_service_fleet_mgmt_update_runs_operations.py index 0215fa743c6c3..27ad083b970f7 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_tests/test_container_service_fleet_mgmt_update_runs_operations.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_tests/test_container_service_fleet_mgmt_update_runs_operations.py @@ -24,7 +24,7 @@ def test_list_by_fleet(self, resource_group): response = self.client.update_runs.list_by_fleet( resource_group_name=resource_group.name, fleet_name="str", - api_version="2024-05-02-preview", + api_version="2024-04-01", ) result = [r for r in response] # please add some check logic here by yourself @@ -37,7 +37,7 @@ def test_get(self, resource_group): resource_group_name=resource_group.name, fleet_name="str", update_run_name="str", - api_version="2024-05-02-preview", + api_version="2024-04-01", ) # please add some check logic here by yourself @@ -55,7 +55,7 @@ def test_begin_create_or_update(self, resource_group): "id": "str", "managedClusterUpdate": { "upgrade": {"type": "str", "kubernetesVersion": "str"}, - "nodeImageSelection": {"type": "str", "customNodeImageVersions": [{"version": "str"}]}, + "nodeImageSelection": {"type": "str"}, }, "name": "str", "provisioningState": "str", @@ -155,7 +155,7 @@ def test_begin_create_or_update(self, resource_group): "type": "str", "updateStrategyId": "str", }, - api_version="2024-05-02-preview", + api_version="2024-04-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -168,7 +168,7 @@ def test_begin_delete(self, resource_group): resource_group_name=resource_group.name, fleet_name="str", update_run_name="str", - api_version="2024-05-02-preview", + api_version="2024-04-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -182,7 +182,7 @@ def test_begin_skip(self, resource_group): fleet_name="str", update_run_name="str", body={"targets": [{"name": "str", "type": "str"}]}, - api_version="2024-05-02-preview", + api_version="2024-04-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -195,7 +195,7 @@ def test_begin_start(self, resource_group): resource_group_name=resource_group.name, fleet_name="str", update_run_name="str", - api_version="2024-05-02-preview", + api_version="2024-04-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself @@ -208,7 +208,7 @@ def test_begin_stop(self, resource_group): resource_group_name=resource_group.name, fleet_name="str", update_run_name="str", - api_version="2024-05-02-preview", + api_version="2024-04-01", ).result() # call '.result()' to poll until service return final result # please add some check logic here by yourself diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_tests/test_container_service_fleet_mgmt_update_runs_operations_async.py b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_tests/test_container_service_fleet_mgmt_update_runs_operations_async.py index f3a4134d3773b..6967ea1a2dcff 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/generated_tests/test_container_service_fleet_mgmt_update_runs_operations_async.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/generated_tests/test_container_service_fleet_mgmt_update_runs_operations_async.py @@ -25,7 +25,7 @@ async def test_list_by_fleet(self, resource_group): response = self.client.update_runs.list_by_fleet( resource_group_name=resource_group.name, fleet_name="str", - api_version="2024-05-02-preview", + api_version="2024-04-01", ) result = [r async for r in response] # please add some check logic here by yourself @@ -38,7 +38,7 @@ async def test_get(self, resource_group): resource_group_name=resource_group.name, fleet_name="str", update_run_name="str", - api_version="2024-05-02-preview", + api_version="2024-04-01", ) # please add some check logic here by yourself @@ -57,7 +57,7 @@ async def test_begin_create_or_update(self, resource_group): "id": "str", "managedClusterUpdate": { "upgrade": {"type": "str", "kubernetesVersion": "str"}, - "nodeImageSelection": {"type": "str", "customNodeImageVersions": [{"version": "str"}]}, + "nodeImageSelection": {"type": "str"}, }, "name": "str", "provisioningState": "str", @@ -159,7 +159,7 @@ async def test_begin_create_or_update(self, resource_group): "type": "str", "updateStrategyId": "str", }, - api_version="2024-05-02-preview", + api_version="2024-04-01", ) ).result() # call '.result()' to poll until service return final result @@ -174,7 +174,7 @@ async def test_begin_delete(self, resource_group): resource_group_name=resource_group.name, fleet_name="str", update_run_name="str", - api_version="2024-05-02-preview", + api_version="2024-04-01", ) ).result() # call '.result()' to poll until service return final result @@ -190,7 +190,7 @@ async def test_begin_skip(self, resource_group): fleet_name="str", update_run_name="str", body={"targets": [{"name": "str", "type": "str"}]}, - api_version="2024-05-02-preview", + api_version="2024-04-01", ) ).result() # call '.result()' to poll until service return final result @@ -205,7 +205,7 @@ async def test_begin_start(self, resource_group): resource_group_name=resource_group.name, fleet_name="str", update_run_name="str", - api_version="2024-05-02-preview", + api_version="2024-04-01", ) ).result() # call '.result()' to poll until service return final result @@ -220,7 +220,7 @@ async def test_begin_stop(self, resource_group): resource_group_name=resource_group.name, fleet_name="str", update_run_name="str", - api_version="2024-05-02-preview", + api_version="2024-04-01", ) ).result() # call '.result()' to poll until service return final result diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/setup.py b/sdk/containerservice/azure-mgmt-containerservicefleet/setup.py index 0d81be0b86c13..d354cdd338960 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/setup.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/setup.py @@ -22,9 +22,11 @@ # 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"), + ( + 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) diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/tests/test_container_service_fleet_mgmt_fleets_operations_async_test.py b/sdk/containerservice/azure-mgmt-containerservicefleet/tests/test_container_service_fleet_mgmt_fleets_operations_async_test.py index 0ee58af98b5f0..c6b99afba586e 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/tests/test_container_service_fleet_mgmt_fleets_operations_async_test.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/tests/test_container_service_fleet_mgmt_fleets_operations_async_test.py @@ -25,7 +25,6 @@ async def test_list_by_subscription(self, resource_group): response = self.client.fleets.list_by_subscription() result = [r async for r in response] assert response - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy_async @@ -35,4 +34,3 @@ async def test_list_by_resource_group(self, resource_group): ) result = [r async for r in response] assert result == [] - \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/tests/test_container_service_fleet_mgmt_fleets_operations_test.py b/sdk/containerservice/azure-mgmt-containerservicefleet/tests/test_container_service_fleet_mgmt_fleets_operations_test.py index df1f4dd1ea29a..df40b2353f6b9 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/tests/test_container_service_fleet_mgmt_fleets_operations_test.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/tests/test_container_service_fleet_mgmt_fleets_operations_test.py @@ -24,7 +24,6 @@ def test_list_by_subscription(self, resource_group): response = self.client.fleets.list_by_subscription() result = [r for r in response] assert response - @RandomNameResourceGroupPreparer(location=AZURE_LOCATION) @recorded_by_proxy @@ -34,4 +33,3 @@ def test_list_by_resource_group(self, resource_group): ) result = [r for r in response] assert result == [] - \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/tests/test_container_service_fleet_mgmt_operations_async_test.py b/sdk/containerservice/azure-mgmt-containerservicefleet/tests/test_container_service_fleet_mgmt_operations_async_test.py index 825785f6f82f7..82b1819e838fa 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/tests/test_container_service_fleet_mgmt_operations_async_test.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/tests/test_container_service_fleet_mgmt_operations_async_test.py @@ -25,4 +25,3 @@ async def test_list(self, resource_group): response = self.client.operations.list() result = [r async for r in response] assert result - \ No newline at end of file diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/tests/test_container_service_fleet_mgmt_operations_test.py b/sdk/containerservice/azure-mgmt-containerservicefleet/tests/test_container_service_fleet_mgmt_operations_test.py index 3114ee8e01e95..c3400b397fb18 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/tests/test_container_service_fleet_mgmt_operations_test.py +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/tests/test_container_service_fleet_mgmt_operations_test.py @@ -24,4 +24,3 @@ def test_list(self, resource_group): response = self.client.operations.list() result = [r for r in response] assert result - \ No newline at end of file