diff --git a/sdk/containerservice/azure-mgmt-containerservicefleet/_meta.json b/sdk/containerservice/azure-mgmt-containerservicefleet/_meta.json index b732e480fb67..5cf28bce5eac 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/_meta.json +++ b/sdk/containerservice/azure-mgmt-containerservicefleet/_meta.json @@ -1,12 +1,12 @@ { - "commit": "399cbac2de1bc0acbed4c9a0a864a9c84da3692e", + "commit": "a089ed440c01fecc22a83624a0d07f366fdf2b1f", "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/s/azure-sdk-for-python/sdk --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", 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 b7d7040aff55..78b8b4b91a49 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 047c5f78b204..6c1928ca1180 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-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 - ): + 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: @@ -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 5c33a960eac5..7d9e82528ec4 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,77 @@ # coding=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 ( + AutoUpgradeProfilesOperations, + 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 auto_upgrade_profiles: AutoUpgradeProfilesOperations operations + :vartype auto_upgrade_profiles: + azure.mgmt.containerservicefleet.operations.AutoUpgradeProfilesOperations + :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-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. """ - 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 +90,51 @@ 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.auto_upgrade_profiles = AutoUpgradeProfilesOperations( + 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: - - * 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: + def _send_request(self, request: HttpRequest, *, stream: bool = False, **kwargs: Any) -> HttpResponse: + """Runs the network request through the client's chained policies. - * 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 59f1fcf71bc9..8139854b97bb 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 46c39ed64eb9..cac9f5d10f8b 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 4a067dd28d88..af1d7b0b47fe 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 aa02d819c705..4179e4fdac5a 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-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: + 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: @@ -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 0fd6f449cd04..22598da71f2a 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,77 @@ # coding=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 ( + AutoUpgradeProfilesOperations, + 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 auto_upgrade_profiles: AutoUpgradeProfilesOperations operations + :vartype auto_upgrade_profiles: + azure.mgmt.containerservicefleet.aio.operations.AutoUpgradeProfilesOperations + :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-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. """ - 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 +90,53 @@ 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.auto_upgrade_profiles = AutoUpgradeProfilesOperations( + 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: - - * 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: + def _send_request( + self, request: HttpRequest, *, stream: bool = False, **kwargs: Any + ) -> Awaitable[AsyncHttpResponse]: + """Runs the network request through the client's chained policies. - * 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/v2024_05_02_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/v2024_05_02_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_05_02_preview/aio/operations/_auto_upgrade_profiles_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/aio/operations/_auto_upgrade_profiles_operations.py similarity index 93% rename from sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_05_02_preview/aio/operations/_auto_upgrade_profiles_operations.py rename to sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/aio/operations/_auto_upgrade_profiles_operations.py index f81e133170a2..604c53c74eff 100644 --- 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/aio/operations/_auto_upgrade_profiles_operations.py @@ -53,7 +53,7 @@ class AutoUpgradeProfilesOperations: **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 + :class:`~azure.mgmt.containerservicefleet.aio.ContainerServiceFleetMgmtClient`'s :attr:`auto_upgrade_profiles` 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,15 +79,13 @@ def list_by_fleet( :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] + ~azure.core.async_paging.AsyncItemPaged[~azure.mgmt.containerservicefleet.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") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AutoUpgradeProfileListResult] = kwargs.pop("cls", None) error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -121,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 ) @@ -168,7 +165,7 @@ async def get( :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 + :rtype: ~azure.mgmt.containerservicefleet.models.AutoUpgradeProfile :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -182,9 +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-05-02-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AutoUpgradeProfile] = kwargs.pop("cls", None) _request = build_get_request( @@ -238,9 +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-05-02-preview") - ) + 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) @@ -322,7 +315,7 @@ async def begin_create_or_update( :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 + :type resource: ~azure.mgmt.containerservicefleet.models.AutoUpgradeProfile :param if_match: The request should only proceed if an entity matches this string. Default value is None. :type if_match: str @@ -335,7 +328,7 @@ async def begin_create_or_update( :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] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.models.AutoUpgradeProfile] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -375,7 +368,7 @@ async def begin_create_or_update( :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] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.models.AutoUpgradeProfile] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -401,8 +394,7 @@ async def begin_create_or_update( :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] + :type resource: ~azure.mgmt.containerservicefleet.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 @@ -412,15 +404,13 @@ async def begin_create_or_update( :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] + ~azure.core.polling.AsyncLROPoller[~azure.mgmt.containerservicefleet.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") - ) + 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.AutoUpgradeProfile] = kwargs.pop("cls", None) polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True) @@ -489,9 +479,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-05-02-preview") - ) + 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( @@ -563,9 +551,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-05-02-preview") - ) + 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_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 0d08af0c1467..5d9adc5a9494 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 26bf6bec1d51..3424d6929782 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 290ff0c72294..2e47da8c13da 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 cf43908968f7..8cb105f2dec3 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 cd6c7d858370..c7aa6da1c8ba 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 3e8a887745e1..000000000000 --- 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_05_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_05_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_05_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_05_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_05_02_preview/models/_models_py3.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/models/_models_py3.py similarity index 88% rename from sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_05_02_preview/models/_models_py3.py rename to sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/models/_models_py3.py index 85c85b18275e..ef467ee70732 100644 --- 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/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 @@ -95,7 +95,7 @@ class AutoUpgradeNodeImageSelection(_serialization.Model): :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 + ~azure.mgmt.containerservicefleet.models.AutoUpgradeNodeImageSelectionType """ _validation = { @@ -111,7 +111,7 @@ def __init__(self, *, type: Union[str, "_models.AutoUpgradeNodeImageSelectionTyp :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 + ~azure.mgmt.containerservicefleet.models.AutoUpgradeNodeImageSelectionType """ super().__init__(**kwargs) self.type = type @@ -132,7 +132,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_05_02_preview.models.SystemData + :vartype system_data: ~azure.mgmt.containerservicefleet.models.SystemData """ _validation = { @@ -174,7 +174,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_05_02_preview.models.SystemData + :vartype system_data: ~azure.mgmt.containerservicefleet.models.SystemData """ @@ -193,7 +193,7 @@ class AutoUpgradeProfile(ProxyResource): :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 + :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 @@ -202,18 +202,17 @@ class AutoUpgradeProfile(ProxyResource): :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 + ~azure.mgmt.containerservicefleet.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 + :vartype channel: str or ~azure.mgmt.containerservicefleet.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 + ~azure.mgmt.containerservicefleet.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 @@ -261,12 +260,11 @@ def __init__( :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 + :paramtype channel: str or ~azure.mgmt.containerservicefleet.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 + ~azure.mgmt.containerservicefleet.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 @@ -291,8 +289,7 @@ class AutoUpgradeProfileListResult(_serialization.Model): 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] + :vartype value: list[~azure.mgmt.containerservicefleet.models.AutoUpgradeProfile] :ivar next_link: The link to the next page of items. :vartype next_link: str """ @@ -311,8 +308,7 @@ def __init__( ) -> None: """ :keyword value: The AutoUpgradeProfile items on this page. Required. - :paramtype value: - list[~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.AutoUpgradeProfile] + :paramtype value: list[~azure.mgmt.containerservicefleet.models.AutoUpgradeProfile] :keyword next_link: The link to the next page of items. :paramtype next_link: str """ @@ -361,11 +357,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_05_02_preview.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_05_02_preview.models.ErrorAdditionalInfo] + :vartype additional_info: list[~azure.mgmt.containerservicefleet.models.ErrorAdditionalInfo] """ _validation = { @@ -399,7 +393,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_05_02_preview.models.ErrorDetail + :vartype error: ~azure.mgmt.containerservicefleet.models.ErrorDetail """ _attribute_map = { @@ -409,7 +403,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_05_02_preview.models.ErrorDetail + :paramtype error: ~azure.mgmt.containerservicefleet.models.ErrorDetail """ super().__init__(**kwargs) self.error = error @@ -433,7 +427,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_05_02_preview.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. @@ -486,7 +480,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_05_02_preview.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. @@ -497,15 +491,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_05_02_preview.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_05_02_preview.models.FleetProvisioningState + ~azure.mgmt.containerservicefleet.models.FleetProvisioningState :ivar hub_profile: The FleetHubProfile configures the Fleet's hub. - :vartype hub_profile: - ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.FleetHubProfile + :vartype hub_profile: ~azure.mgmt.containerservicefleet.models.FleetHubProfile """ _validation = { @@ -546,11 +538,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_05_02_preview.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_05_02_preview.models.FleetHubProfile + :paramtype hub_profile: ~azure.mgmt.containerservicefleet.models.FleetHubProfile """ super().__init__(tags=tags, location=location, **kwargs) self.e_tag = None @@ -593,8 +583,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_05_02_preview.models.FleetCredentialResult] + :vartype kubeconfigs: list[~azure.mgmt.containerservicefleet.models.FleetCredentialResult] """ _validation = { @@ -620,10 +609,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_05_02_preview.models.APIServerAccessProfile + ~azure.mgmt.containerservicefleet.models.APIServerAccessProfile :ivar agent_profile: The agent profile for the Fleet hub. - :vartype agent_profile: - ~azure.mgmt.containerservicefleet.v2024_05_02_preview.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. @@ -665,10 +653,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_05_02_preview.models.APIServerAccessProfile + ~azure.mgmt.containerservicefleet.models.APIServerAccessProfile :keyword agent_profile: The agent profile for the Fleet hub. - :paramtype agent_profile: - ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.AgentProfile + :paramtype agent_profile: ~azure.mgmt.containerservicefleet.models.AgentProfile """ super().__init__(**kwargs) self.dns_prefix = dns_prefix @@ -685,7 +672,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_05_02_preview.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 """ @@ -702,7 +689,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_05_02_preview.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 """ @@ -726,7 +713,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_05_02_preview.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 @@ -741,7 +728,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_05_02_preview.models.FleetMemberProvisioningState + ~azure.mgmt.containerservicefleet.models.FleetMemberProvisioningState """ _validation = { @@ -789,7 +776,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_05_02_preview.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 """ @@ -806,8 +793,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_05_02_preview.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 """ @@ -846,8 +832,7 @@ class FleetPatch(_serialization.Model): :ivar tags: Resource tags. :vartype tags: dict[str, str] :ivar identity: Managed identity. - :vartype identity: - ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.ManagedServiceIdentity + :vartype identity: ~azure.mgmt.containerservicefleet.models.ManagedServiceIdentity """ _attribute_map = { @@ -866,8 +851,7 @@ def __init__( :keyword tags: Resource tags. :paramtype tags: dict[str, str] :keyword identity: Managed identity. - :paramtype identity: - ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.ManagedServiceIdentity + :paramtype identity: ~azure.mgmt.containerservicefleet.models.ManagedServiceIdentity """ super().__init__(**kwargs) self.tags = tags @@ -889,7 +873,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_05_02_preview.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 @@ -898,10 +882,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_05_02_preview.models.FleetUpdateStrategyProvisioningState + ~azure.mgmt.containerservicefleet.models.FleetUpdateStrategyProvisioningState :ivar strategy: Defines the update sequence of the clusters. - :vartype strategy: - ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.UpdateRunStrategy + :vartype strategy: ~azure.mgmt.containerservicefleet.models.UpdateRunStrategy """ _validation = { @@ -926,8 +909,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_05_02_preview.models.UpdateRunStrategy + :paramtype strategy: ~azure.mgmt.containerservicefleet.models.UpdateRunStrategy """ super().__init__(**kwargs) self.e_tag = None @@ -941,8 +923,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_05_02_preview.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 """ @@ -961,8 +942,7 @@ def __init__( ) -> None: """ :keyword value: The FleetUpdateStrategy items on this page. Required. - :paramtype value: - list[~azure.mgmt.containerservicefleet.v2024_05_02_preview.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 """ @@ -977,12 +957,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_05_02_preview.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_05_02_preview.models.NodeImageSelection + :vartype node_image_selection: ~azure.mgmt.containerservicefleet.models.NodeImageSelection """ _validation = { @@ -1003,12 +981,10 @@ def __init__( ) -> None: """ :keyword upgrade: The upgrade to apply to the ManagedClusters. Required. - :paramtype upgrade: - ~azure.mgmt.containerservicefleet.v2024_05_02_preview.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_05_02_preview.models.NodeImageSelection + :paramtype node_image_selection: ~azure.mgmt.containerservicefleet.models.NodeImageSelection """ super().__init__(**kwargs) self.upgrade = upgrade @@ -1022,8 +998,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_05_02_preview.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 """ @@ -1047,8 +1022,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_05_02_preview.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 """ @@ -1073,14 +1047,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_05_02_preview.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_05_02_preview.models.UserAssignedIdentity] + ~azure.mgmt.containerservicefleet.models.UserAssignedIdentity] """ _validation = { @@ -1107,14 +1080,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_05_02_preview.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_05_02_preview.models.UserAssignedIdentity] + ~azure.mgmt.containerservicefleet.models.UserAssignedIdentity] """ super().__init__(**kwargs) self.principal_id = None @@ -1129,7 +1101,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_05_02_preview.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. @@ -1173,8 +1145,7 @@ class NodeImageSelection(_serialization.Model): :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 + :vartype type: str or ~azure.mgmt.containerservicefleet.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 @@ -1182,7 +1153,7 @@ class NodeImageSelection(_serialization.Model): '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] + list[~azure.mgmt.containerservicefleet.models.NodeImageVersion] """ _validation = { @@ -1204,8 +1175,7 @@ def __init__( """ :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 + :paramtype type: str or ~azure.mgmt.containerservicefleet.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 @@ -1213,7 +1183,7 @@ def __init__( '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] + list[~azure.mgmt.containerservicefleet.models.NodeImageVersion] """ super().__init__(**kwargs) self.type = type @@ -1227,7 +1197,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_05_02_preview.models.NodeImageVersion] + list[~azure.mgmt.containerservicefleet.models.NodeImageVersion] """ _validation = { @@ -1280,15 +1250,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_05_02_preview.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_05_02_preview.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_05_02_preview.models.ActionType + :vartype action_type: str or ~azure.mgmt.containerservicefleet.models.ActionType """ _validation = { @@ -1309,8 +1278,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_05_02_preview.models.OperationDisplay + :paramtype display: ~azure.mgmt.containerservicefleet.models.OperationDisplay """ super().__init__(**kwargs) self.name = None @@ -1369,7 +1337,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_05_02_preview.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 """ @@ -1397,7 +1365,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_05_02_preview.models.SkipTarget] + :vartype targets: list[~azure.mgmt.containerservicefleet.models.SkipTarget] """ _validation = { @@ -1411,8 +1379,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_05_02_preview.models.SkipTarget] + :paramtype targets: list[~azure.mgmt.containerservicefleet.models.SkipTarget] """ super().__init__(**kwargs) self.targets = targets @@ -1425,7 +1392,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_05_02_preview.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. @@ -1446,7 +1413,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_05_02_preview.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. @@ -1464,16 +1431,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_05_02_preview.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_05_02_preview.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 """ @@ -1503,16 +1468,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_05_02_preview.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_05_02_preview.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 """ @@ -1559,12 +1522,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_05_02_preview.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_05_02_preview.models.MemberUpdateStatus] + :vartype members: list[~azure.mgmt.containerservicefleet.models.MemberUpdateStatus] """ _validation = { @@ -1602,7 +1564,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_05_02_preview.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 @@ -1611,7 +1573,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_05_02_preview.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: @@ -1634,14 +1596,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_05_02_preview.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_05_02_preview.models.ManagedClusterUpdate + :vartype managed_cluster_update: ~azure.mgmt.containerservicefleet.models.ManagedClusterUpdate :ivar status: The status of the UpdateRun. - :vartype status: ~azure.mgmt.containerservicefleet.v2024_05_02_preview.models.UpdateRunStatus + :vartype status: ~azure.mgmt.containerservicefleet.models.UpdateRunStatus """ _validation = { @@ -1698,12 +1658,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_05_02_preview.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_05_02_preview.models.ManagedClusterUpdate + ~azure.mgmt.containerservicefleet.models.ManagedClusterUpdate """ super().__init__(**kwargs) self.e_tag = None @@ -1720,7 +1679,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_05_02_preview.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 """ @@ -1737,7 +1696,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_05_02_preview.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 """ @@ -1752,15 +1711,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_05_02_preview.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_05_02_preview.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_05_02_preview.models.NodeImageSelectionStatus + ~azure.mgmt.containerservicefleet.models.NodeImageSelectionStatus """ _validation = { @@ -1795,7 +1753,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_05_02_preview.models.UpdateStage] + :vartype stages: list[~azure.mgmt.containerservicefleet.models.UpdateStage] """ _validation = { @@ -1809,8 +1767,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_05_02_preview.models.UpdateStage] + :paramtype stages: list[~azure.mgmt.containerservicefleet.models.UpdateStage] """ super().__init__(**kwargs) self.stages = stages @@ -1826,7 +1783,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_05_02_preview.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 @@ -1855,8 +1812,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_05_02_preview.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 @@ -1873,15 +1829,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_05_02_preview.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_05_02_preview.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_05_02_preview.models.WaitStatus + :vartype after_stage_wait_status: ~azure.mgmt.containerservicefleet.models.WaitStatus """ _validation = { @@ -1918,9 +1872,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_05_02_preview.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_05_02_preview.models.ErrorDetail + :vartype error: ~azure.mgmt.containerservicefleet.models.ErrorDetail """ _validation = { @@ -1980,7 +1934,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_05_02_preview.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/v2024_05_02_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/v2024_05_02_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_05_02_preview/operations/_auto_upgrade_profiles_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/operations/_auto_upgrade_profiles_operations.py similarity index 94% rename from sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_05_02_preview/operations/_auto_upgrade_profiles_operations.py rename to sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/operations/_auto_upgrade_profiles_operations.py index 5fbaf7d9d560..6a9997f0a9bc 100644 --- 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/operations/_auto_upgrade_profiles_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 AutoUpgradeProfilesOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.containerservicefleet.v2024_05_02_preview.ContainerServiceFleetMgmtClient`'s + :class:`~azure.mgmt.containerservicefleet.ContainerServiceFleetMgmtClient`'s :attr:`auto_upgrade_profiles` 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,15 +262,13 @@ def list_by_fleet( :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] + ~azure.core.paging.ItemPaged[~azure.mgmt.containerservicefleet.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") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AutoUpgradeProfileListResult] = kwargs.pop("cls", None) error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -304,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 ) @@ -351,7 +348,7 @@ def get( :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 + :rtype: ~azure.mgmt.containerservicefleet.models.AutoUpgradeProfile :raises ~azure.core.exceptions.HttpResponseError: """ error_map: MutableMapping[int, Type[HttpResponseError]] = { @@ -365,9 +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-05-02-preview") - ) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", self._config.api_version)) cls: ClsType[_models.AutoUpgradeProfile] = kwargs.pop("cls", None) _request = build_get_request( @@ -421,9 +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-05-02-preview") - ) + 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) @@ -505,7 +498,7 @@ def begin_create_or_update( :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 + :type resource: ~azure.mgmt.containerservicefleet.models.AutoUpgradeProfile :param if_match: The request should only proceed if an entity matches this string. Default value is None. :type if_match: str @@ -518,7 +511,7 @@ def begin_create_or_update( :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] + ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.models.AutoUpgradeProfile] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -558,7 +551,7 @@ def begin_create_or_update( :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] + ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.models.AutoUpgradeProfile] :raises ~azure.core.exceptions.HttpResponseError: """ @@ -584,8 +577,7 @@ def begin_create_or_update( :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] + :type resource: ~azure.mgmt.containerservicefleet.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 @@ -595,15 +587,13 @@ def begin_create_or_update( :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] + ~azure.core.polling.LROPoller[~azure.mgmt.containerservicefleet.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") - ) + 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.AutoUpgradeProfile] = kwargs.pop("cls", None) polling: Union[bool, PollingMethod] = kwargs.pop("polling", True) @@ -671,9 +661,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-05-02-preview") - ) + 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( @@ -745,9 +733,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-05-02-preview") - ) + 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_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 5f45d384ae07..45fd03211def 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 @@ -50,7 +50,7 @@ def build_list_by_fleet_request( _headers = case_insensitive_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-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -85,7 +85,7 @@ def build_get_request( _headers = case_insensitive_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-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -135,7 +135,7 @@ def build_create_request( _headers = case_insensitive_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-04-01")) + 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") @@ -191,7 +191,7 @@ def build_update_request( _headers = case_insensitive_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-04-01")) + 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") @@ -245,7 +245,7 @@ def build_delete_request( _headers = case_insensitive_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-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -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/v2023_10_15/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/v2023_10_15/operations/_fleet_update_strategies_operations.py rename to sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/operations/_fleet_update_strategies_operations.py index 4370980932d0..d93f3b65d0bf 100644 --- 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/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 @@ -50,7 +50,7 @@ def build_list_by_fleet_request( _headers = case_insensitive_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")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -85,7 +85,7 @@ def build_get_request( _headers = case_insensitive_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")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -135,7 +135,7 @@ def build_create_or_update_request( _headers = case_insensitive_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")) + 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") @@ -191,7 +191,7 @@ def build_delete_request( _headers = case_insensitive_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")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -236,7 +236,7 @@ class FleetUpdateStrategiesOperations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.containerservicefleet.v2023_10_15.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.v2023_10_15.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 "2023-10-15")) + 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.v2023_10_15.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 "2023-10-15")) + 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 "2023-10-15")) + 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.v2023_10_15.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.v2023_10_15.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.v2023_10_15.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.v2023_10_15.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.v2023_10_15.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 "2023-10-15")) + 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 "2023-10-15")) + 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 "2023-10-15")) + 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 94% 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 6d811f1c179c..50d5238133ba 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 @@ -48,7 +48,7 @@ def build_list_by_subscription_request(subscription_id: str, **kwargs: Any) -> H _headers = case_insensitive_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-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -72,7 +72,7 @@ def build_list_by_resource_group_request(resource_group_name: str, subscription_ _headers = case_insensitive_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-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -102,7 +102,7 @@ def build_get_request(resource_group_name: str, fleet_name: str, subscription_id _headers = case_insensitive_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-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -143,7 +143,7 @@ def build_create_or_update_request( _headers = case_insensitive_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-04-01")) + 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") @@ -185,7 +185,7 @@ def build_update_request( _headers = case_insensitive_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-04-01")) + 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") @@ -225,7 +225,7 @@ def build_delete_request( _headers = case_insensitive_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-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -262,7 +262,7 @@ def build_list_credentials_request( _headers = case_insensitive_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-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -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/v2023_10_15/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/v2023_10_15/operations/_operations.py rename to sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/operations/_operations.py index bad1788d274e..a7aa02214c10 100644 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/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 @@ -43,7 +43,7 @@ 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")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -64,7 +64,7 @@ class Operations: **DO NOT** instantiate this class directly. Instead, you should access the following operations through - :class:`~azure.mgmt.containerservicefleet.v2023_10_15.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.v2023_10_15.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 "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]] = { @@ -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 cf848206f27f..3380e5ee38b3 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 @@ -50,7 +50,7 @@ def build_list_by_fleet_request( _headers = case_insensitive_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-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -85,7 +85,7 @@ def build_get_request( _headers = case_insensitive_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-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -135,7 +135,7 @@ def build_create_or_update_request( _headers = case_insensitive_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-04-01")) + 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") @@ -191,7 +191,7 @@ def build_delete_request( _headers = case_insensitive_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-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -242,7 +242,7 @@ def build_skip_request( _headers = case_insensitive_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-04-01")) + 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") @@ -296,7 +296,7 @@ def build_start_request( _headers = case_insensitive_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-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -347,7 +347,7 @@ def build_stop_request( _headers = case_insensitive_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-04-01")) + api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2024-05-02-preview")) accept = _headers.pop("Accept", "application/json") # Construct URL @@ -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 78b8b4b91a49..000000000000 --- 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 5d03ccc61cbe..000000000000 --- 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 3d17da08ba95..000000000000 --- 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 7ba159ecdedd..000000000000 --- 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 83f24ab50946..000000000000 --- 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 af1d7b0b47fe..000000000000 --- 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 2debdb91f6fc..000000000000 --- 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 afd23b7f01e3..000000000000 --- 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 a2f694539aa6..000000000000 --- 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 fffc21ea2446..000000000000 --- 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 b7feb5dbd947..000000000000 --- 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 ad06b3c944a6..000000000000 --- 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 a6279d514074..000000000000 --- 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 8a81ffa68d43..000000000000 --- 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 e7d934c0dc7f..000000000000 --- 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 a2f694539aa6..000000000000 --- 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 2208c082050d..000000000000 --- 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 6466a8e97e2e..000000000000 --- 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 d6bfe32d7368..000000000000 --- 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 e5aff4f83af8..000000000000 --- 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 78b8b4b91a49..000000000000 --- 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 52e04984a75f..000000000000 --- 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 925f27a0f9cd..000000000000 --- 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 8ad9174f215c..000000000000 --- 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 f7dd32510333..000000000000 --- 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 83f24ab50946..000000000000 --- 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 af1d7b0b47fe..000000000000 --- 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 d3bd0c57672c..000000000000 --- 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 5fe77cc4b647..000000000000 --- 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 f7dd32510333..000000000000 --- 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 46d49389d790..000000000000 --- 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 fa695876585c..000000000000 --- 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 0cba1e5f4787..000000000000 --- 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 f7dd32510333..000000000000 --- 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 437bdbe8870e..000000000000 --- 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 c402a954fa54..000000000000 --- 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 3a12606cf18c..000000000000 --- 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 f7dd32510333..000000000000 --- 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 46d49389d790..000000000000 --- 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 0ae29f36c613..000000000000 --- 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 d0e49050fb4b..000000000000 --- 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 f7dd32510333..000000000000 --- 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 e5aff4f83af8..000000000000 --- 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 78b8b4b91a49..000000000000 --- 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 2d8d427cf3b1..000000000000 --- 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 0b561efcc67f..000000000000 --- 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 09ce1c0446b0..000000000000 --- 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 f7dd32510333..000000000000 --- 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 83f24ab50946..000000000000 --- 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 af1d7b0b47fe..000000000000 --- 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 52e1933b98a5..000000000000 --- 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 2d7b65d1c318..000000000000 --- 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 f7dd32510333..000000000000 --- 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 46d49389d790..000000000000 --- 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 5b733704af1a..000000000000 --- 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 13e23ff9e114..000000000000 --- 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 f7dd32510333..000000000000 --- 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 437bdbe8870e..000000000000 --- 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 c402a954fa54..000000000000 --- 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 1a0bc3cb629a..000000000000 --- 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 f7dd32510333..000000000000 --- 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 46d49389d790..000000000000 --- 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 6632431ea7e0..000000000000 --- 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 f4467c3b5c6d..000000000000 --- 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 f7dd32510333..000000000000 --- 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 e5aff4f83af8..000000000000 --- 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 78b8b4b91a49..000000000000 --- 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 4adbf8e51f0d..000000000000 --- 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 2cac72531a2b..000000000000 --- 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 55d1ef7d23fe..000000000000 --- 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 f7dd32510333..000000000000 --- 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 83f24ab50946..000000000000 --- 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 af1d7b0b47fe..000000000000 --- 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 7394ed56ef59..000000000000 --- 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 1aa6dd52349b..000000000000 --- 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 f7dd32510333..000000000000 --- 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 b2c1526f4d81..000000000000 --- 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 bd816ce595c2..000000000000 --- 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 a170837ac576..000000000000 --- 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 c4ed8f7eada6..000000000000 --- 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 f7dd32510333..000000000000 --- 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 d102926b9ce1..000000000000 --- 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 c4299e6903cf..000000000000 --- 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 366f82eb4a1e..000000000000 --- 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 c68286913e17..000000000000 --- 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 f7dd32510333..000000000000 --- 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 b2c1526f4d81..000000000000 --- 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 61730f29a07c..000000000000 --- 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 30811d79e5b2..000000000000 --- 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 93071f08887d..000000000000 --- 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 f7dd32510333..000000000000 --- 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 d8cb16efdd24..000000000000 --- 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 e5aff4f83af8..000000000000 --- 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 78b8b4b91a49..000000000000 --- 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 ca5d7651ab38..000000000000 --- 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 8f333ec0aa90..000000000000 --- 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 df3c6e58bec4..000000000000 --- 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 f7dd32510333..000000000000 --- 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 83f24ab50946..000000000000 --- 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 af1d7b0b47fe..000000000000 --- 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 c258299d9613..000000000000 --- 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 22f7e8f236de..000000000000 --- 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 f7dd32510333..000000000000 --- 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 b2c1526f4d81..000000000000 --- 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 7b0548a8771d..000000000000 --- 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 58e5cc6bda6c..000000000000 --- 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 f85687a3327b..000000000000 --- 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 f7dd32510333..000000000000 --- 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 ea3ad2db225c..000000000000 --- 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 2eca739459fe..000000000000 --- 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 504cfd191133..000000000000 --- 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 914d5fd92f6d..000000000000 --- 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 f7dd32510333..000000000000 --- 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 b2c1526f4d81..000000000000 --- 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 58cdcb4e0692..000000000000 --- 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 d2bc65d3036f..000000000000 --- 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 cfa87ea0320c..000000000000 --- 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 f7dd32510333..000000000000 --- 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 ec685e770287..000000000000 --- 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 e5aff4f83af8..000000000000 --- 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 78b8b4b91a49..000000000000 --- 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 3bd420f13aa2..000000000000 --- 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 40148472ecba..000000000000 --- 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 5038d04d87c8..000000000000 --- 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 f7dd32510333..000000000000 --- 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 83f24ab50946..000000000000 --- 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 af1d7b0b47fe..000000000000 --- 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 984584bc5b36..000000000000 --- 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 8d416914cc35..000000000000 --- 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 f7dd32510333..000000000000 --- 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/__init__.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/aio/operations/__init__.py deleted file mode 100644 index 2233c34e005a..000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_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/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 c8f4b52cddcc..000000000000 --- 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 586a92f376f3..000000000000 --- 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 c0f680c3cd37..000000000000 --- 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 80e214fddbee..000000000000 --- 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 f7dd32510333..000000000000 --- 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 3436f40b50fb..000000000000 --- 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 5efca9c4b558..000000000000 --- 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 d8b75c1580d4..000000000000 --- 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 fbe74179dad3..000000000000 --- 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 f7dd32510333..000000000000 --- 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/__init__.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_preview/operations/__init__.py deleted file mode 100644 index 2233c34e005a..000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_08_15_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/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 ef37a46c0a6c..000000000000 --- 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 97c1a01fb6c7..000000000000 --- 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 bc71485d3fec..000000000000 --- 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 8dd93a2b5919..000000000000 --- 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 f7dd32510333..000000000000 --- 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 75d92582202a..000000000000 --- 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 e5aff4f83af8..000000000000 --- 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 78b8b4b91a49..000000000000 --- 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 8df1e03261c3..000000000000 --- 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 ce2f6eac654f..000000000000 --- 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 b1f17cb884ec..000000000000 --- 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 f7dd32510333..000000000000 --- 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 83f24ab50946..000000000000 --- 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 af1d7b0b47fe..000000000000 --- 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 809347e8dbca..000000000000 --- 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 df20a129abbc..000000000000 --- 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 f7dd32510333..000000000000 --- 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 2233c34e005a..000000000000 --- 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 684a7cc96150..000000000000 --- 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 cefc4323f684..000000000000 --- 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 61915e01d7b1..000000000000 --- 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 f7dd32510333..000000000000 --- 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 8ec141038998..000000000000 --- 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 3429b2ba846f..000000000000 --- 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 d8b75c1580d4..000000000000 --- 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 b88d13311f71..000000000000 --- 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 f7dd32510333..000000000000 --- 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 2233c34e005a..000000000000 --- 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 dab3b680fc0b..000000000000 --- 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/_fleets_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/operations/_fleets_operations.py deleted file mode 100644 index 8b1b052c2315..000000000000 --- 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/_patch.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2023_10_15/operations/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- 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 6d477b8466b9..000000000000 --- 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 e5aff4f83af8..000000000000 --- 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 78b8b4b91a49..000000000000 --- 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 a9013485f615..000000000000 --- 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 d0c4a930235d..000000000000 --- 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 c8f084156e16..000000000000 --- 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 f7dd32510333..000000000000 --- 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 83f24ab50946..000000000000 --- 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 af1d7b0b47fe..000000000000 --- 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 b26ac26d42f6..000000000000 --- 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 0bfdb35fdca3..000000000000 --- 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 f7dd32510333..000000000000 --- 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 2233c34e005a..000000000000 --- 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 e054b8391732..000000000000 --- 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 103d7082c69e..000000000000 --- 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 f462ec2077cd..000000000000 --- 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 2038977552b8..000000000000 --- 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 f7dd32510333..000000000000 --- 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 0b68ce53cb70..000000000000 --- 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/__init__.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/models/__init__.py deleted file mode 100644 index 3d046c826956..000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/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_02_02_preview/models/_container_service_fleet_mgmt_client_enums.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/models/_container_service_fleet_mgmt_client_enums.py deleted file mode 100644 index 19e28171fd83..000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_02_02_preview/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_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 8cce79cea8c7..000000000000 --- 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 f7dd32510333..000000000000 --- 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 2233c34e005a..000000000000 --- 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 ff3559560b39..000000000000 --- 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 1327966b8c8d..000000000000 --- 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 51a2b6e41bd8..000000000000 --- 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 3bd9476e431a..000000000000 --- 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 f7dd32510333..000000000000 --- 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 011522c6739a..000000000000 --- 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 e5aff4f83af8..000000000000 --- 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 78b8b4b91a49..000000000000 --- 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 272c39b1f573..000000000000 --- 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 8c71a4a07059..000000000000 --- 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 78c2bc67abae..000000000000 --- 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 f7dd32510333..000000000000 --- 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 83f24ab50946..000000000000 --- 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 af1d7b0b47fe..000000000000 --- 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 8473d07bde9c..000000000000 --- 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 531d4b5b0a51..000000000000 --- 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 f7dd32510333..000000000000 --- 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 2233c34e005a..000000000000 --- 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 77500c482e93..000000000000 --- 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 f7dd32510333..000000000000 --- 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 3d046c826956..000000000000 --- 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 19e28171fd83..000000000000 --- 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/_models_py3.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_04_01/models/_models_py3.py deleted file mode 100644 index bf8d5afc8f75..000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_04_01/models/_models_py3.py +++ /dev/null @@ -1,1761 +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 - """ - - _attribute_map = { - "enable_private_cluster": {"key": "enablePrivateCluster", "type": "bool"}, - } - - def __init__(self, *, enable_private_cluster: Optional[bool] = 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 - """ - super().__init__(**kwargs) - self.enable_private_cluster = enable_private_cluster - - -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_04_01.models.ErrorDetail] - :ivar additional_info: The error additional info. - :vartype additional_info: - list[~azure.mgmt.containerservicefleet.v2024_04_01.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_04_01.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_04_01.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_04_01.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_04_01.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_04_01.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_04_01.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 - :ivar hub_profile: The FleetHubProfile configures the Fleet's hub. - :vartype hub_profile: ~azure.mgmt.containerservicefleet.v2024_04_01.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_04_01.models.ManagedServiceIdentity - :keyword hub_profile: The FleetHubProfile configures the Fleet's hub. - :paramtype hub_profile: ~azure.mgmt.containerservicefleet.v2024_04_01.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_04_01.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_04_01.models.APIServerAccessProfile - :ivar agent_profile: The agent profile for the Fleet hub. - :vartype agent_profile: ~azure.mgmt.containerservicefleet.v2024_04_01.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_04_01.models.APIServerAccessProfile - :keyword agent_profile: The agent profile for the Fleet hub. - :paramtype agent_profile: ~azure.mgmt.containerservicefleet.v2024_04_01.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_04_01.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_04_01.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_04_01.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_04_01.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_04_01.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_04_01.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_04_01.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_04_01.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_04_01.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_04_01.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_04_01.models.FleetUpdateStrategyProvisioningState - :ivar strategy: Defines the update sequence of the clusters. - :vartype strategy: ~azure.mgmt.containerservicefleet.v2024_04_01.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_04_01.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_04_01.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_04_01.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_04_01.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 - """ - - _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_04_01.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 - """ - 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_04_01.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_04_01.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_04_01.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] - """ - - _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_04_01.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] - """ - 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_04_01.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_04_01.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_04_01.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_04_01.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_04_01.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 - :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 - """ - - _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_04_01.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_04_01.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_04_01.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_04_01.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_04_01.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_04_01.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_04_01.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 - :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_04_01.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 - :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_04_01.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] - """ - - _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_04_01.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_04_01.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_04_01.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 - :ivar status: The status of the UpdateRun. - :vartype status: ~azure.mgmt.containerservicefleet.v2024_04_01.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_04_01.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 - """ - 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_04_01.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_04_01.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_04_01.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] - :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 - """ - - _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_04_01.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_04_01.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_04_01.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_04_01.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_04_01.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] - :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 - """ - - _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_04_01.models.UpdateState - :ivar error: The error details when a failure is encountered. - :vartype error: ~azure.mgmt.containerservicefleet.v2024_04_01.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_04_01.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_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 f7dd32510333..000000000000 --- 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 2233c34e005a..000000000000 --- 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/_fleet_update_strategies_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_04_01/operations/_fleet_update_strategies_operations.py deleted file mode 100644 index ed247ee6f54e..000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_04_01/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", "2024-04-01")) - 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-04-01")) - 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-04-01")) - 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-04-01")) - 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_04_01.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_04_01.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")) - 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_04_01.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-04-01")) - 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-04-01")) - 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_04_01.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_04_01.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_04_01.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_04_01.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_04_01.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")) - 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-04-01")) - 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-04-01")) - 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_04_01/operations/_operations.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_04_01/operations/_operations.py deleted file mode 100644 index 0fc02c2dc73d..000000000000 --- a/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_04_01/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", "2024-04-01")) - 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_04_01.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_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 - - 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_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 f7dd32510333..000000000000 --- 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 e5aff4f83af8..000000000000 --- 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 78b8b4b91a49..000000000000 --- 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 6c1928ca1180..000000000000 --- 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 50d967212b01..000000000000 --- 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 b03a64e297d5..000000000000 --- 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 f7dd32510333..000000000000 --- 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 83f24ab50946..000000000000 --- 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 af1d7b0b47fe..000000000000 --- 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 4179e4fdac5a..000000000000 --- 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 458390c7af0f..000000000000 --- 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 f7dd32510333..000000000000 --- 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/_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 3fbaf6f58f54..000000000000 --- 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 af005d78ea95..000000000000 --- 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 6f3095bc200f..000000000000 --- 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 7d8ad9669d71..000000000000 --- 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 f7dd32510333..000000000000 --- 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 a6253075936f..000000000000 --- 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/_patch.py b/sdk/containerservice/azure-mgmt-containerservicefleet/azure/mgmt/containerservicefleet/v2024_05_02_preview/models/_patch.py deleted file mode 100644 index f7dd32510333..000000000000 --- 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/_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 60ff4d4a5846..000000000000 --- 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 0a7d215de0d9..000000000000 --- 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 06f9f2801303..000000000000 --- 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 39091f27f596..000000000000 --- 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 f7dd32510333..000000000000 --- 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 6aa085585e3b..000000000000 --- 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 e5aff4f83af8..000000000000 --- 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